From 54028e5363140ff160eaded2a7eef8af9ac66b96 Mon Sep 17 00:00:00 2001 From: John Marino Date: Wed, 2 Nov 2011 23:54:48 +0100 Subject: [PATCH] Upgrade GMP from 4.3.2 to 5.0.2 on the vendor branch --- contrib/gmp/AUTHORS | 42 +- contrib/gmp/Makefile.am | 411 - contrib/gmp/Makefile.in | 1369 - contrib/gmp/config.guess | 841 - contrib/gmp/config.in | 521 - contrib/gmp/config.sub | 143 - contrib/gmp/configfsf.guess | 1526 - contrib/gmp/configfsf.sub | 1673 - contrib/gmp/configure | 35563 ---------------- contrib/gmp/dumbmp.c | 51 +- contrib/gmp/gen-trialdivtab.c | 298 + contrib/gmp/gmp-h.in | 2230 - contrib/gmp/gmp-impl.h | 1699 +- contrib/gmp/longlong.h | 23 +- contrib/gmp/mp-h.in | 163 - contrib/gmp/mp_bpl.c | 2 +- contrib/gmp/mpf/Makefile.am | 37 - contrib/gmp/mpf/Makefile.in | 660 - contrib/gmp/mpf/add.c | 2 +- contrib/gmp/{mpz/urandomb.c => mpf/clears.c} | 47 +- contrib/gmp/mpf/div.c | 76 +- contrib/gmp/mpf/div_2exp.c | 2 +- contrib/gmp/mpf/div_ui.c | 2 +- contrib/gmp/mpf/eq.c | 45 +- contrib/gmp/mpf/get_dfl_prec.c | 2 +- contrib/gmp/mpf/get_prc.c | 2 +- contrib/gmp/mpf/get_str.c | 2 +- contrib/gmp/mpf/init2.c | 2 +- contrib/gmp/{mpz/urandomb.c => mpf/inits.c} | 47 +- contrib/gmp/mpf/mul.c | 2 +- contrib/gmp/mpf/mul_2exp.c | 2 +- contrib/gmp/mpf/set_dfl_prec.c | 2 +- contrib/gmp/mpf/set_prc.c | 2 +- contrib/gmp/mpf/set_prc_raw.c | 2 +- contrib/gmp/mpf/set_str.c | 2 +- contrib/gmp/mpf/sqrt.c | 2 +- contrib/gmp/mpf/sqrt_ui.c | 2 +- contrib/gmp/mpf/sub.c | 4 +- contrib/gmp/mpf/ui_sub.c | 2 +- contrib/gmp/mpf/urandomb.c | 2 +- contrib/gmp/mpn/Makefile.am | 80 - contrib/gmp/mpn/Makefile.in | 859 - contrib/gmp/mpn/generic/add_n.c | 11 +- contrib/gmp/mpn/generic/addsub_n.c | 14 +- contrib/gmp/mpn/generic/bdiv_q.c | 66 + contrib/gmp/mpn/generic/bdiv_q_1.c | 115 + contrib/gmp/mpn/generic/bdiv_qr.c | 73 + contrib/gmp/mpn/generic/bdivmod.c | 124 - contrib/gmp/mpn/generic/binvert.c | 58 +- .../{mpf/get_dfl_prec.c => mpn/generic/com.c} | 16 +- contrib/gmp/mpn/generic/{neg_n.c => copyd.c} | 15 +- contrib/gmp/mpn/generic/{neg_n.c => copyi.c} | 17 +- contrib/gmp/mpn/generic/dc_bdiv_q.c | 137 - contrib/gmp/mpn/generic/dc_div_qr.c | 203 - contrib/gmp/mpn/generic/dc_divappr_q.c | 196 - contrib/gmp/mpn/generic/dc_divrem_n.c | 121 - contrib/gmp/mpn/generic/dcpi1_bdiv_q.c | 150 + .../generic/{dc_bdiv_qr.c => dcpi1_bdiv_qr.c} | 45 +- .../mpn/generic/{dc_div_q.c => dcpi1_div_q.c} | 41 +- contrib/gmp/mpn/generic/dcpi1_div_qr.c | 238 + contrib/gmp/mpn/generic/dcpi1_divappr_q.c | 246 + contrib/gmp/mpn/generic/div_q.c | 312 + contrib/gmp/mpn/generic/dive_1.c | 4 +- contrib/gmp/mpn/generic/divexact.c | 115 +- contrib/gmp/mpn/generic/divis.c | 140 +- contrib/gmp/mpn/generic/divrem.c | 12 +- contrib/gmp/mpn/generic/fib2_ui.c | 83 +- contrib/gmp/mpn/generic/gcd_1.c | 64 + contrib/gmp/mpn/generic/gcdext.c | 18 +- contrib/gmp/mpn/generic/gcdext_1.c | 237 + contrib/gmp/mpn/generic/get_d.c | 10 +- contrib/gmp/mpn/generic/get_str.c | 8 +- contrib/gmp/mpn/generic/gmp-mparam.h | 2 +- contrib/gmp/mpn/generic/hgcd.c | 38 +- contrib/gmp/mpn/generic/invert.c | 91 +- contrib/gmp/mpn/generic/invertappr.c | 311 + contrib/gmp/mpn/generic/logops_n.c | 67 + contrib/gmp/mpn/generic/lshiftc.c | 63 + contrib/gmp/mpn/generic/matrix22_mul.c | 233 +- contrib/gmp/mpn/generic/mod_1.c | 69 +- contrib/gmp/mpn/generic/mod_1_1.c | 47 +- contrib/gmp/mpn/generic/mod_1_2.c | 28 +- contrib/gmp/mpn/generic/mod_1_3.c | 62 +- contrib/gmp/mpn/generic/mod_1_4.c | 77 +- contrib/gmp/mpn/generic/mode1o.c | 2 +- contrib/gmp/mpn/generic/mu_bdiv_q.c | 209 +- contrib/gmp/mpn/generic/mu_bdiv_qr.c | 267 +- contrib/gmp/mpn/generic/mu_div_q.c | 133 +- contrib/gmp/mpn/generic/mu_div_qr.c | 380 +- contrib/gmp/mpn/generic/mu_divappr_q.c | 304 +- contrib/gmp/mpn/generic/mul.c | 350 +- contrib/gmp/mpn/generic/mul_basecase.c | 2 +- contrib/gmp/mpn/generic/mul_fft.c | 334 +- contrib/gmp/mpn/generic/mul_n.c | 776 +- .../{mullow_basecase.c => mullo_basecase.c} | 4 +- contrib/gmp/mpn/generic/mullo_n.c | 245 + contrib/gmp/mpn/generic/mullow_n.c | 111 - contrib/gmp/mpn/generic/mulmod_bnm1.c | 351 + contrib/gmp/mpn/generic/{neg_n.c => neg.c} | 4 +- contrib/gmp/mpn/generic/nussbaumer_mul.c | 60 + contrib/gmp/mpn/generic/perfpow.c | 493 + contrib/gmp/mpn/generic/perfsqr.c | 26 +- contrib/gmp/mpn/generic/popham.c | 4 +- contrib/gmp/mpn/generic/pow_1.c | 11 +- contrib/gmp/mpn/generic/powlo.c | 44 +- contrib/gmp/mpn/generic/powm.c | 416 +- contrib/gmp/mpn/generic/powm_sec.c | 264 +- contrib/gmp/mpn/generic/pre_divrem_1.c | 8 +- contrib/gmp/mpn/generic/random2.c | 6 +- contrib/gmp/mpn/generic/redc_1.c | 7 +- .../mpn/generic/{redc_1.c => redc_1_sec.c} | 14 +- contrib/gmp/mpn/generic/redc_2.c | 3 +- contrib/gmp/mpn/generic/redc_n.c | 66 + contrib/gmp/mpn/generic/remove.c | 143 + contrib/gmp/mpn/generic/rootrem.c | 69 +- contrib/gmp/mpn/generic/sb_div_qr.c | 91 - contrib/gmp/mpn/generic/sb_divappr_q.c | 136 - contrib/gmp/mpn/generic/sb_divrem_mn.c | 205 - .../generic/{sb_bdiv_q.c => sbpi1_bdiv_q.c} | 58 +- .../generic/{sb_bdiv_qr.c => sbpi1_bdiv_qr.c} | 16 +- .../mpn/generic/{sb_div_q.c => sbpi1_div_q.c} | 212 +- contrib/gmp/mpn/generic/sbpi1_div_qr.c | 99 + contrib/gmp/mpn/generic/sbpi1_divappr_q.c | 188 + contrib/gmp/mpn/generic/scan0.c | 5 +- contrib/gmp/mpn/generic/scan1.c | 5 +- contrib/gmp/mpn/generic/set_str.c | 18 +- contrib/gmp/mpn/generic/sizeinbase.c | 8 +- contrib/gmp/mpn/generic/sqr.c | 88 + contrib/gmp/mpn/generic/sqr_basecase.c | 12 +- contrib/gmp/mpn/generic/sqrmod_bnm1.c | 302 + contrib/gmp/mpn/generic/sqrtrem.c | 12 +- contrib/gmp/mpn/generic/sub_n.c | 11 +- contrib/gmp/mpn/generic/tdiv_qr.c | 119 +- contrib/gmp/mpn/generic/toom22_mul.c | 25 +- contrib/gmp/mpn/generic/toom2_sqr.c | 21 +- contrib/gmp/mpn/generic/toom32_mul.c | 293 +- contrib/gmp/mpn/generic/toom33_mul.c | 115 +- contrib/gmp/mpn/generic/toom3_sqr.c | 99 +- contrib/gmp/mpn/generic/toom42_mul.c | 69 +- contrib/gmp/mpn/generic/toom43_mul.c | 223 + contrib/gmp/mpn/generic/toom44_mul.c | 319 +- contrib/gmp/mpn/generic/toom4_sqr.c | 186 +- contrib/gmp/mpn/generic/toom52_mul.c | 246 + contrib/gmp/mpn/generic/toom53_mul.c | 259 +- contrib/gmp/mpn/generic/toom62_mul.c | 264 +- contrib/gmp/mpn/generic/toom63_mul.c | 221 + contrib/gmp/mpn/generic/toom6_sqr.c | 171 + contrib/gmp/mpn/generic/toom6h_mul.c | 232 + contrib/gmp/mpn/generic/toom8_sqr.c | 208 + contrib/gmp/mpn/generic/toom8h_mul.c | 290 + .../gmp/mpn/generic/toom_couple_handling.c | 70 + contrib/gmp/mpn/generic/toom_eval_dgr3_pm1.c | 62 + contrib/gmp/mpn/generic/toom_eval_dgr3_pm2.c | 87 + contrib/gmp/mpn/generic/toom_eval_pm1.c | 79 + contrib/gmp/mpn/generic/toom_eval_pm2.c | 120 + contrib/gmp/mpn/generic/toom_eval_pm2exp.c | 117 + contrib/gmp/mpn/generic/toom_eval_pm2rexp.c | 91 + .../gmp/mpn/generic/toom_interpolate_12pts.c | 350 + .../gmp/mpn/generic/toom_interpolate_16pts.c | 512 + .../gmp/mpn/generic/toom_interpolate_5pts.c | 119 +- .../gmp/mpn/generic/toom_interpolate_6pts.c | 229 + .../gmp/mpn/generic/toom_interpolate_7pts.c | 212 +- .../gmp/mpn/generic/toom_interpolate_8pts.c | 192 + contrib/gmp/mpn/generic/trialdiv.c | 110 + contrib/gmp/mpn/generic/udiv_w_sdiv.c | 8 +- contrib/gmp/mpn/generic/{neg_n.c => zero.c} | 16 +- contrib/gmp/mpq/Makefile.am | 30 - contrib/gmp/mpq/Makefile.in | 562 - contrib/gmp/{mpz/urandomb.c => mpq/clears.c} | 47 +- contrib/gmp/mpq/cmp.c | 2 +- contrib/gmp/mpq/cmp_ui.c | 4 +- contrib/gmp/mpq/get_d.c | 2 +- contrib/gmp/mpq/get_str.c | 4 +- contrib/gmp/{mpz/urandomb.c => mpq/inits.c} | 47 +- contrib/gmp/mpq/md_2exp.c | 6 +- contrib/gmp/mpq/set_f.c | 2 +- contrib/gmp/mpq/set_si.c | 2 +- contrib/gmp/mpz/Makefile.am | 60 - contrib/gmp/mpz/Makefile.in | 906 - contrib/gmp/mpz/aorsmul_i.c | 8 +- contrib/gmp/mpz/cfdiv_q_2exp.c | 8 +- contrib/gmp/mpz/cfdiv_r_2exp.c | 10 +- contrib/gmp/mpz/{urandomb.c => clears.c} | 47 +- contrib/gmp/mpz/clrbit.c | 2 +- contrib/gmp/mpz/combit.c | 2 +- contrib/gmp/mpz/cong.c | 2 +- contrib/gmp/mpz/cong_2exp.c | 5 +- contrib/gmp/mpz/cong_ui.c | 2 +- contrib/gmp/mpz/divexact.c | 101 +- contrib/gmp/mpz/divis_2exp.c | 5 +- contrib/gmp/mpz/divis_ui.c | 2 +- contrib/gmp/mpz/fib_ui.c | 4 +- contrib/gmp/mpz/gcd.c | 6 +- contrib/gmp/mpz/gcd_ui.c | 2 +- contrib/gmp/mpz/gcdext.c | 12 +- contrib/gmp/mpz/hamdist.c | 10 +- contrib/gmp/mpz/init2.c | 2 +- contrib/gmp/mpz/{urandomb.c => inits.c} | 47 +- contrib/gmp/mpz/jacobi.c | 5 +- contrib/gmp/mpz/kronsz.c | 2 +- contrib/gmp/mpz/lucnum_ui.c | 2 +- contrib/gmp/mpz/mul.c | 44 +- contrib/gmp/mpz/mul_2exp.c | 2 +- contrib/gmp/mpz/n_pow_ui.c | 16 +- contrib/gmp/mpz/nextprime.c | 4 +- contrib/gmp/mpz/out_str.c | 6 +- contrib/gmp/mpz/perfpow.c | 260 +- contrib/gmp/mpz/powm.c | 490 +- contrib/gmp/mpz/powm_sec.c | 90 + contrib/gmp/mpz/powm_ui.c | 4 +- contrib/gmp/mpz/pprime_p.c | 10 +- contrib/gmp/mpz/realloc2.c | 2 +- contrib/gmp/mpz/remove.c | 6 +- contrib/gmp/mpz/rrandomb.c | 8 +- contrib/gmp/mpz/scan0.c | 10 +- contrib/gmp/mpz/scan1.c | 10 +- contrib/gmp/mpz/setbit.c | 2 +- contrib/gmp/mpz/sqrt.c | 2 +- contrib/gmp/mpz/sqrtrem.c | 2 +- contrib/gmp/mpz/tdiv_q.c | 24 +- contrib/gmp/mpz/tdiv_q_2exp.c | 2 +- contrib/gmp/mpz/tdiv_qr.c | 4 +- contrib/gmp/mpz/tdiv_r.c | 6 +- contrib/gmp/mpz/tdiv_r_2exp.c | 2 +- contrib/gmp/mpz/tstbit.c | 4 +- contrib/gmp/mpz/urandomb.c | 2 +- contrib/gmp/nextprime.c | 156 + contrib/gmp/printf/Makefile.am | 30 - contrib/gmp/printf/Makefile.in | 540 - contrib/gmp/printf/doprntf.c | 4 +- contrib/gmp/printf/snprntffuns.c | 2 +- contrib/gmp/randlc2s.c | 2 +- contrib/gmp/randlc2x.c | 8 +- contrib/gmp/scanf/Makefile.am | 27 - contrib/gmp/scanf/Makefile.in | 503 - contrib/gmp/scanf/doscan.c | 2 +- contrib/gmp/ylwrap | 222 + 237 files changed, 13725 insertions(+), 55470 deletions(-) delete mode 100644 contrib/gmp/Makefile.am delete mode 100644 contrib/gmp/Makefile.in delete mode 100755 contrib/gmp/config.guess delete mode 100644 contrib/gmp/config.in delete mode 100755 contrib/gmp/config.sub delete mode 100755 contrib/gmp/configfsf.guess delete mode 100755 contrib/gmp/configfsf.sub delete mode 100755 contrib/gmp/configure create mode 100644 contrib/gmp/gen-trialdivtab.c delete mode 100644 contrib/gmp/gmp-h.in delete mode 100644 contrib/gmp/mp-h.in delete mode 100644 contrib/gmp/mpf/Makefile.am delete mode 100644 contrib/gmp/mpf/Makefile.in copy contrib/gmp/{mpz/urandomb.c => mpf/clears.c} (58%) copy contrib/gmp/{mpz/urandomb.c => mpf/inits.c} (57%) delete mode 100644 contrib/gmp/mpn/Makefile.am delete mode 100644 contrib/gmp/mpn/Makefile.in create mode 100644 contrib/gmp/mpn/generic/bdiv_q.c create mode 100644 contrib/gmp/mpn/generic/bdiv_q_1.c create mode 100644 contrib/gmp/mpn/generic/bdiv_qr.c delete mode 100644 contrib/gmp/mpn/generic/bdivmod.c copy contrib/gmp/{mpf/get_dfl_prec.c => mpn/generic/com.c} (73%) copy contrib/gmp/mpn/generic/{neg_n.c => copyd.c} (80%) copy contrib/gmp/mpn/generic/{neg_n.c => copyi.c} (78%) delete mode 100644 contrib/gmp/mpn/generic/dc_bdiv_q.c delete mode 100644 contrib/gmp/mpn/generic/dc_div_qr.c delete mode 100644 contrib/gmp/mpn/generic/dc_divappr_q.c delete mode 100644 contrib/gmp/mpn/generic/dc_divrem_n.c create mode 100644 contrib/gmp/mpn/generic/dcpi1_bdiv_q.c rename contrib/gmp/mpn/generic/{dc_bdiv_qr.c => dcpi1_bdiv_qr.c} (68%) rename contrib/gmp/mpn/generic/{dc_div_q.c => dcpi1_div_q.c} (51%) create mode 100644 contrib/gmp/mpn/generic/dcpi1_div_qr.c create mode 100644 contrib/gmp/mpn/generic/dcpi1_divappr_q.c create mode 100644 contrib/gmp/mpn/generic/div_q.c create mode 100644 contrib/gmp/mpn/generic/invertappr.c create mode 100644 contrib/gmp/mpn/generic/logops_n.c create mode 100644 contrib/gmp/mpn/generic/lshiftc.c rename contrib/gmp/mpn/generic/{mullow_basecase.c => mullo_basecase.c} (89%) create mode 100644 contrib/gmp/mpn/generic/mullo_n.c delete mode 100644 contrib/gmp/mpn/generic/mullow_n.c create mode 100644 contrib/gmp/mpn/generic/mulmod_bnm1.c copy contrib/gmp/mpn/generic/{neg_n.c => neg.c} (92%) create mode 100644 contrib/gmp/mpn/generic/nussbaumer_mul.c create mode 100644 contrib/gmp/mpn/generic/perfpow.c copy contrib/gmp/mpn/generic/{redc_1.c => redc_1_sec.c} (73%) create mode 100644 contrib/gmp/mpn/generic/redc_n.c create mode 100644 contrib/gmp/mpn/generic/remove.c delete mode 100644 contrib/gmp/mpn/generic/sb_div_qr.c delete mode 100644 contrib/gmp/mpn/generic/sb_divappr_q.c delete mode 100644 contrib/gmp/mpn/generic/sb_divrem_mn.c rename contrib/gmp/mpn/generic/{sb_bdiv_q.c => sbpi1_bdiv_q.c} (64%) rename contrib/gmp/mpn/generic/{sb_bdiv_qr.c => sbpi1_bdiv_qr.c} (83%) rename contrib/gmp/mpn/generic/{sb_div_q.c => sbpi1_div_q.c} (54%) create mode 100644 contrib/gmp/mpn/generic/sbpi1_div_qr.c create mode 100644 contrib/gmp/mpn/generic/sbpi1_divappr_q.c create mode 100644 contrib/gmp/mpn/generic/sqr.c create mode 100644 contrib/gmp/mpn/generic/sqrmod_bnm1.c create mode 100644 contrib/gmp/mpn/generic/toom43_mul.c create mode 100644 contrib/gmp/mpn/generic/toom52_mul.c create mode 100644 contrib/gmp/mpn/generic/toom63_mul.c create mode 100644 contrib/gmp/mpn/generic/toom6_sqr.c create mode 100644 contrib/gmp/mpn/generic/toom6h_mul.c create mode 100644 contrib/gmp/mpn/generic/toom8_sqr.c create mode 100644 contrib/gmp/mpn/generic/toom8h_mul.c create mode 100644 contrib/gmp/mpn/generic/toom_couple_handling.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_dgr3_pm1.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_dgr3_pm2.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_pm1.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_pm2.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_pm2exp.c create mode 100644 contrib/gmp/mpn/generic/toom_eval_pm2rexp.c create mode 100644 contrib/gmp/mpn/generic/toom_interpolate_12pts.c create mode 100644 contrib/gmp/mpn/generic/toom_interpolate_16pts.c create mode 100644 contrib/gmp/mpn/generic/toom_interpolate_6pts.c create mode 100644 contrib/gmp/mpn/generic/toom_interpolate_8pts.c create mode 100644 contrib/gmp/mpn/generic/trialdiv.c rename contrib/gmp/mpn/generic/{neg_n.c => zero.c} (81%) delete mode 100644 contrib/gmp/mpq/Makefile.am delete mode 100644 contrib/gmp/mpq/Makefile.in copy contrib/gmp/{mpz/urandomb.c => mpq/clears.c} (58%) copy contrib/gmp/{mpz/urandomb.c => mpq/inits.c} (57%) delete mode 100644 contrib/gmp/mpz/Makefile.am delete mode 100644 contrib/gmp/mpz/Makefile.in copy contrib/gmp/mpz/{urandomb.c => clears.c} (58%) copy contrib/gmp/mpz/{urandomb.c => inits.c} (57%) create mode 100644 contrib/gmp/mpz/powm_sec.c create mode 100644 contrib/gmp/nextprime.c delete mode 100644 contrib/gmp/printf/Makefile.am delete mode 100644 contrib/gmp/printf/Makefile.in delete mode 100644 contrib/gmp/scanf/Makefile.am delete mode 100644 contrib/gmp/scanf/Makefile.in create mode 100755 contrib/gmp/ylwrap diff --git a/contrib/gmp/AUTHORS b/contrib/gmp/AUTHORS index ea16d78a8b..79bfa8101d 100644 --- a/contrib/gmp/AUTHORS +++ b/contrib/gmp/AUTHORS @@ -1,25 +1,55 @@ Authors of GNU MP (in chronological order of initial contribution) Torbjörn Granlund Main author + John Amanatides Original version of mpz/pprime_p.c + Paul Zimmermann mpn/generic/mul_fft.c, dc_divrem_n.c, rootrem.c, old mpz/powm.c, old toom3 code. + Ken Weber mpn/generic/bdivmod.c, old mpn/generic/gcd.c + Bennet Yee mpz/jacobi.c mpz/legendre.c -Andreas Schwab mpn/m68k/lshift.S, mpn/m68k/rshift.S -Robert Harley Old mpn/generic/mul_n.c, files in mpn/arm + +Andreas Schwab mpn/m68k/lshift.asm, mpn/m68k/rshift.asm + +Robert Harley Old mpn/generic/mul_n.c, many files in mpn/arm + Linus Nordberg Random number framework, original autoconfery + Kent Boortz MacOS 9 port + Kevin Ryde Most x86 assembly, new autoconfery, and countless other things (please see the GMP manual for complete list) + Gerardo Ballabio gmpxx.h and C++ istream input + Pedro Gimeno Mersenne Twister random generator, other random number revisions -Jason Moxham New mpz/fac_ui.c and gen-fac_ui.c + +Jason Moxham mpz/fac_ui.c and gen-fac_ui.c + Niels Möller mpn/generic/hgcd2.c, gcd.c, gcdext.c, matrix22_mul.c, hgcd.c, gcdext_1.c, gcd_subdiv_step.c, gcd_lehmer.c, gcdext_subdiv_step.c, gcdext_lehmer.c, - toom_interpolate_7pts, mpz/nextprime.c. + toom_interpolate_7pts, mulmod_bnm1.c, dcpi1_bdiv_qr.c, + dcpi1_bdiv_q.c, sbpi1_bdiv_qr.c, sbpi1_bdiv_q.c, + toom_eval_dgr3_pm1.c, toom_eval_dgr3_pm2.c, + toom_eval_pm1.c, toom_eval_pm2.c, toom_eval_pm2exp.c, + divexact.c, mpn/x86/invert_limb.asm, + mpn/x86_64/invert_limb.asm, mpz/nextprime.c, + mpz/divexact.c. + Marco Bodrato mpn/generic/toom44_mul.c, toom4_sqr.c, toom53_mul.c, - toom62_mul.c -David Harvey mpn/x86_64/mul_basecase.asm. + toom62_mul.c, toom43_mul.c, toom52_mul.c, + toom_interpolate_6pts.c, toom_couple_handling.c, + toom63_mul.c, toom_interpolate_8pts.c, + toom6h_mul.c, toom6_sqr.c, toom_interpolate_12pts.c, + toom8h_mul.c, toom8_sqr.c, toom_interpolate_16pts.c, + mulmod_bnm1.c, sqrmod_bnm1.c, nussbaumer_mul.c, + toom_eval_pm2.c, toom_eval_pm2rexp.c, + mullo_n.c, invert.c, invertappr.c. + +David Harvey mpn/x86_64/mul_basecase.asm + +Martin Boij mpn/generic/perfpow.c diff --git a/contrib/gmp/Makefile.am b/contrib/gmp/Makefile.am deleted file mode 100644 index 6a2bd13657..0000000000 --- a/contrib/gmp/Makefile.am +++ /dev/null @@ -1,411 +0,0 @@ -## Process this file with automake to generate Makefile.in - - -# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, -# 2006, 2007, 2008, 2009 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -# The following options are the same as AM_INIT_AUTOMAKE in configure.in, -# except no $(top_builddir) on ansi2knr. That directory is wanted for the -# Makefiles in subdirectories, but here we must omit it so automake gives -# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr". -# -AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies ansi2knr - - -# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the -# libtool manual. -# -# CURRENT:REVISION:AGE -# -# 1. No interfaces changed, only implementations (good): Increment REVISION. -# -# 2. Interfaces added, none removed (good): Increment CURRENT, increment -# AGE, set REVISION to 0. -# -# 3. Interfaces removed (BAD, breaks upward compatibility): Increment -# CURRENT, set AGE and REVISION to 0. -# -# Do this separately for libgmp, libgmpxx and libmp, and only for releases. -# -# GMP -version-info -# release libgmp libgmpxx libmp -# 2.0.x - - - -# 3.0 3:0:0 - 3:0:0 -# 3.0.1 3:1:0 - 3:0:0 -# 3.1 4:0:1 - 4:0:1 -# 3.1.1 4:1:1 - 4:1:1 -# 4.0 5:0:2 3:0:0 4:2:1 -# 4.0.1 5:1:2 3:1:0 4:3:1 -# 4.1 6:0:3 3:2:0 4:4:1 -# 4.1.1 6:1:3 3:3:0 4:5:1 -# 4.1.2 6:2:3 3:4:0 4:6:1 -# 4.1.3 6:3:3 3:5:0 4:7:1 -# 4.1.4 6:3:3 3:5:0 4:7:1 WRONG, same as 4.1.3! -# 4.2 6:0:3 3:2:0 4:4:1 REALLY WRONG, same as 4.1! -# 4.2.1 7:1:4 4:1:1 4:10:1 WRONG for libgmpxx -# 4.2.2 7:2:4 4:2:0 4:11:1 -# 4.2.3 7:3:4 4:3:0 4:12:1 -# 4.2.4 7:4:4 4:4:0 4:13:1 -# 4.3.0 8:0:5 5:0:1 4:14:1 -# 4.3.1 8:1:5 5:1:1 4:15:1 WRONG Really used same as 4.3.0 -# 4.3.2 8:2:5 5:2:1 4:16:1 -# -# Starting at 3:0:0 is a slight abuse of the versioning system, but it -# ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux -# packages of gmp 2. Pretend gmp 2 was 2:0:0, so the interface changes for -# gmp 3 mean 3:0:0 is right. -# -# We interpret "implementation changed" in item "1." above as meaning any -# release, ie. the REVISION is incremented every time (if nothing else). -# Even if we thought the code generated will be identical on all systems, -# it's still good to get the shared library filename (like -# libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from. - -LIBGMP_LT_CURRENT = 8 -LIBGMP_LT_REVISION = 2 -LIBGMP_LT_AGE = 5 - -LIBGMPXX_LT_CURRENT = 5 -LIBGMPXX_LT_REVISION = 2 -LIBGMPXX_LT_AGE = 1 - -LIBMP_LT_CURRENT = 4 -LIBMP_LT_REVISION = 16 -LIBMP_LT_AGE = 1 - - -SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc - -EXTRA_DIST = macos configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf - -if WANT_CXX -GMPXX_HEADERS_OPTION = gmpxx.h -endif -EXTRA_DIST += gmpxx.h - -# gmp.h and mp.h are architecture dependent, mainly since they encode the -# limb size used in libgmp. For that reason they belong under $exec_prefix -# not $prefix, strictly speaking. -# -# $exec_prefix/include is not in the default include path for gcc built to -# the same $prefix and $exec_prefix, which might mean gmp.h is not found, -# but anyone knowledgable enough to be playing with exec_prefix will be able -# to address that. -# -includeexecdir = $(exec_prefix)/include -include_HEADERS = $(GMPXX_HEADERS_OPTION) -nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION) -lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION) - -BUILT_SOURCES = gmp.h - -DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@ - -# Tell gmp.h it's building gmp, not an application, used by windows DLL stuff. -INCLUDES=-D__GMP_WITHIN_GMP - - -MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo mpf/set_ui$U.lo \ - mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo mpf/set_z$U.lo \ - mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo mpf/iset_str$U.lo \ - mpf/iset_d$U.lo mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo \ - mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \ - mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \ - mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo mpf/mul_ui$U.lo \ - mpf/div$U.lo mpf/div_ui$U.lo \ - mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \ - mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \ - mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \ - mpf/set_prc$U.lo mpf/set_prc_raw$U.lo mpf/get_dfl_prec$U.lo \ - mpf/get_prc$U.lo mpf/ui_div$U.lo mpf/sqrt_ui$U.lo \ - mpf/ceilfloor$U.lo mpf/trunc$U.lo mpf/pow_ui$U.lo \ - mpf/urandomb$U.lo mpf/swap$U.lo \ - mpf/fits_sint$U.lo mpf/fits_slong$U.lo mpf/fits_sshort$U.lo \ - mpf/fits_uint$U.lo mpf/fits_ulong$U.lo mpf/fits_ushort$U.lo \ - mpf/get_si$U.lo mpf/get_ui$U.lo \ - mpf/int_p$U.lo - -MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \ - mpz/aorsmul$U.lo mpz/aorsmul_i$U.lo mpz/and$U.lo mpz/array_init$U.lo \ - mpz/bin_ui$U.lo mpz/bin_uiui$U.lo \ - mpz/cdiv_q$U.lo mpz/cdiv_q_ui$U.lo \ - mpz/cdiv_qr$U.lo mpz/cdiv_qr_ui$U.lo \ - mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo mpz/cdiv_ui$U.lo \ - mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \ - mpz/clear$U.lo mpz/clrbit$U.lo \ - mpz/cmp$U.lo mpz/cmp_d$U.lo mpz/cmp_si$U.lo mpz/cmp_ui$U.lo \ - mpz/cmpabs$U.lo mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo \ - mpz/com$U.lo mpz/combit$U.lo \ - mpz/cong$U.lo mpz/cong_2exp$U.lo mpz/cong_ui$U.lo \ - mpz/divexact$U.lo mpz/divegcd$U.lo mpz/dive_ui$U.lo \ - mpz/divis$U.lo mpz/divis_ui$U.lo mpz/divis_2exp$U.lo mpz/dump$U.lo \ - mpz/export$U.lo mpz/fac_ui$U.lo mpz/fdiv_q$U.lo \ - mpz/fdiv_q_ui$U.lo mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo \ - mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo \ - mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo mpz/fib2_ui$U.lo mpz/fits_sint$U.lo \ - mpz/fits_slong$U.lo mpz/fits_sshort$U.lo mpz/fits_uint$U.lo \ - mpz/fits_ulong$U.lo mpz/fits_ushort$U.lo mpz/gcd$U.lo \ - mpz/gcd_ui$U.lo mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \ - mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo mpz/getlimbn$U.lo \ - mpz/hamdist$U.lo \ - mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo \ - mpz/inp_str$U.lo mpz/invert$U.lo \ - mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo \ - mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo \ - mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo \ - mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \ - mpz/millerrabin$U.lo mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo \ - mpz/mul_si$U.lo mpz/mul_ui$U.lo \ - mpz/n_pow_ui$U.lo mpz/neg$U.lo mpz/nextprime$U.lo \ - mpz/out_raw$U.lo mpz/out_str$U.lo mpz/perfpow$U.lo mpz/perfsqr$U.lo \ - mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_ui$U.lo \ - mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo \ - mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo \ - mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo \ - mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo \ - mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo \ - mpz/setbit$U.lo \ - mpz/size$U.lo mpz/sizeinbase$U.lo mpz/sqrt$U.lo \ - mpz/sqrtrem$U.lo mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo \ - mpz/tdiv_ui$U.lo mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo \ - mpz/tdiv_q_ui$U.lo mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo \ - mpz/tdiv_r$U.lo mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo \ - mpz/tstbit$U.lo mpz/ui_pow_ui$U.lo mpz/ui_sub$U.lo mpz/urandomb$U.lo \ - mpz/urandomm$U.lo mpz/xor$U.lo - -MPQ_OBJECTS = mpq/abs$U.lo mpq/aors$U.lo \ - mpq/canonicalize$U.lo mpq/clear$U.lo \ - mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo mpq/div$U.lo \ - mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo mpq/get_str$U.lo \ - mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \ - mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \ - mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo \ - mpq/set_si$U.lo mpq/set_str$U.lo mpq/set_ui$U.lo \ - mpq/equal$U.lo mpq/set_z$U.lo mpq/set_d$U.lo \ - mpq/set_f$U.lo mpq/swap$U.lo - -MPN_OBJECTS = mpn/fib_table$U.lo mpn/mp_bases$U.lo - -PRINTF_OBJECTS = \ - printf/asprintf$U.lo printf/asprntffuns$U.lo \ - printf/doprnt$U.lo printf/doprntf$U.lo printf/doprnti$U.lo \ - printf/fprintf$U.lo \ - printf/obprintf$U.lo printf/obvprintf$U.lo printf/obprntffuns$U.lo \ - printf/printf$U.lo printf/printffuns$U.lo \ - printf/snprintf$U.lo printf/snprntffuns$U.lo \ - printf/sprintf$U.lo printf/sprintffuns$U.lo \ - printf/vasprintf$U.lo printf/vfprintf$U.lo printf/vprintf$U.lo \ - printf/vsnprintf$U.lo printf/vsprintf$U.lo \ - printf/repl-vsnprintf$U.lo - -SCANF_OBJECTS = \ - scanf/doscan$U.lo scanf/fscanf$U.lo scanf/fscanffuns$U.lo \ - scanf/scanf$U.lo scanf/sscanf$U.lo scanf/sscanffuns$U.lo \ - scanf/vfscanf$U.lo scanf/vscanf$U.lo scanf/vsscanf$U.lo - -# no $U for C++ files -CXX_OBJECTS = \ - cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo \ - cxx/osdoprnti.lo cxx/osfuns.lo \ - cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo - -MPBSD_OBJECTS = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \ - mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \ - mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo mpbsd/itom$U.lo \ - mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo mpbsd/rpow$U.lo \ - mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo mpbsd/xtom$U.lo - - -# In libtool 1.5 it doesn't work to build libgmp.la from the convenience -# libraries like mpz/libmpz.la. Or rather it works, but it ends up putting -# PIC objects into libgmp.a if shared and static are both built. (The PIC -# objects go into mpz/.libs/libmpz.a, and thence into .libs/libgmp.a.) -# -# For now the big lists of objects above are used. Something like mpz/*.lo -# would probably work, but might risk missing something out or getting -# something extra. The source files for each .lo are listed in the -# Makefile.am's in the subdirectories. -# -# Currently, for libgmp, unlike libmp below, we're not using -# -export-symbols, since the tune and speed programs, and perhaps some of -# the test programs, want to access undocumented symbols. - -libgmp_la_SOURCES = gmp-impl.h longlong.h randmt.h \ - assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \ - mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c \ - rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \ - randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c version.c -EXTRA_libgmp_la_SOURCES = tal-debug.c tal-notreent.c tal-reent.c -libgmp_la_DEPENDENCIES = @TAL_OBJECT@ \ - $(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \ - $(MPN_OBJECTS) @mpn_objs_in_libgmp@ \ - $(PRINTF_OBJECTS) $(SCANF_OBJECTS) -libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES) -libgmp_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMP_LDFLAGS) \ - -version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) - - -# We need at least one .cc file in $(libgmpxx_la_SOURCES) so automake will -# use $(CXXLINK) rather than the plain C $(LINK). cxx/dummy.cc is that -# file. - -if WANT_CXX -GMPXX_LTLIBRARIES_OPTION = libgmpxx.la -endif -libgmpxx_la_SOURCES = cxx/dummy.cc -libgmpxx_la_DEPENDENCIES = $(CXX_OBJECTS) libgmp.la -libgmpxx_la_LIBADD = $(libgmpxx_la_DEPENDENCIES) -libgmpxx_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMPXX_LDFLAGS) \ - -version-info $(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) - - -# The selected mpz objects here support mpz/powm.c (built as mpbsd/powm.lo) -# and can probably be removed when that switches to an mpn implementation. -# (Apart from mpz/n_pow_ui$U.lo, which supports mpbsd/rpow.c) - -if WANT_MPBSD -MPBSD_HEADERS_OPTION = mp.h -MPBSD_LTLIBRARIES_OPTION = libmp.la -endif -BUILT_SOURCES += mp.h -libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \ - mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c -libmp_la_DEPENDENCIES = $(srcdir)/libmp.sym \ - @TAL_OBJECT@ $(MPBSD_OBJECTS) $(MPN_OBJECTS) @mpn_objs_in_libmp@ \ - mpz/add$U.lo mpz/gcdext$U.lo mpz/invert$U.lo mpz/mul$U.lo \ - mpz/n_pow_ui$U.lo mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo \ - mpz/tdiv_q$U.lo -libmp_la_LIBADD = $(libmp_la_DEPENDENCIES) -libmp_la_LDFLAGS = $(GMP_LDFLAGS) \ - -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) \ - -export-symbols $(srcdir)/libmp.sym -EXTRA_DIST += libmp.sym - - -install-data-hook: - @echo '' - @echo '+-------------------------------------------------------------+' - @echo '| CAUTION: |' - @echo '| |' - @echo '| If you have not already run "make check", then we strongly |' - @echo '| recommend you do so. |' - @echo '| |' - @echo '| GMP has been carefully tested by its authors, but compilers |' - @echo '| are all too often released with serious bugs. GMP tends to |' - @echo '| explore interesting corners in compilers and has hit bugs |' - @echo '| on quite a few occasions. |' - @echo '| |' - @echo '+-------------------------------------------------------------+' - @echo '' - - -# The ansi2knr setups for the build programs are the same as the normal -# automake ansi2knr rules, but using $(CC_FOR_BUILD) instead of $(CC). -# -# The "test -f" support for srcdir!=builddir is similar to the automake .c.o -# etc rules, but with each foo.c explicitly, since $< is not portable -# outside an inference rule. -# -# A quoted 'foo.c' is used with the "test -f"'s to avoid Sun make rewriting -# it as part of its VPATH support. See the autoconf manual "Limitations of -# Make". -# -# Generated .h files which are used by gmp-impl.h are BUILT_SOURCES since -# they must exist before anything can be compiled. -# -# Other generated .h files are also BUILT_SOURCES so as to get all the -# build-system stuff over and done with at the start. Also, dependencies on -# the .h files are not properly expressed for the various objects that use -# them. - -EXTRA_DIST += dumbmp.c - -mpz/fac_ui.h: gen-fac_ui$(EXEEXT_FOR_BUILD) - ./gen-fac_ui $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1) -BUILT_SOURCES += mpz/fac_ui.h - -gen-fac_ui$(EXEEXT_FOR_BUILD): gen-fac_ui$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-fac_ui$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac_ui$(U_FOR_BUILD).c -o gen-fac_ui$(EXEEXT_FOR_BUILD) -DISTCLEANFILES += gen-fac_ui$(EXEEXT_FOR_BUILD) -EXTRA_DIST += gen-fac_ui.c - -gen-fac_ui_.c: gen-fac_ui.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fac_ui.c; then echo $(srcdir)/gen-fac_ui.c; else echo gen-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fac_ui_.c || rm -f gen-fac_ui_.c - - -fib_table.h: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1) -BUILT_SOURCES += fib_table.h - -mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1) -BUILT_SOURCES += mpn/fib_table.c - -gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-fib$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fib$(U_FOR_BUILD).c -o gen-fib$(EXEEXT_FOR_BUILD) -DISTCLEANFILES += gen-fib$(EXEEXT_FOR_BUILD) -EXTRA_DIST += gen-fib.c - -gen-fib_.c: gen-fib.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fib.c; then echo $(srcdir)/gen-fib.c; else echo gen-fib.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fib_.c || rm -f gen-fib_.c - - -mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1) -BUILT_SOURCES += mp_bases.h - -mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1) -BUILT_SOURCES += mpn/mp_bases.c - -gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-bases$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-bases$(U_FOR_BUILD).c -o gen-bases$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD) -DISTCLEANFILES += gen-bases$(EXEEXT_FOR_BUILD) -EXTRA_DIST += gen-bases.c - -gen-bases_.c: gen-bases.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-bases.c; then echo $(srcdir)/gen-bases.c; else echo gen-bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-bases_.c || rm -f gen-bases_.c - - -mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD) - ./gen-psqr $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1) -BUILT_SOURCES += mpn/perfsqr.h - -gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-psqr$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-psqr$(U_FOR_BUILD).c -o gen-psqr$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD) -DISTCLEANFILES += gen-psqr$(EXEEXT_FOR_BUILD) -EXTRA_DIST += gen-psqr.c - -gen-psqr_.c: gen-psqr.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-psqr.c; then echo $(srcdir)/gen-psqr.c; else echo gen-psqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-psqr_.c || rm -f gen-psqr_.c - - -# Avoid: CVS - cvs directories -# *~ - emacs backups -# .#* - cvs merge originals -# -# *~ and .#* only occur when a whole directory without it's own Makefile.am -# is distributed, like "doc" or the mpn cpu subdirectories. -# -dist-hook: - -find $(distdir) \( -name CVS -type d \) -o -name "*~" -o -name ".#*" \ - | xargs rm -rf - grep -F $(VERSION) $(srcdir)/Makefile.am \ - | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) *$(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE)" - test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`" diff --git a/contrib/gmp/Makefile.in b/contrib/gmp/Makefile.in deleted file mode 100644 index eaab1bb9c7..0000000000 --- a/contrib/gmp/Makefile.in +++ /dev/null @@ -1,1369 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, -# 2006, 2007, 2008, 2009 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = @ANSI2KNR@ -DIST_COMMON = README $(am__configure_deps) $(am__include_HEADERS_DIST) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/config.in $(srcdir)/gmp-h.in $(srcdir)/mp-h.in \ - $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \ - INSTALL NEWS ansi2knr.1 ansi2knr.c config.guess config.sub \ - install-sh ltmain.sh missing -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = gmp.h mp.h gmp-mparam.h -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includeexecdir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo \ - mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo \ - mpf/set_d$U.lo mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo \ - mpf/iset_si$U.lo mpf/iset_str$U.lo mpf/iset_d$U.lo \ - mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo \ - mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \ - mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \ - mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo \ - mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo mpf/cmp$U.lo \ - mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \ - mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \ - mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo \ - mpf/set_dfl_prec$U.lo mpf/set_prc$U.lo mpf/set_prc_raw$U.lo \ - mpf/get_dfl_prec$U.lo mpf/get_prc$U.lo mpf/ui_div$U.lo \ - mpf/sqrt_ui$U.lo mpf/ceilfloor$U.lo mpf/trunc$U.lo \ - mpf/pow_ui$U.lo mpf/urandomb$U.lo mpf/swap$U.lo \ - mpf/fits_sint$U.lo mpf/fits_slong$U.lo mpf/fits_sshort$U.lo \ - mpf/fits_uint$U.lo mpf/fits_ulong$U.lo mpf/fits_ushort$U.lo \ - mpf/get_si$U.lo mpf/get_ui$U.lo mpf/int_p$U.lo -am__DEPENDENCIES_2 = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \ - mpz/aorsmul$U.lo mpz/aorsmul_i$U.lo mpz/and$U.lo \ - mpz/array_init$U.lo mpz/bin_ui$U.lo mpz/bin_uiui$U.lo \ - mpz/cdiv_q$U.lo mpz/cdiv_q_ui$U.lo mpz/cdiv_qr$U.lo \ - mpz/cdiv_qr_ui$U.lo mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo \ - mpz/cdiv_ui$U.lo mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \ - mpz/clear$U.lo mpz/clrbit$U.lo mpz/cmp$U.lo mpz/cmp_d$U.lo \ - mpz/cmp_si$U.lo mpz/cmp_ui$U.lo mpz/cmpabs$U.lo \ - mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo mpz/com$U.lo \ - mpz/combit$U.lo mpz/cong$U.lo mpz/cong_2exp$U.lo \ - mpz/cong_ui$U.lo mpz/divexact$U.lo mpz/divegcd$U.lo \ - mpz/dive_ui$U.lo mpz/divis$U.lo mpz/divis_ui$U.lo \ - mpz/divis_2exp$U.lo mpz/dump$U.lo mpz/export$U.lo \ - mpz/fac_ui$U.lo mpz/fdiv_q$U.lo mpz/fdiv_q_ui$U.lo \ - mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo mpz/fdiv_r$U.lo \ - mpz/fdiv_r_ui$U.lo mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo \ - mpz/fib2_ui$U.lo mpz/fits_sint$U.lo mpz/fits_slong$U.lo \ - mpz/fits_sshort$U.lo mpz/fits_uint$U.lo mpz/fits_ulong$U.lo \ - mpz/fits_ushort$U.lo mpz/gcd$U.lo mpz/gcd_ui$U.lo \ - mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \ - mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo \ - mpz/getlimbn$U.lo mpz/hamdist$U.lo mpz/import$U.lo \ - mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo mpz/inp_str$U.lo \ - mpz/invert$U.lo mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo \ - mpz/iset_si$U.lo mpz/iset_str$U.lo mpz/iset_ui$U.lo \ - mpz/jacobi$U.lo mpz/kronsz$U.lo mpz/kronuz$U.lo \ - mpz/kronzs$U.lo mpz/kronzu$U.lo mpz/lcm$U.lo mpz/lcm_ui$U.lo \ - mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo mpz/millerrabin$U.lo \ - mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo mpz/mul_si$U.lo \ - mpz/mul_ui$U.lo mpz/n_pow_ui$U.lo mpz/neg$U.lo \ - mpz/nextprime$U.lo mpz/out_raw$U.lo mpz/out_str$U.lo \ - mpz/perfpow$U.lo mpz/perfsqr$U.lo mpz/popcount$U.lo \ - mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_ui$U.lo \ - mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo \ - mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo \ - mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo \ - mpz/scan0$U.lo mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo \ - mpz/set_f$U.lo mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo \ - mpz/set_ui$U.lo mpz/setbit$U.lo mpz/size$U.lo \ - mpz/sizeinbase$U.lo mpz/sqrt$U.lo mpz/sqrtrem$U.lo \ - mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo mpz/tdiv_ui$U.lo \ - mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo mpz/tdiv_q_ui$U.lo \ - mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo mpz/tdiv_r$U.lo \ - mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo mpz/tstbit$U.lo \ - mpz/ui_pow_ui$U.lo mpz/ui_sub$U.lo mpz/urandomb$U.lo \ - mpz/urandomm$U.lo mpz/xor$U.lo -am__DEPENDENCIES_3 = mpq/abs$U.lo mpq/aors$U.lo mpq/canonicalize$U.lo \ - mpq/clear$U.lo mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo \ - mpq/div$U.lo mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo \ - mpq/get_str$U.lo mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \ - mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \ - mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo mpq/set_si$U.lo \ - mpq/set_str$U.lo mpq/set_ui$U.lo mpq/equal$U.lo mpq/set_z$U.lo \ - mpq/set_d$U.lo mpq/set_f$U.lo mpq/swap$U.lo -am__DEPENDENCIES_4 = mpn/fib_table$U.lo mpn/mp_bases$U.lo -am__DEPENDENCIES_5 = printf/asprintf$U.lo printf/asprntffuns$U.lo \ - printf/doprnt$U.lo printf/doprntf$U.lo printf/doprnti$U.lo \ - printf/fprintf$U.lo printf/obprintf$U.lo printf/obvprintf$U.lo \ - printf/obprntffuns$U.lo printf/printf$U.lo \ - printf/printffuns$U.lo printf/snprintf$U.lo \ - printf/snprntffuns$U.lo printf/sprintf$U.lo \ - printf/sprintffuns$U.lo printf/vasprintf$U.lo \ - printf/vfprintf$U.lo printf/vprintf$U.lo printf/vsnprintf$U.lo \ - printf/vsprintf$U.lo printf/repl-vsnprintf$U.lo -am__DEPENDENCIES_6 = scanf/doscan$U.lo scanf/fscanf$U.lo \ - scanf/fscanffuns$U.lo scanf/scanf$U.lo scanf/sscanf$U.lo \ - scanf/sscanffuns$U.lo scanf/vfscanf$U.lo scanf/vscanf$U.lo \ - scanf/vsscanf$U.lo -am__DEPENDENCIES_7 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) \ - $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_6) -am_libgmp_la_OBJECTS = assert$U.lo compat$U.lo errno$U.lo \ - extract-dbl$U.lo invalid$U.lo memory$U.lo mp_bpl$U.lo \ - mp_clz_tab$U.lo mp_dv_tab$U.lo mp_minv_tab$U.lo \ - mp_get_fns$U.lo mp_set_fns$U.lo rand$U.lo randclr$U.lo \ - randdef$U.lo randiset$U.lo randlc2s$U.lo randlc2x$U.lo \ - randmt$U.lo randmts$U.lo rands$U.lo randsd$U.lo randsdui$U.lo \ - randbui$U.lo randmui$U.lo version$U.lo -libgmp_la_OBJECTS = $(am_libgmp_la_OBJECTS) -am__DEPENDENCIES_8 = cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo \ - cxx/ismpz.lo cxx/ismpznw.lo cxx/osdoprnti.lo cxx/osfuns.lo \ - cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo -am__DEPENDENCIES_9 = $(am__DEPENDENCIES_8) libgmp.la -am_libgmpxx_la_OBJECTS = dummy.lo -libgmpxx_la_OBJECTS = $(am_libgmpxx_la_OBJECTS) -am__DEPENDENCIES_10 = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \ - mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \ - mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo \ - mpbsd/itom$U.lo mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo \ - mpbsd/rpow$U.lo mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo \ - mpbsd/xtom$U.lo -am__DEPENDENCIES_11 = $(srcdir)/libmp.sym $(am__DEPENDENCIES_10) \ - $(am__DEPENDENCIES_4) mpz/add$U.lo mpz/gcdext$U.lo \ - mpz/invert$U.lo mpz/mul$U.lo mpz/n_pow_ui$U.lo \ - mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo mpz/tdiv_q$U.lo -am_libmp_la_OBJECTS = assert$U.lo errno$U.lo memory$U.lo mp_bpl$U.lo \ - mp_clz_tab$U.lo mp_dv_tab$U.lo mp_minv_tab$U.lo \ - mp_get_fns$U.lo mp_set_fns$U.lo -libmp_la_OBJECTS = $(am_libmp_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \ - $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES) -DIST_SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \ - $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -am__include_HEADERS_DIST = gmpxx.h -includeHEADERS_INSTALL = $(INSTALL_HEADER) -nodist_includeexecHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(include_HEADERS) $(nodist_includeexec_HEADERS) -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# The following options are the same as AM_INIT_AUTOMAKE in configure.in, -# except no $(top_builddir) on ansi2knr. That directory is wanted for the -# Makefiles in subdirectories, but here we must omit it so automake gives -# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr". -# -AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies ansi2knr - -# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the -# libtool manual. -# -# CURRENT:REVISION:AGE -# -# 1. No interfaces changed, only implementations (good): Increment REVISION. -# -# 2. Interfaces added, none removed (good): Increment CURRENT, increment -# AGE, set REVISION to 0. -# -# 3. Interfaces removed (BAD, breaks upward compatibility): Increment -# CURRENT, set AGE and REVISION to 0. -# -# Do this separately for libgmp, libgmpxx and libmp, and only for releases. -# -# GMP -version-info -# release libgmp libgmpxx libmp -# 2.0.x - - - -# 3.0 3:0:0 - 3:0:0 -# 3.0.1 3:1:0 - 3:0:0 -# 3.1 4:0:1 - 4:0:1 -# 3.1.1 4:1:1 - 4:1:1 -# 4.0 5:0:2 3:0:0 4:2:1 -# 4.0.1 5:1:2 3:1:0 4:3:1 -# 4.1 6:0:3 3:2:0 4:4:1 -# 4.1.1 6:1:3 3:3:0 4:5:1 -# 4.1.2 6:2:3 3:4:0 4:6:1 -# 4.1.3 6:3:3 3:5:0 4:7:1 -# 4.1.4 6:3:3 3:5:0 4:7:1 WRONG, same as 4.1.3! -# 4.2 6:0:3 3:2:0 4:4:1 REALLY WRONG, same as 4.1! -# 4.2.1 7:1:4 4:1:1 4:10:1 WRONG for libgmpxx -# 4.2.2 7:2:4 4:2:0 4:11:1 -# 4.2.3 7:3:4 4:3:0 4:12:1 -# 4.2.4 7:4:4 4:4:0 4:13:1 -# 4.3.0 8:0:5 5:0:1 4:14:1 -# 4.3.1 8:1:5 5:1:1 4:15:1 WRONG Really used same as 4.3.0 -# 4.3.2 8:2:5 5:2:1 4:16:1 -# -# Starting at 3:0:0 is a slight abuse of the versioning system, but it -# ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux -# packages of gmp 2. Pretend gmp 2 was 2:0:0, so the interface changes for -# gmp 3 mean 3:0:0 is right. -# -# We interpret "implementation changed" in item "1." above as meaning any -# release, ie. the REVISION is incremented every time (if nothing else). -# Even if we thought the code generated will be identical on all systems, -# it's still good to get the shared library filename (like -# libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from. -LIBGMP_LT_CURRENT = 8 -LIBGMP_LT_REVISION = 2 -LIBGMP_LT_AGE = 5 -LIBGMPXX_LT_CURRENT = 5 -LIBGMPXX_LT_REVISION = 2 -LIBGMPXX_LT_AGE = 1 -LIBMP_LT_CURRENT = 4 -LIBMP_LT_REVISION = 16 -LIBMP_LT_AGE = 1 -SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc - -# The ansi2knr setups for the build programs are the same as the normal -# automake ansi2knr rules, but using $(CC_FOR_BUILD) instead of $(CC). -# -# The "test -f" support for srcdir!=builddir is similar to the automake .c.o -# etc rules, but with each foo.c explicitly, since $< is not portable -# outside an inference rule. -# -# A quoted 'foo.c' is used with the "test -f"'s to avoid Sun make rewriting -# it as part of its VPATH support. See the autoconf manual "Limitations of -# Make". -# -# Generated .h files which are used by gmp-impl.h are BUILT_SOURCES since -# they must exist before anything can be compiled. -# -# Other generated .h files are also BUILT_SOURCES so as to get all the -# build-system stuff over and done with at the start. Also, dependencies on -# the .h files are not properly expressed for the various objects that use -# them. -EXTRA_DIST = macos configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf gmpxx.h libmp.sym dumbmp.c gen-fac_ui.c gen-fib.c gen-bases.c gen-psqr.c -@WANT_CXX_TRUE@GMPXX_HEADERS_OPTION = gmpxx.h - -# gmp.h and mp.h are architecture dependent, mainly since they encode the -# limb size used in libgmp. For that reason they belong under $exec_prefix -# not $prefix, strictly speaking. -# -# $exec_prefix/include is not in the default include path for gcc built to -# the same $prefix and $exec_prefix, which might mean gmp.h is not found, -# but anyone knowledgable enough to be playing with exec_prefix will be able -# to address that. -# -includeexecdir = $(exec_prefix)/include -include_HEADERS = $(GMPXX_HEADERS_OPTION) -nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION) -lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION) -BUILT_SOURCES = gmp.h mp.h mpz/fac_ui.h fib_table.h mpn/fib_table.c mp_bases.h mpn/mp_bases.c mpn/perfsqr.h -DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@ gen-fac_ui$(EXEEXT_FOR_BUILD) gen-fib$(EXEEXT_FOR_BUILD) gen-bases$(EXEEXT_FOR_BUILD) gen-psqr$(EXEEXT_FOR_BUILD) - -# Tell gmp.h it's building gmp, not an application, used by windows DLL stuff. -INCLUDES = -D__GMP_WITHIN_GMP -MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo mpf/set_ui$U.lo \ - mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo mpf/set_z$U.lo \ - mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo mpf/iset_str$U.lo \ - mpf/iset_d$U.lo mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo \ - mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \ - mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \ - mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo mpf/mul_ui$U.lo \ - mpf/div$U.lo mpf/div_ui$U.lo \ - mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \ - mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \ - mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \ - mpf/set_prc$U.lo mpf/set_prc_raw$U.lo mpf/get_dfl_prec$U.lo \ - mpf/get_prc$U.lo mpf/ui_div$U.lo mpf/sqrt_ui$U.lo \ - mpf/ceilfloor$U.lo mpf/trunc$U.lo mpf/pow_ui$U.lo \ - mpf/urandomb$U.lo mpf/swap$U.lo \ - mpf/fits_sint$U.lo mpf/fits_slong$U.lo mpf/fits_sshort$U.lo \ - mpf/fits_uint$U.lo mpf/fits_ulong$U.lo mpf/fits_ushort$U.lo \ - mpf/get_si$U.lo mpf/get_ui$U.lo \ - mpf/int_p$U.lo - -MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \ - mpz/aorsmul$U.lo mpz/aorsmul_i$U.lo mpz/and$U.lo mpz/array_init$U.lo \ - mpz/bin_ui$U.lo mpz/bin_uiui$U.lo \ - mpz/cdiv_q$U.lo mpz/cdiv_q_ui$U.lo \ - mpz/cdiv_qr$U.lo mpz/cdiv_qr_ui$U.lo \ - mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo mpz/cdiv_ui$U.lo \ - mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \ - mpz/clear$U.lo mpz/clrbit$U.lo \ - mpz/cmp$U.lo mpz/cmp_d$U.lo mpz/cmp_si$U.lo mpz/cmp_ui$U.lo \ - mpz/cmpabs$U.lo mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo \ - mpz/com$U.lo mpz/combit$U.lo \ - mpz/cong$U.lo mpz/cong_2exp$U.lo mpz/cong_ui$U.lo \ - mpz/divexact$U.lo mpz/divegcd$U.lo mpz/dive_ui$U.lo \ - mpz/divis$U.lo mpz/divis_ui$U.lo mpz/divis_2exp$U.lo mpz/dump$U.lo \ - mpz/export$U.lo mpz/fac_ui$U.lo mpz/fdiv_q$U.lo \ - mpz/fdiv_q_ui$U.lo mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo \ - mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo \ - mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo mpz/fib2_ui$U.lo mpz/fits_sint$U.lo \ - mpz/fits_slong$U.lo mpz/fits_sshort$U.lo mpz/fits_uint$U.lo \ - mpz/fits_ulong$U.lo mpz/fits_ushort$U.lo mpz/gcd$U.lo \ - mpz/gcd_ui$U.lo mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \ - mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo mpz/getlimbn$U.lo \ - mpz/hamdist$U.lo \ - mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo \ - mpz/inp_str$U.lo mpz/invert$U.lo \ - mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo \ - mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo \ - mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo \ - mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \ - mpz/millerrabin$U.lo mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo \ - mpz/mul_si$U.lo mpz/mul_ui$U.lo \ - mpz/n_pow_ui$U.lo mpz/neg$U.lo mpz/nextprime$U.lo \ - mpz/out_raw$U.lo mpz/out_str$U.lo mpz/perfpow$U.lo mpz/perfsqr$U.lo \ - mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_ui$U.lo \ - mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo \ - mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo \ - mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo \ - mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo \ - mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo \ - mpz/setbit$U.lo \ - mpz/size$U.lo mpz/sizeinbase$U.lo mpz/sqrt$U.lo \ - mpz/sqrtrem$U.lo mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo \ - mpz/tdiv_ui$U.lo mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo \ - mpz/tdiv_q_ui$U.lo mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo \ - mpz/tdiv_r$U.lo mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo \ - mpz/tstbit$U.lo mpz/ui_pow_ui$U.lo mpz/ui_sub$U.lo mpz/urandomb$U.lo \ - mpz/urandomm$U.lo mpz/xor$U.lo - -MPQ_OBJECTS = mpq/abs$U.lo mpq/aors$U.lo \ - mpq/canonicalize$U.lo mpq/clear$U.lo \ - mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo mpq/div$U.lo \ - mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo mpq/get_str$U.lo \ - mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \ - mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \ - mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo \ - mpq/set_si$U.lo mpq/set_str$U.lo mpq/set_ui$U.lo \ - mpq/equal$U.lo mpq/set_z$U.lo mpq/set_d$U.lo \ - mpq/set_f$U.lo mpq/swap$U.lo - -MPN_OBJECTS = mpn/fib_table$U.lo mpn/mp_bases$U.lo -PRINTF_OBJECTS = \ - printf/asprintf$U.lo printf/asprntffuns$U.lo \ - printf/doprnt$U.lo printf/doprntf$U.lo printf/doprnti$U.lo \ - printf/fprintf$U.lo \ - printf/obprintf$U.lo printf/obvprintf$U.lo printf/obprntffuns$U.lo \ - printf/printf$U.lo printf/printffuns$U.lo \ - printf/snprintf$U.lo printf/snprntffuns$U.lo \ - printf/sprintf$U.lo printf/sprintffuns$U.lo \ - printf/vasprintf$U.lo printf/vfprintf$U.lo printf/vprintf$U.lo \ - printf/vsnprintf$U.lo printf/vsprintf$U.lo \ - printf/repl-vsnprintf$U.lo - -SCANF_OBJECTS = \ - scanf/doscan$U.lo scanf/fscanf$U.lo scanf/fscanffuns$U.lo \ - scanf/scanf$U.lo scanf/sscanf$U.lo scanf/sscanffuns$U.lo \ - scanf/vfscanf$U.lo scanf/vscanf$U.lo scanf/vsscanf$U.lo - - -# no $U for C++ files -CXX_OBJECTS = \ - cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo \ - cxx/osdoprnti.lo cxx/osfuns.lo \ - cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo - -MPBSD_OBJECTS = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \ - mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \ - mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo mpbsd/itom$U.lo \ - mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo mpbsd/rpow$U.lo \ - mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo mpbsd/xtom$U.lo - - -# In libtool 1.5 it doesn't work to build libgmp.la from the convenience -# libraries like mpz/libmpz.la. Or rather it works, but it ends up putting -# PIC objects into libgmp.a if shared and static are both built. (The PIC -# objects go into mpz/.libs/libmpz.a, and thence into .libs/libgmp.a.) -# -# For now the big lists of objects above are used. Something like mpz/*.lo -# would probably work, but might risk missing something out or getting -# something extra. The source files for each .lo are listed in the -# Makefile.am's in the subdirectories. -# -# Currently, for libgmp, unlike libmp below, we're not using -# -export-symbols, since the tune and speed programs, and perhaps some of -# the test programs, want to access undocumented symbols. -libgmp_la_SOURCES = gmp-impl.h longlong.h randmt.h \ - assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \ - mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c \ - rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \ - randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c version.c - -EXTRA_libgmp_la_SOURCES = tal-debug.c tal-notreent.c tal-reent.c -libgmp_la_DEPENDENCIES = @TAL_OBJECT@ \ - $(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \ - $(MPN_OBJECTS) @mpn_objs_in_libgmp@ \ - $(PRINTF_OBJECTS) $(SCANF_OBJECTS) - -libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES) -libgmp_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMP_LDFLAGS) \ - -version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) - - -# We need at least one .cc file in $(libgmpxx_la_SOURCES) so automake will -# use $(CXXLINK) rather than the plain C $(LINK). cxx/dummy.cc is that -# file. -@WANT_CXX_TRUE@GMPXX_LTLIBRARIES_OPTION = libgmpxx.la -libgmpxx_la_SOURCES = cxx/dummy.cc -libgmpxx_la_DEPENDENCIES = $(CXX_OBJECTS) libgmp.la -libgmpxx_la_LIBADD = $(libgmpxx_la_DEPENDENCIES) -libgmpxx_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMPXX_LDFLAGS) \ - -version-info $(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) - - -# The selected mpz objects here support mpz/powm.c (built as mpbsd/powm.lo) -# and can probably be removed when that switches to an mpn implementation. -# (Apart from mpz/n_pow_ui$U.lo, which supports mpbsd/rpow.c) -@WANT_MPBSD_TRUE@MPBSD_HEADERS_OPTION = mp.h -@WANT_MPBSD_TRUE@MPBSD_LTLIBRARIES_OPTION = libmp.la -libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \ - mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c - -libmp_la_DEPENDENCIES = $(srcdir)/libmp.sym \ - @TAL_OBJECT@ $(MPBSD_OBJECTS) $(MPN_OBJECTS) @mpn_objs_in_libmp@ \ - mpz/add$U.lo mpz/gcdext$U.lo mpz/invert$U.lo mpz/mul$U.lo \ - mpz/n_pow_ui$U.lo mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo \ - mpz/tdiv_q$U.lo - -libmp_la_LIBADD = $(libmp_la_DEPENDENCIES) -libmp_la_LDFLAGS = $(GMP_LDFLAGS) \ - -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) \ - -export-symbols $(srcdir)/libmp.sym - -all: $(BUILT_SOURCES) config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .cc .lo .o .obj -am--refresh: - @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps'; \ - cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -gmp.h: $(top_builddir)/config.status $(srcdir)/gmp-h.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -mp.h: $(top_builddir)/config.status $(srcdir)/mp-h.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libgmp.la: $(libgmp_la_OBJECTS) $(libgmp_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libgmp_la_LDFLAGS) $(libgmp_la_OBJECTS) $(libgmp_la_LIBADD) $(LIBS) -libgmpxx.la: $(libgmpxx_la_OBJECTS) $(libgmpxx_la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libgmpxx_la_LDFLAGS) $(libgmpxx_la_OBJECTS) $(libgmpxx_la_LIBADD) $(LIBS) -libmp.la: $(libmp_la_OBJECTS) $(libmp_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libmp_la_LDFLAGS) $(libmp_la_OBJECTS) $(libmp_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -ansi2knr: ansi2knr.$(OBJEXT) - $(LINK) ansi2knr.$(OBJEXT) $(LIBS) -ansi2knr.$(OBJEXT): $(CONFIG_HEADER) - -clean-krextra: - -rm -f ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -assert_.c: assert.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/assert.c; then echo $(srcdir)/assert.c; else echo assert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -compat_.c: compat.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/compat.c; then echo $(srcdir)/compat.c; else echo compat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -errno_.c: errno.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/errno.c; then echo $(srcdir)/errno.c; else echo errno.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -extract-dbl_.c: extract-dbl.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/extract-dbl.c; then echo $(srcdir)/extract-dbl.c; else echo extract-dbl.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -invalid_.c: invalid.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invalid.c; then echo $(srcdir)/invalid.c; else echo invalid.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -memory_.c: memory.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memory.c; then echo $(srcdir)/memory.c; else echo memory.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_bpl_.c: mp_bpl.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_bpl.c; then echo $(srcdir)/mp_bpl.c; else echo mp_bpl.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_clz_tab_.c: mp_clz_tab.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_clz_tab.c; then echo $(srcdir)/mp_clz_tab.c; else echo mp_clz_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_dv_tab_.c: mp_dv_tab.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_dv_tab.c; then echo $(srcdir)/mp_dv_tab.c; else echo mp_dv_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_get_fns_.c: mp_get_fns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_get_fns.c; then echo $(srcdir)/mp_get_fns.c; else echo mp_get_fns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_minv_tab_.c: mp_minv_tab.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_minv_tab.c; then echo $(srcdir)/mp_minv_tab.c; else echo mp_minv_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_set_fns_.c: mp_set_fns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_set_fns.c; then echo $(srcdir)/mp_set_fns.c; else echo mp_set_fns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rand_.c: rand.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rand.c; then echo $(srcdir)/rand.c; else echo rand.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randbui_.c: randbui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randbui.c; then echo $(srcdir)/randbui.c; else echo randbui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randclr_.c: randclr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randclr.c; then echo $(srcdir)/randclr.c; else echo randclr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randdef_.c: randdef.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randdef.c; then echo $(srcdir)/randdef.c; else echo randdef.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randiset_.c: randiset.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randiset.c; then echo $(srcdir)/randiset.c; else echo randiset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randlc2s_.c: randlc2s.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randlc2s.c; then echo $(srcdir)/randlc2s.c; else echo randlc2s.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randlc2x_.c: randlc2x.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randlc2x.c; then echo $(srcdir)/randlc2x.c; else echo randlc2x.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randmt_.c: randmt.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmt.c; then echo $(srcdir)/randmt.c; else echo randmt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randmts_.c: randmts.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmts.c; then echo $(srcdir)/randmts.c; else echo randmts.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randmui_.c: randmui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmui.c; then echo $(srcdir)/randmui.c; else echo randmui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rands_.c: rands.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rands.c; then echo $(srcdir)/rands.c; else echo rands.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randsd_.c: randsd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randsd.c; then echo $(srcdir)/randsd.c; else echo randsd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -randsdui_.c: randsdui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randsdui.c; then echo $(srcdir)/randsdui.c; else echo randsdui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tal-debug_.c: tal-debug.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-debug.c; then echo $(srcdir)/tal-debug.c; else echo tal-debug.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tal-notreent_.c: tal-notreent.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-notreent.c; then echo $(srcdir)/tal-notreent.c; else echo tal-notreent.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tal-reent_.c: tal-reent.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-reent.c; then echo $(srcdir)/tal-reent.c; else echo tal-reent.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -version_.c: version.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -assert_.$(OBJEXT) assert_.lo compat_.$(OBJEXT) compat_.lo \ -errno_.$(OBJEXT) errno_.lo extract-dbl_.$(OBJEXT) extract-dbl_.lo \ -invalid_.$(OBJEXT) invalid_.lo memory_.$(OBJEXT) memory_.lo \ -mp_bpl_.$(OBJEXT) mp_bpl_.lo mp_clz_tab_.$(OBJEXT) mp_clz_tab_.lo \ -mp_dv_tab_.$(OBJEXT) mp_dv_tab_.lo mp_get_fns_.$(OBJEXT) \ -mp_get_fns_.lo mp_minv_tab_.$(OBJEXT) mp_minv_tab_.lo \ -mp_set_fns_.$(OBJEXT) mp_set_fns_.lo rand_.$(OBJEXT) rand_.lo \ -randbui_.$(OBJEXT) randbui_.lo randclr_.$(OBJEXT) randclr_.lo \ -randdef_.$(OBJEXT) randdef_.lo randiset_.$(OBJEXT) randiset_.lo \ -randlc2s_.$(OBJEXT) randlc2s_.lo randlc2x_.$(OBJEXT) randlc2x_.lo \ -randmt_.$(OBJEXT) randmt_.lo randmts_.$(OBJEXT) randmts_.lo \ -randmui_.$(OBJEXT) randmui_.lo rands_.$(OBJEXT) rands_.lo \ -randsd_.$(OBJEXT) randsd_.lo randsdui_.$(OBJEXT) randsdui_.lo \ -tal-debug_.$(OBJEXT) tal-debug_.lo tal-notreent_.$(OBJEXT) \ -tal-notreent_.lo tal-reent_.$(OBJEXT) tal-reent_.lo version_.$(OBJEXT) \ -version_.lo : $(ANSI2KNR) - -.cc.o: - $(CXXCOMPILE) -c -o $@ $< - -.cc.obj: - $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: - $(LTCXXCOMPILE) -c -o $@ $< - -dummy.o: cxx/dummy.cc - $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.o `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc - -dummy.obj: cxx/dummy.cc - $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.obj `if test -f 'cxx/dummy.cc'; then $(CYGPATH_W) 'cxx/dummy.cc'; else $(CYGPATH_W) '$(srcdir)/cxx/dummy.cc'; fi` - -dummy.lo: cxx/dummy.cc - $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.lo `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ - $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(includedir)/$$f"; \ - done -install-nodist_includeexecHEADERS: $(nodist_includeexec_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(includeexecdir)" || $(mkdir_p) "$(DESTDIR)$(includeexecdir)" - @list='$(nodist_includeexec_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(nodist_includeexecHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includeexecdir)/$$f'"; \ - $(nodist_includeexecHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includeexecdir)/$$f"; \ - done - -uninstall-nodist_includeexecHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(nodist_includeexec_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f '$(DESTDIR)$(includeexecdir)/$$f'"; \ - rm -f "$(DESTDIR)$(includeexecdir)/$$f"; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/. $(distdir)/demos $(distdir)/demos/calc - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(ANSI2KNR) $(LTLIBRARIES) $(HEADERS) config.h -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includeexecdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-generic clean-krextra clean-libLTLIBRARIES \ - clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-includeHEADERS - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-data-hook - -install-exec-am: install-libLTLIBRARIES \ - install-nodist_includeexecHEADERS - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-nodist_includeexecHEADERS - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-krextra \ - clean-libLTLIBRARIES clean-libtool clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-includeHEADERS install-info \ - install-info-am install-libLTLIBRARIES install-man \ - install-nodist_includeexecHEADERS install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-kr mostlyclean-libtool mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-nodist_includeexecHEADERS - - -install-data-hook: - @echo '' - @echo '+-------------------------------------------------------------+' - @echo '| CAUTION: |' - @echo '| |' - @echo '| If you have not already run "make check", then we strongly |' - @echo '| recommend you do so. |' - @echo '| |' - @echo '| GMP has been carefully tested by its authors, but compilers |' - @echo '| are all too often released with serious bugs. GMP tends to |' - @echo '| explore interesting corners in compilers and has hit bugs |' - @echo '| on quite a few occasions. |' - @echo '| |' - @echo '+-------------------------------------------------------------+' - @echo '' - -mpz/fac_ui.h: gen-fac_ui$(EXEEXT_FOR_BUILD) - ./gen-fac_ui $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1) - -gen-fac_ui$(EXEEXT_FOR_BUILD): gen-fac_ui$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-fac_ui$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac_ui$(U_FOR_BUILD).c -o gen-fac_ui$(EXEEXT_FOR_BUILD) - -gen-fac_ui_.c: gen-fac_ui.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fac_ui.c; then echo $(srcdir)/gen-fac_ui.c; else echo gen-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fac_ui_.c || rm -f gen-fac_ui_.c - -fib_table.h: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1) - -mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1) - -gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-fib$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fib$(U_FOR_BUILD).c -o gen-fib$(EXEEXT_FOR_BUILD) - -gen-fib_.c: gen-fib.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fib.c; then echo $(srcdir)/gen-fib.c; else echo gen-fib.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fib_.c || rm -f gen-fib_.c - -mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1) - -mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1) - -gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-bases$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-bases$(U_FOR_BUILD).c -o gen-bases$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD) - -gen-bases_.c: gen-bases.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-bases.c; then echo $(srcdir)/gen-bases.c; else echo gen-bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-bases_.c || rm -f gen-bases_.c - -mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD) - ./gen-psqr $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1) - -gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c dumbmp.c - $(CC_FOR_BUILD) `test -f 'gen-psqr$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-psqr$(U_FOR_BUILD).c -o gen-psqr$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD) - -gen-psqr_.c: gen-psqr.c $(ANSI2KNR) - $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-psqr.c; then echo $(srcdir)/gen-psqr.c; else echo gen-psqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-psqr_.c || rm -f gen-psqr_.c - -# Avoid: CVS - cvs directories -# *~ - emacs backups -# .#* - cvs merge originals -# -# *~ and .#* only occur when a whole directory without it's own Makefile.am -# is distributed, like "doc" or the mpn cpu subdirectories. -# -dist-hook: - -find $(distdir) \( -name CVS -type d \) -o -name "*~" -o -name ".#*" \ - | xargs rm -rf - grep -F $(VERSION) $(srcdir)/Makefile.am \ - | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) *$(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE)" - test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/config.guess b/contrib/gmp/config.guess deleted file mode 100755 index c64ba970ec..0000000000 --- a/contrib/gmp/config.guess +++ /dev/null @@ -1,841 +0,0 @@ -#! /bin/sh -# -# GMP config.guess wrapper. - - -# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software -# Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -# Usage: config.guess -# -# Print the host system CPU-VENDOR-OS. -# -# configfsf.guess is run and its guess then sharpened up to take advantage -# of the finer grained CPU types that GMP knows. - - -# Expect to find configfsf.guess in the same directory as this config.guess -configfsf_guess="`echo \"$0\" | sed 's/config.guess$/configfsf.guess/'`" -if test "$configfsf_guess" = "$0"; then - echo "Cannot derive configfsf.guess from $0" 1>&2 - exit 1 -fi -if test -f "$configfsf_guess"; then - : -else - echo "$configfsf_guess not found" 1>&2 - exit 1 -fi - -# Setup a $SHELL with which to run configfsf.guess, using the same -# $CONFIG_SHELL or /bin/sh as autoconf does when running config.guess -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identify ourselves on --version, --help or errors -if test $# != 0; then - echo "(GNU MP wrapped config.guess)" - $SHELL $configfsf_guess "$@" - exit 1 -fi - -guess_full=`$SHELL $configfsf_guess` -if test $? != 0; then - exit 1 -fi - -guess_cpu=`echo "$guess_full" | sed 's/-.*$//'` -guess_rest=`echo "$guess_full" | sed 's/^[^-]*//'` -exact_cpu= - - -# ------------------------------------------------------------------------- -# The following should look at the current guess and probe the system to -# establish a better guess in exact_cpu. Leave exact_cpu empty if probes -# can't be done, or don't work. -# -# When a number of probes are done, test -z "$exact_cpu" can be used instead -# of putting each probe under an "else" of the preceeding. That can stop -# the code getting horribly nested and marching off the right side of the -# screen. - -# Note that when a compile-and-link is done in one step we need to remove .o -# files, since lame C compilers generate these even when not asked. -# - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.core $dummy ${dummy}1.s ${dummy}2.c ; exit 1' 1 2 15 - -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - echo 'dummy(){}' >$dummy.c - for c in cc gcc c89 c99; do - ($c $dummy.c -c) >/dev/null 2>&1 - if test $? = 0; then - CC_FOR_BUILD="$c"; break - fi - done - rm -f $dummy.c $dummy.o - if test x"$CC_FOR_BUILD" = x; then - CC_FOR_BUILD=no_compiler_found - fi - fi - fi -fi - - -case "$guess_full" in - -alpha-*-*) - # configfsf.guess detects exact alpha cpu types for OSF and GNU/Linux, but - # not for *BSD and other systems. We try to get an exact type for any - # plain "alpha" it leaves. - # - # configfsf.guess used to have a block of code not unlike this, but these - # days does its thing with Linux kernel /proc/cpuinfo or OSF psrinfo. - # - cat <$dummy.s - .data -Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d91 # implver \$17 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,Lformat - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) exact_cpu=alpha ;; - 1-0) exact_cpu=alphaev5 ;; - 1-1) exact_cpu=alphaev56 ;; - 1-101) exact_cpu=alphapca56 ;; - 2-303) exact_cpu=alphaev6 ;; - 2-307) exact_cpu=alphaev67 ;; - 2-1307) exact_cpu=alphaev68 ;; - esac - fi - rm -f $dummy.s $dummy.o $dummy - ;; - -ia64*-*-*) - # CPUID[3] bits 24 to 31 is the processor family. itanium2 is documented - # as 0x1f, plain itanium has been seen returning 0x07 on two systems, but - # haven't found any documentation on it as such. - # - # Defining both getcpuid and _getcpuid lets us ignore whether the system - # expects underscores or not. - # - # "unsigned long long" is always 64 bits, in fact on hpux in ilp32 mode - # (which is the default there), it's the only 64-bit type. - # - cat >${dummy}a.s <${dummy}b.c < -unsigned long long getcpuid (); -int -main () -{ - if (getcpuid(0LL) == 0x49656E69756E6547LL && getcpuid(1LL) == 0x6C65746ELL) - { - /* "GenuineIntel" */ - switch ((getcpuid(3LL) >> 24) & 0xFF) { - case 0x07: puts ("itanium"); break; - case 0x1F: puts ("itanium2"); break; /* McKinley, Madison */ - case 0x20: puts ("itanium2"); break; /* Montecito */ - } - } - return 0; -} -EOF - if $CC_FOR_BUILD ${dummy}a.s ${dummy}b.c -o $dummy >/dev/null 2>&1; then - exact_cpu=`./$dummy` - fi - rm -f ${dummy}a.s ${dummy}a.o ${dummy}b.c ${dummy}b.o $dummy $dummy.core core - ;; - -mips-*-irix[6789]*) - # IRIX 6 and up always has a 64-bit mips cpu - exact_cpu=mips64 - ;; - -m68k-*-*) - # NetBSD (and presumably other *BSD) "sysctl hw.model" gives for example - # hw.model = Apple Macintosh Quadra 610 (68040) - exact_cpu=`(sysctl hw.model) 2>/dev/null | sed -n 's/^.*\(680[012346]0\).*$/m\1/p'` - if test -z "$exact_cpu"; then - # Linux kernel 2.2 gives for example "CPU: 68020" (tabs in between). - exact_cpu=`sed -n 's/^CPU:.*\(680[012346]0\).*$/m\1/p' /proc/cpuinfo 2>/dev/null` - fi - if test -z "$exact_cpu"; then - # Try: movel #0,%d0; rts - # This is to check the compiler and our asm code works etc, before - # assuming failures below indicate cpu characteristics. - # .byte is used to avoid problems with assembler syntax variations. - # For testing, provoke failures by adding "illegal" possibly as - # ".byte 0x4A, 0xFC" - cat >$dummy.s </dev/null 2>&1; then - - # $SHELL -c is used to execute ./$dummy below, since (./$dummy) - # 2>/dev/null still prints the SIGILL message on some shells. - # - # Try: movel #0,%d0 - # rtd #0 - cat >$dummy.s </dev/null 2>&1; then - $SHELL -c ./$dummy >/dev/null 2>&1 - if test $? != 0; then - exact_cpu=m68000 # because rtd didn't work - fi - fi - # - - if test -z "$exact_cpu"; then - # Try: trapf - # movel #0,%d0 - # rts - # Another possibility for identifying 68000 and 68010 is the - # different value stored by "movem a0,(a0)+" - cat >$dummy.s </dev/null 2>&1; then - $SHELL -c ./$dummy >/dev/null 2>&1 - if test $? != 0; then - exact_cpu=m68010 # because trapf didn't work - fi - fi - fi - - if test -z "$exact_cpu"; then - # Try: bfffo %d1{0:31},%d0 - # movel #0,%d0 - # rts - cat >$dummy.s </dev/null 2>&1; then - $SHELL -c ./$dummy >/dev/null 2>&1 - if test $? != 0; then - exact_cpu=m68360 # cpu32, because bfffo didn't work - fi - fi - fi - - if test -z "$exact_cpu"; then - # FIXME: Now we know 68020 or up, but how to detect 030, 040 and 060? - exact_cpu=m68020 - fi - fi - rm -f $dummy.s $dummy.o $dummy $dummy.core core - fi - if test -z "$exact_cpu"; then - case "$guess_full" in - *-*-next* | *-*-openstep*) # NeXTs are 68020 or better - exact_cpu=m68020 ;; - esac - fi - ;; - - -rs6000-*-* | powerpc*-*-*) - # Enhancement: On MacOS the "machine" command prints for instance - # "ppc750". Interestingly on powerpc970-apple-darwin6.8.5 it prints - # "ppc970" where there's no actual #define for 970 from NXGetLocalArchInfo - # (as noted below). But the man page says the command is still "under - # development", so it doesn't seem wise to use it just yet, not while - # there's an alternative. - # - # Try to read the PVR. mfpvr is a protected instruction, NetBSD, MacOS - # and AIX don't allow it in user mode, but the Linux kernel does. - # - # Using explicit bytes for mfpvr avoids worrying about assembler syntax - # and underscores. "char"s are used instead of "int"s to avoid worrying - # whether sizeof(int)==4 or if it's the right endianness. - # - # Note this is no good on AIX, since a C function there is the address of - # a function descriptor, not actual code. But this doesn't matter since - # AIX doesn't allow mfpvr anyway. - # - cat >$dummy.c <<\EOF -#include -struct { - int n; /* force 4-byte alignment */ - char a[8]; -} getpvr = { - 0, - { - 0x7c, 0x7f, 0x42, 0xa6, /* mfpvr r3 */ - 0x4e, 0x80, 0x00, 0x20, /* blr */ - } -}; -int -main () -{ - unsigned (*fun)(); - unsigned pvr; - - /* a separate "fun" variable is necessary for gcc 2.95.2 on MacOS, - it gets a compiler error on a combined cast and call */ - fun = (unsigned (*)()) getpvr.a; - pvr = (*fun) (); - - switch (pvr >> 16) { - case 0x0001: puts ("powerpc601"); break; - case 0x0003: puts ("powerpc603"); break; - case 0x0004: puts ("powerpc604"); break; - case 0x0006: puts ("powerpc603e"); break; - case 0x0007: puts ("powerpc603e"); break; /* 603ev */ - case 0x0008: puts ("powerpc750"); break; - case 0x0009: puts ("powerpc604e"); break; - case 0x000a: puts ("powerpc604e"); break; /* 604ev5 */ - case 0x000c: puts ("powerpc7400"); break; - case 0x0041: puts ("powerpc630"); break; - case 0x0050: puts ("powerpc860"); break; - case 0x8000: puts ("powerpc7450"); break; - case 0x8001: puts ("powerpc7455"); break; - case 0x8002: puts ("powerpc7457"); break; - case 0x8003: puts ("powerpc7447"); break; /* really 7447A */ - case 0x800c: puts ("powerpc7410"); break; - } - return 0; -} -EOF - if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then - # This style construct is needed on AIX 4.3 to suppress the SIGILL error - # from (*fun)(). Using $SHELL -c ./$dummy 2>/dev/null doesn't work. - { x=`./$dummy`; } 2>/dev/null - if test -n "$x"; then - exact_cpu=$x - fi - fi - rm -f $dummy.c $dummy.o $dummy $dummy.core - - # Grep the linux kernel /proc/cpuinfo pseudo-file. - # Anything unrecognised is ignored, since of course we mustn't spit out - # a cpu type config.sub doesn't know. - if test -z "$exact_cpu" && test -f /proc/cpuinfo; then - x=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1` - x=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'` - x=`echo $x | sed 's/PPC//'` - case $x in - 601) exact_cpu="power" ;; - 603ev) exact_cpu="powerpc603e" ;; - 604ev5) exact_cpu="powerpc604e" ;; - 603 | 603e | 604 | 604e | 750 | 821 | 860 | 970) - exact_cpu="powerpc$x" ;; - POWER[4-9]) - exact_cpu=`echo $x | sed "s;POWER;power;"` ;; - esac - fi - - if test -z "$exact_cpu"; then - # On AIX, try looking at _system_configuration. This is present in - # version 4 at least. - cat >$dummy.c < -#include -int -main () -{ - switch (_system_configuration.implementation) { - /* Old versions of AIX don't have all these constants, - use ifdef for safety. */ -#ifdef POWER_RS2 - case POWER_RS2: puts ("power2"); break; -#endif -#ifdef POWER_601 - case POWER_601: puts ("power"); break; -#endif -#ifdef POWER_603 - case POWER_603: puts ("powerpc603"); break; -#endif -#ifdef POWER_604 - case POWER_604: puts ("powerpc604"); break; -#endif -#ifdef POWER_620 - case POWER_620: puts ("powerpc620"); break; -#endif -#ifdef POWER_630 - case POWER_630: puts ("powerpc630"); break; -#endif - /* Dunno what this is, leave it out for now. - case POWER_A35: puts ("powerpca35"); break; - */ - /* This is waiting for a bit more info. - case POWER_RS64II: puts ("powerpcrs64ii"); break; - */ -#ifdef POWER_4 - case POWER_4: puts ("power4"); break; -#endif -#ifdef POWER_5 - case POWER_5: puts ("power5"); break; -#endif -#ifdef POWER_6 - case POWER_6: puts ("power6"); break; -#endif - default: - if (_system_configuration.architecture == POWER_RS) - puts ("power"); - else if (_system_configuration.width == 64) - puts ("powerpc64"); - } - return 0; -} -EOF - if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then - x=`./$dummy` - if test -n "$x"; then - exact_cpu=$x - fi - fi - rm -f $dummy.c $dummy.o $dummy - fi - - if test -z "$exact_cpu"; then - # On MacOS X (or any Mach-O presumably), NXGetLocalArchInfo cpusubtype - # can tell us the exact cpu. - cat >$dummy.c < -#include -int -main (void) -{ - const NXArchInfo *a = NXGetLocalArchInfo(); - if (a->cputype == CPU_TYPE_POWERPC) - { - switch (a->cpusubtype) { - /* The following known to Darwin 1.3. */ - case CPU_SUBTYPE_POWERPC_601: puts ("powerpc601"); break; - case CPU_SUBTYPE_POWERPC_602: puts ("powerpc602"); break; - case CPU_SUBTYPE_POWERPC_603: puts ("powerpc603"); break; - case CPU_SUBTYPE_POWERPC_603e: puts ("powerpc603e"); break; - case CPU_SUBTYPE_POWERPC_603ev: puts ("powerpc603e"); break; - case CPU_SUBTYPE_POWERPC_604: puts ("powerpc604"); break; - case CPU_SUBTYPE_POWERPC_604e: puts ("powerpc604e"); break; - case CPU_SUBTYPE_POWERPC_620: puts ("powerpc620"); break; - case CPU_SUBTYPE_POWERPC_750: puts ("powerpc750"); break; - case CPU_SUBTYPE_POWERPC_7400: puts ("powerpc7400"); break; - case CPU_SUBTYPE_POWERPC_7450: puts ("powerpc7450"); break; - /* Darwin 6.8.5 doesn't define the following */ - case 0x8001: puts ("powerpc7455"); break; - case 0x8002: puts ("powerpc7457"); break; - case 0x8003: puts ("powerpc7447"); break; - case 100: puts ("powerpc970"); break; - } - } - return 0; -} -EOF - if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then - x=`./$dummy` - if test -n "$x"; then - exact_cpu=$x - fi - fi - rm -f $dummy.c $dummy.o $dummy - fi - ;; - -sparc-*-* | sparc64-*-*) - # If we can recognise an actual v7 then $exact_cpu is set to "sparc" so as - # to short-circuit subsequent tests. - - # Grep the linux kernel /proc/cpuinfo pseudo-file. - # A typical line is "cpu\t\t: TI UltraSparc II (BlackBird)" - # See arch/sparc/kernel/cpu.c and arch/sparc64/kernel/cpu.c. - # - if test -f /proc/cpuinfo; then - if grep 'cpu.*Cypress' /proc/cpuinfo >/dev/null; then - exact_cpu="sparc" # ie. v7 - elif grep 'cpu.*Power-UP' /proc/cpuinfo >/dev/null; then - exact_cpu="sparc" # ie. v7 - elif grep 'cpu.*HyperSparc' /proc/cpuinfo >/dev/null; then - exact_cpu="sparcv8" - elif grep 'cpu.*SuperSparc' /proc/cpuinfo >/dev/null; then - exact_cpu="supersparc" - elif grep 'cpu.*MicroSparc' /proc/cpuinfo >/dev/null; then - exact_cpu="microsparc" - elif grep 'cpu.*MB86904' /proc/cpuinfo >/dev/null; then - # actually MicroSPARC-II - exact_cpu=microsparc - elif grep 'cpu.*UltraSparc T1' /proc/cpuinfo >/dev/null; then - # this grep pattern has not been tested against any Linux - exact_cpu="ultrasparct1" - elif grep 'cpu.*UltraSparc III' /proc/cpuinfo >/dev/null; then - exact_cpu="ultrasparc3" - elif grep 'cpu.*UltraSparc IIi' /proc/cpuinfo >/dev/null; then - exact_cpu="ultrasparc2i" - elif grep 'cpu.*UltraSparc II' /proc/cpuinfo >/dev/null; then - exact_cpu="ultrasparc2" - elif grep 'cpu.*UltraSparc' /proc/cpuinfo >/dev/null; then - exact_cpu="ultrasparc" - fi - fi - - # Grep the output from sysinfo on SunOS. - # sysinfo has been seen living in /bin or in /usr/kvm - # cpu0 is a "SuperSPARC Model 41 SPARCmodule" CPU - # cpu0 is a "75 MHz TI,TMS390Z55" CPU - # - if test -z "$exact_cpu"; then - for i in sysinfo /usr/kvm/sysinfo; do - if $SHELL -c $i 2>/dev/null >conftest.dat; then - if grep 'cpu0 is a "SuperSPARC' conftest.dat >/dev/null; then - exact_cpu=supersparc - break - elif grep 'cpu0 is a .*TMS390Z5.' conftest.dat >/dev/null; then - # TMS390Z50 and TMS390Z55 - exact_cpu=supersparc - break - fi - fi - done - rm -f conftest.dat - fi - - # Grep the output from prtconf on Solaris. - # Use an explicit /usr/sbin, since that directory might not be in a normal - # user's path. - # - # SUNW,UltraSPARC (driver not attached) - # SUNW,UltraSPARC-II (driver not attached) - # SUNW,UltraSPARC-IIi (driver not attached) - # SUNW,UltraSPARC-III+ (driver not attached) - # Ross,RT625 (driver not attached) - # TI,TMS390Z50 (driver not attached) - # - # /usr/sbin/sysdef prints similar information, but includes all loadable - # cpu modules, not just the real cpu. - # - # We first try a plain prtconf, since that is known to work on older systems. - # But for newer T1 systems, that doesn't produce any useful output, we need - # "prtconf -vp" there. - # - for prtconfopt in "" "-vp"; do - if test -z "$exact_cpu"; then - if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev/null >conftest.dat; then - if grep 'SUNW,UltraSPARC-T1' conftest.dat >/dev/null; then - exact_cpu=ultrasparct1 - elif grep 'SUNW,UltraSPARC-III' conftest.dat >/dev/null; then - exact_cpu=ultrasparc3 - elif grep 'SUNW,UltraSPARC-IIi' conftest.dat >/dev/null; then - exact_cpu=ultrasparc2i - elif grep 'SUNW,UltraSPARC-II' conftest.dat >/dev/null; then - exact_cpu=ultrasparc2 - elif grep 'SUNW,UltraSPARC' conftest.dat >/dev/null; then - exact_cpu=ultrasparc - elif grep 'Ross,RT62.' conftest.dat >/dev/null; then - # RT620, RT625, RT626 hypersparcs (v8). - exact_cpu=sparcv8 - elif grep 'TI,TMS390Z5.' conftest.dat >/dev/null; then - # TMS390Z50 and TMS390Z55 - exact_cpu=supersparc - elif grep 'TI,TMS390S10' conftest.dat >/dev/null; then - exact_cpu=microsparc - elif grep 'FMI,MB86904' conftest.dat >/dev/null; then - # actually MicroSPARC-II - exact_cpu=microsparc - fi - fi - rm -f conftest.dat - fi - done - - # Grep the output from sysctl hw.model on sparc or sparc64 *BSD. - # Use an explicit /sbin, since that directory might not be in a normal - # user's path. Example outputs, - # - # hw.model: Sun Microsystems UltraSparc-IIi - # - if test -z "$exact_cpu"; then - if $SHELL -c "/sbin/sysctl hw.model" 2>/dev/null >conftest.dat; then - if grep 'UltraSparc-T1' conftest.dat >/dev/null; then - # this grep pattern has not been tested against any BSD - exact_cpu=ultrasparct1 - elif grep 'UltraSparc-III' conftest.dat >/dev/null; then - exact_cpu=ultrasparc3 - elif grep 'UltraSparc-IIi' conftest.dat >/dev/null; then - exact_cpu=ultrasparc2i - elif grep 'UltraSparc-II' conftest.dat >/dev/null; then - exact_cpu=ultrasparc2 - elif grep 'UltraSparc' conftest.dat >/dev/null; then - exact_cpu=ultrasparc - elif grep 'TMS390Z5.' conftest.dat >/dev/null; then - # TMS390Z50 and TMS390Z55 - exact_cpu=supersparc - elif grep 'TMS390S10' conftest.dat >/dev/null; then - exact_cpu=microsparc - elif grep 'MB86904' conftest.dat >/dev/null; then - # actually MicroSPARC-II - exact_cpu=microsparc - elif grep 'MB86907' conftest.dat >/dev/null; then - exact_cpu=turbosparc - fi - fi - rm -f conftest.dat - fi - - # sun4m and sun4d are v8s of some sort, sun4u is a v9 of some sort - # - if test -z "$exact_cpu"; then - case `uname -m` in - sun4[md]) exact_cpu=sparcv8 ;; - sun4u) exact_cpu=sparcv9 ;; - esac - fi - ;; - -i?86-*-* | amd64-*-* | x86_64-*-*) - cat <${dummy}0.s - .globl cpuid - .globl _cpuid -cpuid: -_cpuid: - pushl %esi - pushl %ebx - movl 16(%esp),%eax - .byte 0x0f - .byte 0xa2 - movl 12(%esp),%esi - movl %ebx,(%esi) - movl %edx,4(%esi) - movl %ecx,8(%esi) - popl %ebx - popl %esi - ret -EOF - cat <${dummy}1.s - .globl cpuid - .globl _cpuid -cpuid: -_cpuid: - push %rbx - mov %esi,%eax - .byte 0x0f - .byte 0xa2 - mov %ebx,(%rdi) - mov %edx,4(%rdi) - mov %ecx,8(%rdi) - pop %rbx - ret -EOF - cat <${dummy}2.c -main () -{ - char vendor_string[13]; - char dummy_string[12]; - long fms; - int family, model, stepping; - char *modelstr; - - cpuid (vendor_string, 0); - vendor_string[12] = 0; - - fms = cpuid (dummy_string, 1); - - family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff); - model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0); - stepping = fms & 0xf; - - modelstr = "$guess_cpu"; - if (strcmp (vendor_string, "GenuineIntel") == 0) - { - switch (family) - { - case 5: - if (model <= 2) modelstr = "pentium"; - else if (model >= 4) modelstr = "pentiummmx"; - break; - case 6: - if (model <= 1) modelstr = "pentiumpro"; - else if (model <= 6) modelstr = "pentium2"; - else if (model <= 8) modelstr = "pentium3"; - else if (model <= 9) modelstr = "pentiumm"; - else if (model <= 12) modelstr = "pentium3"; - else if (model <= 14) modelstr = "pentiumm"; - else if (model <= 25) modelstr = "core2"; - else if (model <= 27) modelstr = "core2"; /* core i5, i7 */ - else if (model == 28) modelstr = "atom"; - else if (model == 29) modelstr = "core2"; - break; - case 15: - modelstr = "pentium4"; - break; - } - } - else if (strcmp (vendor_string, "AuthenticAMD") == 0) - { - switch (family) - { - case 5: - if (model <= 3) modelstr = "k5"; - else if (model <= 7) modelstr = "k6"; - else if (model == 8) modelstr = "k62"; - else if (model == 9) modelstr = "k63"; - else if (model == 10) modelstr = "geode"; - else if (model == 13) modelstr = "k63"; - break; - case 6: - modelstr = "athlon"; - break; - case 15: - case 16: - modelstr = "athlon64"; - break; - } - } - else if (strcmp (vendor_string, "CyrixInstead") == 0) - { - /* Should recognize Cyrix' processors too. */ - } - else if (strcmp (vendor_string, "CentaurHauls") == 0) - { - switch (family) - { - case 6: - if (model < 9) modelstr = "viac3"; - else modelstr = "viac32"; - break; - } - } - - printf ("%s\n", modelstr); - return 0; -} -EOF - - if ($CC_FOR_BUILD ${dummy}1.s ${dummy}2.c -o $dummy) >/dev/null 2>&1; then - # On 80386 and early 80486 cpuid is not available and will result in a - # SIGILL message, hence 2>/dev/null. - # - # On i386-unknown-freebsd4.9, "/bin/sh -c ./dummy" seems to send an - # "Illegal instruction (core dumped)" message to stdout, so we test $? - # to check if the program run was successful. - # - x=`$SHELL -c ./$dummy 2>/dev/null` - if test $? = 0 && test -n "$x"; then - exact_cpu=$x - fi - fi - - if test -z "$exact_cpu"; then - if ($CC_FOR_BUILD ${dummy}0.s ${dummy}2.c -o $dummy) >/dev/null 2>&1; then - # On 80386 and early 80486 cpuid is not available and will result in a - # SIGILL message, hence 2>/dev/null. - # - # On i386-unknown-freebsd4.9, "/bin/sh -c ./dummy" seems to send an - # "Illegal instruction (core dumped)" message to stdout, so we test $? - # to check if the program run was successful. - # - x=`$SHELL -c ./$dummy 2>/dev/null` - if test $? = 0 && test -n "$x"; then - exact_cpu=$x - fi - fi - fi - - # We need to remove some .o files here since lame C compilers - # generate these even when not asked. - rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy - ;; - -esac - - - -# ------------------------------------------------------------------------- -# Use an exact cpu, if possible - -if test -n "$exact_cpu"; then - echo "$exact_cpu$guess_rest" -else - echo "$guess_full" -fi -exit 0 - - - -# Local variables: -# fill-column: 76 -# End: diff --git a/contrib/gmp/config.in b/contrib/gmp/config.in deleted file mode 100644 index 2aed4937b7..0000000000 --- a/contrib/gmp/config.in +++ /dev/null @@ -1,521 +0,0 @@ -/* config.in. Generated from configure.in by autoheader. */ - -/* - -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation; either version 3 of the License, or (at -your option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. -*/ - -/* The gmp-mparam.h file (a string) the tune program should suggest updating. - */ -#undef GMP_MPARAM_H_SUGGEST - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if alloca() works (via gmp-impl.h). */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if the compiler accepts gcc style __attribute__ ((const)) */ -#undef HAVE_ATTRIBUTE_CONST - -/* Define to 1 if the compiler accepts gcc style __attribute__ ((malloc)) */ -#undef HAVE_ATTRIBUTE_MALLOC - -/* Define to 1 if the compiler accepts gcc style __attribute__ ((mode (XX))) - */ -#undef HAVE_ATTRIBUTE_MODE - -/* Define to 1 if the compiler accepts gcc style __attribute__ ((noreturn)) */ -#undef HAVE_ATTRIBUTE_NORETURN - -/* Define to 1 if you have the `attr_get' function. */ -#undef HAVE_ATTR_GET - -/* Define to 1 if tests/libtests has calling conventions checking for the CPU - */ -#undef HAVE_CALLING_CONVENTIONS - -/* Define to 1 if you have the `clock' function. */ -#undef HAVE_CLOCK - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define to 1 if you have the `cputime' function. */ -#undef HAVE_CPUTIME - -/* Define to 1 if you have the declaration of `fgetc', and to 0 if you don't. - */ -#undef HAVE_DECL_FGETC - -/* Define to 1 if you have the declaration of `fscanf', and to 0 if you don't. - */ -#undef HAVE_DECL_FSCANF - -/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. - */ -#undef HAVE_DECL_OPTARG - -/* Define to 1 if you have the declaration of `sys_errlist', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_ERRLIST - -/* Define to 1 if you have the declaration of `sys_nerr', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_NERR - -/* Define to 1 if you have the declaration of `ungetc', and to 0 if you don't. - */ -#undef HAVE_DECL_UNGETC - -/* Define to 1 if you have the declaration of `vfprintf', and to 0 if you - don't. */ -#undef HAVE_DECL_VFPRINTF - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define one of the following to 1 for the format of a `double'. - If your format is not among these choices, or you don't know what it is, - then leave all undefined. - IEEE_LITTLE_SWAPPED means little endian, but with the two 4-byte halves - swapped, as used by ARM CPUs in little endian mode. */ -#undef HAVE_DOUBLE_IEEE_BIG_ENDIAN -#undef HAVE_DOUBLE_IEEE_LITTLE_ENDIAN -#undef HAVE_DOUBLE_IEEE_LITTLE_SWAPPED -#undef HAVE_DOUBLE_VAX_D -#undef HAVE_DOUBLE_VAX_G -#undef HAVE_DOUBLE_CRAY_CFP - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLOAT_H - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `getsysinfo' function. */ -#undef HAVE_GETSYSINFO - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define one of these to 1 for the host CPU family. - If your CPU is not in any of these families, leave all undefined. - For an AMD64 chip, define "x86" in ABI=32, but not in ABI=64. */ -#undef HAVE_HOST_CPU_FAMILY_alpha -#undef HAVE_HOST_CPU_FAMILY_m68k -#undef HAVE_HOST_CPU_FAMILY_power -#undef HAVE_HOST_CPU_FAMILY_powerpc -#undef HAVE_HOST_CPU_FAMILY_x86 - -/* Define one of the following to 1 for the host CPU, as per the output of - ./config.guess. If your CPU is not listed here, leave all undefined. */ -#undef HAVE_HOST_CPU_alphaev67 -#undef HAVE_HOST_CPU_alphaev68 -#undef HAVE_HOST_CPU_alphaev7 -#undef HAVE_HOST_CPU_m68020 -#undef HAVE_HOST_CPU_m68030 -#undef HAVE_HOST_CPU_m68040 -#undef HAVE_HOST_CPU_m68060 -#undef HAVE_HOST_CPU_m68360 -#undef HAVE_HOST_CPU_powerpc604 -#undef HAVE_HOST_CPU_powerpc604e -#undef HAVE_HOST_CPU_powerpc750 -#undef HAVE_HOST_CPU_powerpc7400 -#undef HAVE_HOST_CPU_supersparc -#undef HAVE_HOST_CPU_i386 -#undef HAVE_HOST_CPU_i586 -#undef HAVE_HOST_CPU_i686 -#undef HAVE_HOST_CPU_pentium -#undef HAVE_HOST_CPU_pentiummmx -#undef HAVE_HOST_CPU_pentiumpro -#undef HAVE_HOST_CPU_pentium2 -#undef HAVE_HOST_CPU_pentium3 - -/* Define to 1 if the system has the type `intmax_t'. */ -#undef HAVE_INTMAX_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INVENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LANGINFO_H - -/* Define one of these to 1 for the endianness of `mp_limb_t'. - If the endianness is not a simple big or little, or you don't know what - it is, then leave both undefined. */ -#undef HAVE_LIMB_BIG_ENDIAN -#undef HAVE_LIMB_LITTLE_ENDIAN - -/* Define to 1 if you have the `localeconv' function. */ -#undef HAVE_LOCALECONV - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if the system has the type `long double'. */ -#undef HAVE_LONG_DOUBLE - -/* Define to 1 if the system has the type `long long'. */ -#undef HAVE_LONG_LONG - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_HAL_SYSINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the `mprotect' function. */ -#undef HAVE_MPROTECT - -/* Define to 1 each of the following for which a native (ie. CPU specific) - implementation of the corresponding routine exists. */ -#undef HAVE_NATIVE_mpn_add_n -#undef HAVE_NATIVE_mpn_add_nc -#undef HAVE_NATIVE_mpn_addlsh1_n -#undef HAVE_NATIVE_mpn_addmul_1c -#undef HAVE_NATIVE_mpn_addmul_2 -#undef HAVE_NATIVE_mpn_addmul_3 -#undef HAVE_NATIVE_mpn_addmul_4 -#undef HAVE_NATIVE_mpn_addmul_5 -#undef HAVE_NATIVE_mpn_addmul_6 -#undef HAVE_NATIVE_mpn_addmul_7 -#undef HAVE_NATIVE_mpn_addmul_8 -#undef HAVE_NATIVE_mpn_addsub_n -#undef HAVE_NATIVE_mpn_addaddmul_1msb0 -#undef HAVE_NATIVE_mpn_and_n -#undef HAVE_NATIVE_mpn_andn_n -#undef HAVE_NATIVE_mpn_bdiv_dbm1c -#undef HAVE_NATIVE_mpn_com_n -#undef HAVE_NATIVE_mpn_copyd -#undef HAVE_NATIVE_mpn_copyi -#undef HAVE_NATIVE_mpn_divexact_1 -#undef HAVE_NATIVE_mpn_divexact_by3c -#undef HAVE_NATIVE_mpn_divrem_1 -#undef HAVE_NATIVE_mpn_divrem_1c -#undef HAVE_NATIVE_mpn_divrem_2 -#undef HAVE_NATIVE_mpn_gcd_1 -#undef HAVE_NATIVE_mpn_invert_limb -#undef HAVE_NATIVE_mpn_ior_n -#undef HAVE_NATIVE_mpn_iorn_n -#undef HAVE_NATIVE_mpn_lshiftc -#undef HAVE_NATIVE_mpn_mod_1 -#undef HAVE_NATIVE_mpn_mod_1c -#undef HAVE_NATIVE_mpn_modexact_1_odd -#undef HAVE_NATIVE_mpn_modexact_1c_odd -#undef HAVE_NATIVE_mpn_mul_1c -#undef HAVE_NATIVE_mpn_mul_2 -#undef HAVE_NATIVE_mpn_mul_3 -#undef HAVE_NATIVE_mpn_mul_4 -#undef HAVE_NATIVE_mpn_nand_n -#undef HAVE_NATIVE_mpn_nior_n -#undef HAVE_NATIVE_mpn_preinv_divrem_1 -#undef HAVE_NATIVE_mpn_preinv_mod_1 -#undef HAVE_NATIVE_mpn_redc_1 -#undef HAVE_NATIVE_mpn_redc_2 -#undef HAVE_NATIVE_mpn_rsh1add_n -#undef HAVE_NATIVE_mpn_rsh1sub_n -#undef HAVE_NATIVE_mpn_sqr_basecase -#undef HAVE_NATIVE_mpn_sqr_diagonal -#undef HAVE_NATIVE_mpn_sub_n -#undef HAVE_NATIVE_mpn_sub_nc -#undef HAVE_NATIVE_mpn_sublsh1_n -#undef HAVE_NATIVE_mpn_submul_1c -#undef HAVE_NATIVE_mpn_umul_ppmm -#undef HAVE_NATIVE_mpn_umul_ppmm_r -#undef HAVE_NATIVE_mpn_udiv_qrnnd -#undef HAVE_NATIVE_mpn_udiv_qrnnd_r -#undef HAVE_NATIVE_mpn_xor_n -#undef HAVE_NATIVE_mpn_xnor_n - -/* Define to 1 if you have the `nl_langinfo' function. */ -#undef HAVE_NL_LANGINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define to 1 if you have the `obstack_vprintf' function. */ -#undef HAVE_OBSTACK_VPRINTF - -/* Define to 1 if you have the `popen' function. */ -#undef HAVE_POPEN - -/* Define to 1 if you have the `processor_info' function. */ -#undef HAVE_PROCESSOR_INFO - -/* Define to 1 if `struct pst_processor' exists and contains - `psp_iticksperclktick'. */ -#undef HAVE_PSP_ITICKSPERCLKTICK - -/* Define to 1 if you have the `pstat_getprocessor' function. */ -#undef HAVE_PSTAT_GETPROCESSOR - -/* Define to 1 if the system has the type `ptrdiff_t'. */ -#undef HAVE_PTRDIFF_T - -/* Define to 1 if the system has the type `quad_t'. */ -#undef HAVE_QUAD_T - -/* Define to 1 if you have the `raise' function. */ -#undef HAVE_RAISE - -/* Define to 1 if you have the `read_real_time' function. */ -#undef HAVE_READ_REAL_TIME - -/* Define to 1 if you have the `sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the `sigaltstack' function. */ -#undef HAVE_SIGALTSTACK - -/* Define to 1 if you have the `sigstack' function. */ -#undef HAVE_SIGSTACK - -/* Tune directory speed_cyclecounter, undef=none, 1=32bits, 2=64bits) */ -#undef HAVE_SPEED_CYCLECOUNTER - -/* Define to 1 if you have the header file. */ -#undef HAVE_SSTREAM - -/* Define to 1 if the system has the type `stack_t'. */ -#undef HAVE_STACK_T - -/* Define to 1 if exists and works */ -#undef HAVE_STDARG - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if the system has the type `std::locale'. */ -#undef HAVE_STD__LOCALE - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if cpp supports the ANSI # stringizing operator. */ -#undef HAVE_STRINGIZE - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strnlen' function. */ -#undef HAVE_STRNLEN - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define to 1 if you have the `sysconf' function. */ -#undef HAVE_SYSCONF - -/* Define to 1 if you have the `sysctl' function. */ -#undef HAVE_SYSCTL - -/* Define to 1 if you have the `sysctlbyname' function. */ -#undef HAVE_SYSCTLBYNAME - -/* Define to 1 if you have the `syssgi' function. */ -#undef HAVE_SYSSGI - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_ATTRIBUTES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOGRAPH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PROCESSOR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PSTAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSSGI_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSTEMCFG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the `times' function. */ -#undef HAVE_TIMES - -/* Define to 1 if the system has the type `uint_least32_t'. */ -#undef HAVE_UINT_LEAST32_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vsnprintf' function and it works properly. */ -#undef HAVE_VSNPRINTF - -/* Assembler local label prefix */ -#undef LSYM_PREFIX - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* The size of `mp_limb_t', as computed by sizeof. */ -#undef SIZEOF_MP_LIMB_T - -/* The size of `unsigned', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED - -/* The size of `unsigned long', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_LONG - -/* The size of `unsigned short', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_SHORT - -/* Define to 1 if sscanf requires writable inputs */ -#undef SSCANF_WRITABLE_INPUT - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Maximum size the tune program can test for SQR_KARATSUBA_THRESHOLD */ -#undef TUNE_SQR_KARATSUBA_MAX - -/* Version number of package */ -#undef VERSION - -/* Define to 1 to enable ASSERT checking, per --enable-assert */ -#undef WANT_ASSERT - -/* Define to 1 when building a fat binary. */ -#undef WANT_FAT_BINARY - -/* Define to 1 to enable FFTs for multiplication, per --enable-fft */ -#undef WANT_FFT - -/* Define to 1 if --enable-profiling=gprof */ -#undef WANT_PROFILING_GPROF - -/* Define to 1 if --enable-profiling=instrument */ -#undef WANT_PROFILING_INSTRUMENT - -/* Define to 1 if --enable-profiling=prof */ -#undef WANT_PROFILING_PROF - -/* Define one of these to 1 for the desired temporary memory allocation - method, per --enable-alloca. */ -#undef WANT_TMP_ALLOCA -#undef WANT_TMP_REENTRANT -#undef WANT_TMP_NOTREENTRANT -#undef WANT_TMP_DEBUG - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER - -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to equivalent of C99 restrict keyword, or to nothing if this is not - supported. Do not define if restrict is supported directly. */ -#undef restrict - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -#undef volatile diff --git a/contrib/gmp/config.sub b/contrib/gmp/config.sub deleted file mode 100755 index 1686176ab3..0000000000 --- a/contrib/gmp/config.sub +++ /dev/null @@ -1,143 +0,0 @@ -#! /bin/sh -# -# GMP config.sub wrapper. - - -# Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -# Usage: config.sub CPU-VENDOR-OS -# config.sub ALIAS -# -# Validate and canonicalize the given configuration name, with special -# handling for GMP extra CPU names. -# -# When the CPU isn't special the whole name is simply passed straight -# through to configfsf.sub. -# -# When the CPU is a GMP extra, configfsf.sub is run on a similar CPU that it -# will recognise. For example "athlon-pc-freebsd3.5" is validated using -# "i386-pc-freebsd3.5". -# -# Any canonicalizations made by configfsf.sub are preserved. For example -# given "athlon-linux", configfsf.sub is called with "i386-linux" and will -# give back "i386-pc-linux-gnu". "athlon" is then reinstated, so we print -# "athlon-pc-linux-gnu". - - -# Expect to find configfsf.sub in the same directory as this config.sub -configfsf_sub="`echo \"$0\" | sed 's/config.sub$/configfsf.sub/'`" -if test "$configfsf_sub" = "$0"; then - echo "Cannot derive configfsf.sub from $0" 1>&2 - exit 1 -fi -if test -f "$configfsf_sub"; then - : -else - echo "$configfsf_sub not found" 1>&2 - exit 1 -fi - -# Always run configfsf.sub with $SHELL, like autoconf does for config.sub -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identify ourselves on --version, --help, etc -case "$1" in -"" | -*) - echo "(GNU MP wrapped config.sub)" 1>&2 - $SHELL $configfsf_sub "$@" - exit - ;; -esac - -given_full="$1" -given_cpu=`echo "$given_full" | sed 's/-.*$//'` -given_rest=`echo "$given_full" | sed 's/^[^-]*//'` - - -# Aliases for GMP extras -case "$given_cpu" in - # configfsf.sub turns p5 into i586, instead use our exact cpu type - p5 | p54) given_cpu=pentium ;; - p55) given_cpu=pentiummmx ;; - - # configfsf.sub turns p6, pentiumii and pentiumiii into i686, instead use - # our exact cpu types - p6) given_cpu=pentiumpro ;; - pentiumii) given_cpu=pentium2 ;; - pentiumiii) given_cpu=pentium3 ;; -esac -given_full="$given_cpu$given_rest" - - -# GMP extras and what to use for the config.sub test -case "$given_cpu" in -itanium | itanium2) - test_cpu=ia64 ;; -pentium | pentiummmx | pentiumpro | pentium[234m] | k[56] | k6[23] | geode | athlon | viac3*) - test_cpu=i386 ;; -athlon64 | atom | core2 | opteron) - test_cpu=x86_64 ;; -power[2-9] | power2sc) - test_cpu=power ;; -powerpc401 | powerpc403 | powerpc405 | \ -powerpc505 | \ -powerpc601 | powerpc602 | \ -powerpc603 | powerpc603e | \ -powerpc604 | powerpc604e | \ -powerpc620 | powerpc630 | powerpc970 | \ -powerpc740 | powerpc7400 | powerpc7450 | powerpc750 | \ -powerpc801 | powerpc821 | powerpc823 | powerpc860 | \ -powerpc64) - test_cpu=powerpc ;; -sparcv8 | supersparc | microsparc | \ -ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct1) - test_cpu=sparc ;; -sh2) - test_cpu=sh ;; - -*) - # Don't need or want to change the given name, just run configfsf.sub - $SHELL $configfsf_sub "$given_full" - if test $? = 0; then - exit 0 - else - echo "(GNU MP wrapped config.sub, testing \"$given_full\")" - exit 1 - fi -esac - - -test_full="$test_cpu$given_rest" -canonical_full=`$SHELL $configfsf_sub "$test_full"` -if test $? = 0; then - : -else - echo "(GNU MP wrapped config.sub, testing \"$given_full\" as \"$test_full\")" - exit 1 -fi - -canonical_rest=`echo "$canonical_full" | sed 's/^[^-]*//'` -echo "$given_cpu$canonical_rest" -exit 0 - - - -# Local variables: -# fill-column: 76 -# End: diff --git a/contrib/gmp/configfsf.guess b/contrib/gmp/configfsf.guess deleted file mode 100755 index c7607c74f1..0000000000 --- a/contrib/gmp/configfsf.guess +++ /dev/null @@ -1,1526 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2008-04-14' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[456]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/contrib/gmp/configfsf.sub b/contrib/gmp/configfsf.sub deleted file mode 100755 index a649350a6c..0000000000 --- a/contrib/gmp/configfsf.sub +++ /dev/null @@ -1,1673 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2008-06-16' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/contrib/gmp/configure b/contrib/gmp/configure deleted file mode 100755 index 215ea71ce2..0000000000 --- a/contrib/gmp/configure +++ /dev/null @@ -1,35563 +0,0 @@ -#! /bin/sh -# From configure.in Revision. -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for GNU MP 4.3.2. -# -# Report bugs to . -# -# -# -# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string=`eval $cmd`) 2>/dev/null && - echo_test_string=`eval $cmd` && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='GNU MP' -PACKAGE_TARNAME='gmp' -PACKAGE_VERSION='4.3.2' -PACKAGE_STRING='GNU MP 4.3.2' -PACKAGE_BUGREPORT='gmp-bugs@gmplib.org' - -ac_unique_file="gmp-impl.h" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CYGPATH_W -PACKAGE -VERSION -ACLOCAL -AUTOCONF -AUTOMAKE -AUTOHEADER -MAKEINFO -AMTAR -install_sh -STRIP -INSTALL_STRIP_PROGRAM -mkdir_p -AWK -SET_MAKE -am__leading_dot -MAINTAINER_MODE_TRUE -MAINTAINER_MODE_FALSE -MAINT -WANT_MPBSD_TRUE -WANT_MPBSD_FALSE -GMP_NAIL_BITS -ABI -HAVE_HOST_CPU_FAMILY_power -HAVE_HOST_CPU_FAMILY_powerpc -GMP_LDFLAGS -LIBGMP_LDFLAGS -LIBGMPXX_LDFLAGS -SPEED_CYCLECOUNTER_OBJ -CALLING_CONVENTIONS_OBJS -DEFN_LONG_LONG_LIMB -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CPP -CC_FOR_BUILD -CPP_FOR_BUILD -EXEEXT_FOR_BUILD -U_FOR_BUILD -LIBM_FOR_BUILD -CCAS -CXX -CXXFLAGS -ac_ct_CXX -WANT_CXX_TRUE -WANT_CXX_FALSE -CXXCPP -GREP -EGREP -U -ANSI2KNR -ASMFLAGS -AR -LIBGMP_DLL -SED -LN_S -ECHO -RANLIB -DLLTOOL -AS -OBJDUMP -LIBTOOL -ENABLE_STATIC_TRUE -ENABLE_STATIC_FALSE -LIBM -TAL_OBJECT -M4 -BITS_PER_MP_LIMB -mpn_objs_in_libmp -mpn_objects -mpn_objs_in_libgmp -gmp_srclinks -TUNE_SQR_OBJ -HAVE_CLOCK_01 -HAVE_CPUTIME_01 -HAVE_GETRUSAGE_01 -HAVE_GETTIMEOFDAY_01 -HAVE_SIGACTION_01 -HAVE_SIGALTSTACK_01 -HAVE_SIGSTACK_01 -HAVE_SYS_RESOURCE_H_01 -HAVE_STACK_T_01 -LIBCURSES -WITH_READLINE_01 -LIBREADLINE -YACC -YFLAGS -LEX -LEX_OUTPUT_ROOT -LEXLIB -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -ABI -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CC_FOR_BUILD -CPP_FOR_BUILD -CXX -CXXFLAGS -CCC -CXXCPP -M4 -YACC -YFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures GNU MP 4.3.2 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/gmp] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of GNU MP 4.3.2:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --enable-assert enable ASSERT checking [default=no] - --enable-alloca how to get temp memory [default=reentrant] - --enable-cxx enable C++ support [default=no] - --enable-fft enable FFTs for multiplication [default=yes] - --enable-mpbsd build Berkeley MP compatibility library - [default=no] - --enable-nails use nails on limbs [default=no] - --enable-profiling build with profiler support [default=no] - --enable-fat build a fat binary on systems that support it - [default=no] - --enable-minithres choose minimal thresholds for testing [default=no] - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-readline readline support in calc demo program - [default=detect] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-tags[=TAGS] include additional configurations [automatic] - -Some influential environment variables: - ABI desired ABI (for processors supporting more than one ABI) - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - CC_FOR_BUILD - build system C compiler - CPP_FOR_BUILD - build system C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - M4 m4 macro processor - YACC The `Yet Another C Compiler' implementation to use. Defaults to - the first program found out of: `bison -y', `byacc', `yacc'. - YFLAGS The list of arguments that will be passed by default to $YACC. - This script will default YFLAGS to the empty string to avoid a - default value of `-d' given by some make applications. - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -GNU MP configure 4.3.2 -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. - - - -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation; either version 3 of the License, or (at -your option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by GNU MP $as_me 4.3.2, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - -# If --target is not used then $target_alias is empty, but if say -# "./configure athlon-pc-freebsd3.5" is used, then all three of -# $build_alias, $host_alias and $target_alias are set to -# "athlon-pc-freebsd3.5". -# -if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then - { { echo "$as_me:$LINENO: error: --target is not appropriate for GMP -Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system -explicitly. Use --host if cross-compiling (see \"Installing GMP\" in the -manual for more on this)." >&5 -echo "$as_me: error: --target is not appropriate for GMP -Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system -explicitly. Use --host if cross-compiling (see \"Installing GMP\" in the -manual for more on this)." >&2;} - { (exit 1); exit 1; }; } -fi - -gmp_configm4="config.m4" -gmp_tmpconfigm4=cnfm4.tmp -gmp_tmpconfigm4i=cnfm4i.tmp -gmp_tmpconfigm4p=cnfm4p.tmp -rm -f $gmp_tmpconfigm4 $gmp_tmpconfigm4i $gmp_tmpconfigm4p - -# CONFIG_TOP_SRCDIR is a path from the mpn builddir to the top srcdir. -# The pattern here tests for an absolute path the same way as -# _AC_OUTPUT_FILES in autoconf acgeneral.m4. -case $srcdir in -[\\/]* | ?:[\\/]* ) tmp="$srcdir" ;; -*) tmp="../$srcdir" ;; -esac -echo "define(,<\`$tmp'>)" >>$gmp_tmpconfigm4 - -# All CPUs use asm-defs.m4 -echo "include(CONFIG_TOP_SRCDIR\`/mpn/asm-defs.m4')" >>$gmp_tmpconfigm4i - - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -am__api_version="1.8" -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm -f conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - SET_MAKE= -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='gmp' - VERSION='4.3.2' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. - - - -ac_config_headers="$ac_config_headers config.h:config.in" - -{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 -echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 -echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } - - -if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - - -# Check whether --enable-assert was given. -if test "${enable_assert+set}" = set; then - enableval=$enable_assert; case $enableval in -yes|no) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-assert, need yes or no" >&5 -echo "$as_me: error: bad value $enableval for --enable-assert, need yes or no" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_assert=no -fi - - -if test "$enable_assert" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define WANT_ASSERT 1 -_ACEOF - - want_assert_01=1 -else - want_assert_01=0 -fi - -echo "define(,$want_assert_01)" >> $gmp_tmpconfigm4 - - - -# Check whether --enable-alloca was given. -if test "${enable_alloca+set}" = set; then - enableval=$enable_alloca; case $enableval in -alloca|malloc-reentrant|malloc-notreentrant) ;; -yes|no|reentrant|notreentrant) ;; -debug) ;; -*) - { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-alloca, need one of: -yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug" >&5 -echo "$as_me: error: bad value $enableval for --enable-alloca, need one of: -yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_alloca=reentrant -fi - - - -# IMPROVE ME: The default for C++ is disabled. The tests currently -# performed below for a working C++ compiler are not particularly strong, -# and in general can't be expected to get the right setup on their own. The -# most significant problem is getting the ABI the same. Defaulting CXXFLAGS -# to CFLAGS takes only a small step towards this. It's also probably worth -# worrying whether the C and C++ runtimes from say gcc and a vendor C++ can -# work together. Some rather broken C++ installations were encountered -# during testing, and though such things clearly aren't GMP's problem, if -# --enable-cxx=detect were to be the default then some careful checks of -# which, if any, C++ compiler on the system is up to scratch would be -# wanted. -# -# Check whether --enable-cxx was given. -if test "${enable_cxx+set}" = set; then - enableval=$enable_cxx; case $enableval in -yes|no|detect) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-cxx, need yes/no/detect" >&5 -echo "$as_me: error: bad value $enableval for --enable-cxx, need yes/no/detect" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_cxx=no -fi - - - -# Check whether --enable-fft was given. -if test "${enable_fft+set}" = set; then - enableval=$enable_fft; case $enableval in -yes|no) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-fft, need yes or no" >&5 -echo "$as_me: error: bad value $enableval for --enable-fft, need yes or no" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_fft=yes -fi - - -if test "$enable_fft" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define WANT_FFT 1 -_ACEOF - -fi - - -# Check whether --enable-mpbsd was given. -if test "${enable_mpbsd+set}" = set; then - enableval=$enable_mpbsd; case $enableval in -yes|no) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-mpbsd, need yes or no" >&5 -echo "$as_me: error: bad value $enableval for --enable-mpbsd, need yes or no" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_mpbsd=no -fi - - - -if test "$enable_mpbsd" = "yes"; then - WANT_MPBSD_TRUE= - WANT_MPBSD_FALSE='#' -else - WANT_MPBSD_TRUE='#' - WANT_MPBSD_FALSE= -fi - - - -# Check whether --enable-nails was given. -if test "${enable_nails+set}" = set; then - enableval=$enable_nails; case $enableval in -yes|no|[02468]|[0-9][02468]) ;; -*[13579]) - { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-nails, only even nail sizes supported" >&5 -echo "$as_me: error: bad value $enableval for --enable-nails, only even nail sizes supported" >&2;} - { (exit 1); exit 1; }; } ;; -*) - { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-nails, need yes/no/number" >&5 -echo "$as_me: error: bad value $enableval for --enable-nails, need yes/no/number" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_nails=no -fi - - -case $enable_nails in -yes) GMP_NAIL_BITS=2 ;; -no) GMP_NAIL_BITS=0 ;; -*) GMP_NAIL_BITS=$enable_nails ;; -esac - - - -# Check whether --enable-profiling was given. -if test "${enable_profiling+set}" = set; then - enableval=$enable_profiling; case $enableval in -no|prof|gprof|instrument) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" >&5 -echo "$as_me: error: bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_profiling=no -fi - - -case $enable_profiling in - prof) - -cat >>confdefs.h <<\_ACEOF -#define WANT_PROFILING_PROF 1 -_ACEOF - - ;; - gprof) - -cat >>confdefs.h <<\_ACEOF -#define WANT_PROFILING_GPROF 1 -_ACEOF - - ;; - instrument) - -cat >>confdefs.h <<\_ACEOF -#define WANT_PROFILING_INSTRUMENT 1 -_ACEOF - - ;; -esac - - -echo "define(,<\`$enable_profiling'>)" >> $gmp_tmpconfigm4 - - -# -fomit-frame-pointer is incompatible with -pg on some chips -if test "$enable_profiling" = gprof; then - fomit_frame_pointer= -else - fomit_frame_pointer="-fomit-frame-pointer" -fi - - - -# Check whether --with-readline was given. -if test "${with_readline+set}" = set; then - withval=$with_readline; case $withval in -yes|no|detect) ;; -*) { { echo "$as_me:$LINENO: error: bad value $withval for --with-readline, need yes/no/detect" >&5 -echo "$as_me: error: bad value $withval for --with-readline, need yes/no/detect" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - with_readline=detect -fi - - - -# Check whether --enable-fat was given. -if test "${enable_fat+set}" = set; then - enableval=$enable_fat; case $enableval in -yes|no) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-fat, need yes or no" >&5 -echo "$as_me: error: bad value $enableval for --enable-fat, need yes or no" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_fat=no -fi - - - -# Check whether --enable-minithres was given. -if test "${enable_minithres+set}" = set; then - enableval=$enable_minithres; case $enableval in -yes|no) ;; -*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-minithres, need yes or no" >&5 -echo "$as_me: error: bad value $enableval for --enable-minithres, need yes or no" >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - enable_minithres=no -fi - - - - -tmp_host=`echo $host_cpu | sed 's/\./_/'` -cat >>confdefs.h <<_ACEOF -#define HAVE_HOST_CPU_$tmp_host 1 -_ACEOF - - -echo "define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')" >> $gmp_tmpconfigm4p - - - - - - - -# Table of compilers, options, and mpn paths. This code has various related -# purposes -# -# - better default CC/CFLAGS selections than autoconf otherwise gives -# - default CC/CFLAGS selections for extra CPU types specific to GMP -# - a few tests for known bad compilers -# - choice of ABIs on suitable systems -# - selection of corresponding mpn search path -# -# After GMP specific searches and tests, the standard autoconf AC_PROG_CC is -# called. User selections of CC etc are respected. -# -# Care is taken not to use macros like AC_TRY_COMPILE during the GMP -# pre-testing, since they of course depend on AC_PROG_CC, and also some of -# them cache their results, which is not wanted. -# -# The ABI selection mechanism is unique to GMP. All that reaches autoconf -# is a different selection of CC/CFLAGS according to the best ABI the system -# supports, and/or what the user selects. Naturally the mpn assembler code -# selected is very dependent on the ABI. -# -# The closest the standard tools come to a notion of ABI is something like -# "sparc64" which encodes a CPU and an ABI together. This doesn't seem to -# scale well for GMP, where exact CPU types like "ultrasparc2" are wanted, -# separate from the ABI used on them. -# -# -# The variables set here are -# -# cclist the compiler choices -# xx_cflags flags for compiler xx -# xx_cflags_maybe flags for compiler xx, if they work -# xx_cppflags cpp flags for compiler xx -# xx_cflags_optlist list of sets of optional flags -# xx_cflags_yyy set yyy of optional flags for compiler xx -# xx_ldflags -Wc,-foo flags for libtool linking with compiler xx -# ar_flags extra flags for $AR -# nm_flags extra flags for $NM -# limb limb size, can be "longlong" -# path mpn search path -# extra_functions extra mpn functions -# fat_path fat binary mpn search path [if fat binary desired] -# fat_functions fat functions -# fat_thresholds fat thresholds -# -# Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are -# tried, and the first flag that works will be used. An optlist like "arch -# cpu optimize" can be used to get multiple independent sets of flags tried. -# The first that works from each will be used. If no flag in a set works -# then nothing from that set is added. -# -# For multiple ABIs, the scheme extends as follows. -# -# abilist set of ABI choices -# cclist_aa compiler choices in ABI aa -# xx_aa_cflags flags for xx in ABI aa -# xx_aa_cflags_maybe flags for xx in ABI aa, if they work -# xx_aa_cppflags cpp flags for xx in ABI aa -# xx_aa_cflags_optlist list of sets of optional flags in ABI aa -# xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa -# xx_aa_ldflags -Wc,-foo flags for libtool linking -# ar_aa_flags extra flags for $AR in ABI aa -# nm_aa_flags extra flags for $NM in ABI aa -# limb_aa limb size in ABI aa, can be "longlong" -# path_aa mpn search path in ABI aa -# extra_functions_aa extra mpn functions in ABI aa -# -# As a convenience, the unadorned xx_cflags (etc) are used for the last ABI -# in ablist, if an xx_aa_cflags for that ABI isn't given. For example if -# abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but -# for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is -# defined. This makes it easy to add some 64-bit compilers and flags to an -# unadorned 32-bit set. -# -# limb=longlong (or limb_aa=longlong) applies to all compilers within that -# ABI. It won't work to have some needing long long and some not, since a -# single instantiated gmp.h will be used by both. -# -# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are -# also set here, with an ABI suffix. -# -# -# -# A table-driven approach like this to mapping cpu type to good compiler -# options is a bit of a maintenance burden, but there's not much uniformity -# between options specifications on different compilers. Some sort of -# separately updatable tool might be cute. -# -# The use of lots of variables like this, direct and indirect, tends to -# obscure when and how various things are done, but unfortunately it's -# pretty much the only way. If shell subroutines were portable then actual -# code like "if this .. do that" could be written, but attempting the same -# with full copies of GMP_PROG_CC_WORKS etc expanded at every point would -# hugely bloat the output. - - - - -# abilist needs to be non-empty, "standard" is just a generic name here -abilist="standard" - -# FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring -# c89 over cc here. But note that on HP-UX c89 provides a castrated -# environment, and would want to be excluded somehow. Maybe -# AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and -# we don't need to worry. -# -cclist="gcc cc" - -gcc_cflags="-O2 -pedantic" -gcc_64_cflags="-O2 -pedantic" -cc_cflags="-O" -cc_64_cflags="-O" - -SPEED_CYCLECOUNTER_OBJ= -cyclecounter_size=2 - -HAVE_HOST_CPU_FAMILY_power=0 - -HAVE_HOST_CPU_FAMILY_powerpc=0 - - -case $host in - - a29k*-*-*) - path="a29k" - ;; - - - alpha*-*-*) - cat >>confdefs.h <<\_ACEOF -#define HAVE_HOST_CPU_FAMILY_alpha 1 -_ACEOF - - case $host_cpu in - alphaev5* | alphapca5*) path="alpha/ev5 alpha" ;; - alphaev67 | alphaev68 | alphaev7*) - path="alpha/ev67 alpha/ev6 alpha/ev5 alpha" ;; - alphaev6* | alphaev7*) path="alpha/ev6 alpha/ev5 alpha" ;; - *) path="alpha" ;; - esac - extra_functions="cntlz" - gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below - gcc_cflags_oldas="-Wa,-oldas" # see GMP_GCC_WA_OLDAS. - - # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently. - # gcc 2.95 knows -mcpu= ev4, ev5, ev56, pca56, ev6. - # gcc 3.0 adds nothing. - # gcc 3.1 adds ev45, ev67 (but ev45 is the same as ev4). - # gcc 3.2 adds nothing. - # - # gcc version "2.9-gnupro-99r1" under "-O2 -mcpu=ev6" strikes internal - # compiler errors too easily and is rejected by GMP_PROG_CC_WORKS. Each - # -mcpu=ev6 below has a fallback to -mcpu=ev56 for this reason. - # - case $host_cpu in - alpha) gcc_cflags_cpu="-mcpu=ev4" ;; - alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;; - alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;; - alphapca56 | alphapca57) - gcc_cflags_cpu="-mcpu=pca56" ;; - alphaev6) gcc_cflags_cpu="-mcpu=ev6 -mcpu=ev56" ;; - alphaev67 | alphaev68 | alphaev7*) - gcc_cflags_cpu="-mcpu=ev67 -mcpu=ev6 -mcpu=ev56" ;; - esac - - # gcc version "2.9-gnupro-99r1" on alphaev68-dec-osf5.1 has been seen - # accepting -mcpu=ev6, but not putting the assembler in the right mode - # for what it produces. We need to do this for it, and need to do it - # before testing the -mcpu options. - # - # On old versions of gcc, which don't know -mcpu=, we believe an - # explicit -Wa,-mev5 etc will be necessary to put the assembler in - # the right mode for our .asm files and longlong.h asm blocks. - # - # On newer versions of gcc, when -mcpu= is known, we must give a -Wa - # which is at least as high as the code gcc will generate. gcc - # establishes what it needs with a ".arch" directive, our command line - # option seems to override that. - # - # gas prior to 2.14 doesn't accept -mev67, but -mev6 seems enough for - # ctlz and cttz (in 2.10.0 at least). - # - # OSF `as' accepts ev68 but stupidly treats it as ev4. -arch only seems - # to affect insns like ldbu which are expanded as macros when necessary. - # Insns like ctlz which were never available as macros are always - # accepted and always generate their plain code. - # - case $host_cpu in - alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;; - alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;; - alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;; - alphapca56 | alphapca57) - gcc_cflags_asm="-Wa,-arch,pca56 -Wa,-mpca56" ;; - alphaev6) gcc_cflags_asm="-Wa,-arch,ev6 -Wa,-mev6" ;; - alphaev67 | alphaev68 | alphaev7*) - gcc_cflags_asm="-Wa,-arch,ev67 -Wa,-mev67 -Wa,-arch,ev6 -Wa,-mev6" ;; - esac - - # It might be better to ask "cc" whether it's Cray C or DEC C, - # instead of relying on the OS part of $host. But it's hard to - # imagine either of those compilers anywhere except their native - # systems. - # - -echo "include_mpn(\`alpha/alpha-defs.m4')" >> $gmp_tmpconfigm4i - - case $host in - *-cray-unicos*) - cc_cflags="-O" # no -g, it silently disables all optimizations - -echo "include_mpn(\`alpha/unicos.m4')" >> $gmp_tmpconfigm4i - - # Don't perform any assembly syntax tests on this beast. - gmp_asm_syntax_testing=no - ;; - *-*-osf*) - -echo "include_mpn(\`alpha/default.m4')" >> $gmp_tmpconfigm4i - - cc_cflags="" - cc_cflags_optlist="opt cpu" - - # not sure if -fast works on old versions, so make it optional - cc_cflags_opt="-fast -O2" - - # DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6. - # Compaq C V6.3-029 adds ev67. - # - case $host_cpu in - alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;; - alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;; - alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;; - alphapca56 | alphapca57) - cc_cflags_cpu="-arch~pca56~-tune~pca56" ;; - alphaev6) cc_cflags_cpu="-arch~ev6~-tune~ev6" ;; - alphaev67 | alphaev68 | alphaev7*) - cc_cflags_cpu="-arch~ev67~-tune~ev67 -arch~ev6~-tune~ev6" ;; - esac - ;; - *) - -echo "include_mpn(\`alpha/default.m4')" >> $gmp_tmpconfigm4i - - ;; - esac - - case $host in - *-*-unicos*) - # tune/alpha.asm assumes int==4bytes but unicos uses int==8bytes - ;; - *) - SPEED_CYCLECOUNTER_OBJ=alpha.lo - cyclecounter_size=1 ;; - esac - ;; - - - # Cray vector machines. - # This must come after alpha* so that we can recognize present and future - # vector processors with a wildcard. - *-cray-unicos*) - gmp_asm_syntax_testing=no - cclist="cc" - # We used to have -hscalar0 here as a workaround for miscompilation of - # mpz/import.c, but let's hope Cray fixes their bugs instead, since - # -hscalar0 causes disastrously poor code to be generated. - cc_cflags="-O3 -hnofastmd -htask0 -Wa,-B" - path="cray" - ;; - - - arm*-*-*) - path="arm" - gcc_cflags="$gcc_cflags $fomit_frame_pointer" - gcc_testlist="gcc-arm-umodsi" - -echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i - - ;; - - - clipper*-*-*) - path="clipper" - ;; - - - # Fujitsu - f30[01]-fujitsu-sysv*) - cclist="gcc vcc" - # FIXME: flags for vcc? - vcc_cflags="-g" - path="fujitsu" - ;; - - - hppa*-*-*) - # HP cc (the one sold separately) is K&R by default, but AM_C_PROTOTYPES - # will add "-Ae", or "-Aa -D_HPUX_SOURCE", to put it into ansi mode, if - # possible. - # - # gcc for hppa 2.0 can be built either for 2.0n (32-bit) or 2.0w - # (64-bit), but not both, so there's no option to choose the desired - # mode, we must instead detect which of the two it is. This is done by - # checking sizeof(long), either 4 or 8 bytes respectively. Do this in - # ABI=1.0 too, in case someone tries to build that with a 2.0w gcc. - # - gcc_cflags="-O2" - gcc_cflags_optlist="arch" - gcc_testlist="sizeof-long-4" - SPEED_CYCLECOUNTER_OBJ=hppa.lo - cyclecounter_size=1 - - # FIXME: For hppa2.0*, path should be "pa32/hppa2_0 pa32/hppa1_1 pa32". - # (Can't remember why this isn't done already, have to check what .asm - # files are available in each and how they run on a typical 2.0 cpu.) - # - case $host_cpu in - hppa1.0*) path="pa32" ;; - hppa7000*) path="pa32/hppa1_1 pa32" ;; - hppa2.0* | hppa64) - path="pa32/hppa2_0 pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;; - *) # default to 7100 - path="pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;; - esac - - # gcc 2.7.2.3 knows -mpa-risc-1-0 and -mpa-risc-1-1 - # gcc 2.95 adds -mpa-risc-2-0, plus synonyms -march=1.0, 1.1 and 2.0 - # - # We don't use -mpa-risc-2-0 in ABI=1.0 because 64-bit registers may not - # be saved by the kernel on an old system. Actually gcc (as of 3.2) - # only adds a few float instructions with -mpa-risc-2-0, so it would - # probably be safe, but let's not take the chance. In any case, a - # configuration like --host=hppa2.0 ABI=1.0 is far from optimal. - # - case $host_cpu in - hppa1.0*) gcc_cflags_arch="-mpa-risc-1-0" ;; - *) # default to 7100 - gcc_cflags_arch="-mpa-risc-1-1" ;; - esac - - case $host_cpu in - hppa1.0*) cc_cflags="+O2" ;; - *) # default to 7100 - cc_cflags="+DA1.1 +O2" ;; - esac - - case $host in - hppa2.0*-*-* | hppa64-*-*) - cclist_20n="gcc cc" - abilist="2.0n 1.0" - path_20n="pa64" - limb_20n=longlong - any_20n_testlist="sizeof-long-4" - SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo - cyclecounter_size_20n=2 - - # -mpa-risc-2-0 is only an optional flag, in case an old gcc is - # used. Assembler support for 2.0 is essential though, for our asm - # files. - gcc_20n_cflags="-O2" - gcc_20n_cflags_optlist="arch" - gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1" - gcc_20n_testlist="sizeof-long-4 hppa-level-2.0" - - cc_20n_cflags="+DA2.0 +e +O2 -Wl,+vnocompatwarnings" - cc_20n_testlist="hpc-hppa-2-0" - - # ABI=2.0w is available for hppa2.0w and hppa2.0, but not for - # hppa2.0n, on the assumption that that the latter indicates a - # desire for ABI=2.0n. - case $host in - hppa2.0n-*-*) ;; - *) - # HPUX 10 and earlier cannot run 2.0w. Not sure about other - # systems (GNU/Linux for instance), but lets assume they're ok. - case $host in - *-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*) ;; - *) abilist="2.0w $abilist" ;; - esac - - cclist_20w="gcc cc" - gcc_20w_cflags="-O2 -mpa-risc-2-0" - cc_20w_cflags="+DD64 +O2" - cc_20w_testlist="hpc-hppa-2-0" - path_20w="pa64" - any_20w_testlist="sizeof-long-8" - SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo - cyclecounter_size_20w=2 - ;; - esac - ;; - esac - ;; - - - i960*-*-*) - path="i960" - ;; - - - ia64*-*-* | itanium-*-* | itanium2-*-*) - abilist="64" - -echo "include_mpn(\`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i - - SPEED_CYCLECOUNTER_OBJ=ia64.lo - - case $host_cpu in - itanium) path="ia64/itanium ia64" ;; - itanium2) path="ia64/itanium2 ia64" ;; - *) path="ia64" ;; - esac - - gcc_64_cflags_optlist="tune" - gcc_32_cflags_optlist=$gcc_64_cflags_optlist - - # gcc pre-release 3.4 adds -mtune itanium and itanium2 - case $host_cpu in - itanium) gcc_cflags_tune="-mtune=itanium" ;; - itanium2) gcc_cflags_tune="-mtune=itanium2" ;; - esac - - case $host in - *-*-linux*) - cclist="gcc icc" - icc_cflags="-no-gcc" - icc_cflags_optlist="opt" - # Don't use -O3, it is for "large data sets" and also miscompiles GMP. - # But icc miscompiles GMP at any optimization level, at higher levels - # it miscompiles more files... - icc_cflags_opt="-O2 -O1" - ;; - - *-*-hpux*) - # HP cc sometimes gets internal errors if the optimization level is - # too high. GMP_PROG_CC_WORKS detects this, the "_opt" fallbacks - # let us use whatever seems to work. - # - abilist="32 64" - - cclist_32="gcc cc" - path_32="ia64" - cc_32_cflags="" - cc_32_cflags_optlist="opt" - cc_32_cflags_opt="+O3 +O2 +O1" - gcc_32_cflags="-milp32 -O2" - limb_32=longlong - SPEED_CYCLECOUNTER_OBJ_32=ia64.lo - cyclecounter_size_32=2 - - # Must have +DD64 in CPPFLAGS to get the right __LP64__ for headers, - # but also need it in CFLAGS for linking programs, since automake - # only uses CFLAGS when linking, not CPPFLAGS. - # FIXME: Maybe should use cc_64_ldflags for this, but that would - # need GMP_LDFLAGS used consistently by all the programs. - # - cc_64_cflags="+DD64" - cc_64_cppflags="+DD64" - cc_64_cflags_optlist="opt" - cc_64_cflags_opt="+O3 +O2 +O1" - gcc_64_cflags="$gcc_64_cflags -mlp64" - ;; - esac - ;; - - - # Motorola 68k - # - m68k-*-* | m68[0-9][0-9][0-9]-*-*) - cat >>confdefs.h <<\_ACEOF -#define HAVE_HOST_CPU_FAMILY_m68k 1 -_ACEOF - - -echo "include_mpn(\`m68k/m68k-defs.m4')" >> $gmp_tmpconfigm4i - - gcc_cflags="$gcc_cflags $fomit_frame_pointer" - gcc_cflags_optlist="arch" - - # gcc 2.7.2 knows -m68000, -m68020, -m68030, -m68040. - # gcc 2.95 adds -mcpu32, -m68060. - # FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2. - # - case $host_cpu in - m68020) gcc_cflags_arch="-m68020" ;; - m68030) gcc_cflags_arch="-m68030" ;; - m68040) gcc_cflags_arch="-m68040" ;; - m68060) gcc_cflags_arch="-m68060 -m68000" ;; - m68360) gcc_cflags_arch="-mcpu32 -m68000" ;; - *) gcc_cflags_arch="-m68000" ;; - esac - - # FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be - # tested. Will need to introduce an m68k/cpu32 if m68k/mc68020 ever uses - # the bitfield instructions. - case $host_cpu in - m680[234]0 | m68360) path="m68k/mc68020 m68k" ;; - *) path="m68k" ;; - esac - ;; - - - # Motorola 88k - m88k*-*-*) - path="m88k" - ;; - m88110*-*-*) - gcc_cflags="$gcc_cflags -m88110" - path="m88k/mc88110 m88k" - ;; - - - # National Semiconductor 32k - ns32k*-*-*) - path="ns32k" - ;; - - - # IRIX 5 and earlier can only run 32-bit o32. - # - # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64. n32 is - # preferred over 64, but only because that's been the default in past - # versions of GMP. The two are equally efficient. - # - # Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not - # supporting n32 or 64. - # - # For reference, libtool (eg. 1.5.6) recognises the n32 ABI and knows the - # right options to use when linking (both cc and gcc), so no need for - # anything special from us. - # - mips*-*-*) - abilist="o32" - gcc_cflags_optlist="abi" - gcc_cflags_abi="-mabi=32" - gcc_testlist="gcc-mips-o32" - path="mips32" - cc_cflags="-O2 -o32" # no -g, it disables all optimizations - # this suits both mips32 and mips64 - -echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i - - - case $host in - mips64*-*-* | mips*-*-irix[6789]*) - abilist="n32 64 o32" - - cclist_n32="gcc cc" - gcc_n32_cflags="-O2 -mabi=n32" - cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations - limb_n32=longlong - path_n32="mips64" - - cclist_64="gcc cc" - gcc_64_cflags="$gcc_64_cflags -mabi=64" - gcc_64_ldflags="-Wc,-mabi=64" - cc_64_cflags="-O2 -64" # no -g, it disables all optimizations - cc_64_ldflags="-Wc,-64" - path_64="mips64" - ;; - esac - ;; - - - # Darwin (powerpc-apple-darwin1.3) has it's hacked gcc installed as cc. - # Our usual "gcc in disguise" detection means gcc_cflags etc here gets - # used. - # - # The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp - # since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h, - # and so always ends up running the plain preprocessor anyway. This could - # be done in CPPFLAGS rather than CFLAGS, but there's not many places - # preprocessing is done separately, and this is only a speedup, the normal - # preprocessor gets run if there's any problems. - # - # We used to use -Wa,-mppc with gcc, but can't remember exactly why. - # Presumably it was for old versions of gcc where -mpowerpc doesn't put - # the assembler in the right mode. In any case -Wa,-mppc is not good, for - # instance -mcpu=604 makes recent gcc use -m604 to get access to the - # "fsel" instruction, but a -Wa,-mppc overrides that, making code that - # comes out with fsel fail. - # - # (Note also that the darwin assembler doesn't accept "-mppc", so any - # -Wa,-mppc was used only if it worked. The right flag on darwin would be - # "-arch ppc" or some such, but that's already the default.) - # - powerpc*-*-* | power[3-9]-*-*) - cat >>confdefs.h <<\_ACEOF -#define HAVE_HOST_CPU_FAMILY_powerpc 1 -_ACEOF - - HAVE_HOST_CPU_FAMILY_powerpc=1 - abilist="32" - cclist="gcc cc" - cc_cflags="-O2" - gcc_cflags="$gcc_cflags -mpowerpc" - gcc_cflags_optlist="precomp subtype asm cpu" - gcc_cflags_precomp="-no-cpp-precomp" - gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin - gcc_cflags_asm="" - gcc_cflags_cpu="" - - # grab this object, though it's not a true cycle counter routine - SPEED_CYCLECOUNTER_OBJ=powerpc.lo - cyclecounter_size=0 - - case $host_cpu in - powerpc740 | powerpc750) - path="powerpc32/750 powerpc32" ;; - powerpc7400 | powerpc7410) - path="powerpc32/vmx powerpc32/750 powerpc32" ;; - powerpc74[45]?) - path="powerpc32/vmx powerpc32" ;; - *) - path="powerpc32" ;; - esac - - # gcc 2.7.2 knows -mcpu=403, 601, 603, 604. - # gcc 2.95 adds 401, 505, 602, 603e, ec603e, 604e, 620, 740, 750, - # 801, 821, 823, 860. - # gcc 3.0 adds 630, rs64a. - # gcc 3.1 adds 405, 7400, 7450. - # gcc 3.2 adds nothing. - # gcc 3.3 adds power3, power4, 8540. power3 seems to be a synonym for 630. - # gcc pre-release 3.4 adds 405fp, 440, 440fp, 970. - # - # FIXME: The way 603e falls back to 603 for gcc 2.7.2 should be - # done for all the others too. But what would be the correct - # arrangements? - # - case $host_cpu in - powerpc401) gcc_cflags_cpu="-mcpu=401" ;; - powerpc403) gcc_cflags_cpu="-mcpu=403" ;; - powerpc405) gcc_cflags_cpu="-mcpu=405" ;; - powerpc505) gcc_cflags_cpu="-mcpu=505" ;; - powerpc601) gcc_cflags_cpu="-mcpu=601" ;; - powerpc602) gcc_cflags_cpu="-mcpu=602" ;; - powerpc603) gcc_cflags_cpu="-mcpu=603" ;; - powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;; - powerpc604) gcc_cflags_cpu="-mcpu=604" ;; - powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;; - powerpc620) gcc_cflags_cpu="-mcpu=620" ;; - powerpc630) gcc_cflags_cpu="-mcpu=630" ;; - powerpc740) gcc_cflags_cpu="-mcpu=740" ;; - powerpc7400 | powerpc7410) - gcc_cflags_asm="-Wa,-maltivec" - gcc_cflags_cpu="-mcpu=7400 -mcpu=750" ;; - powerpc74[45]?) - gcc_cflags_asm="-Wa,-maltivec" - gcc_cflags_cpu="-mcpu=7450" ;; - powerpc750) gcc_cflags_cpu="-mcpu=750" ;; - powerpc801) gcc_cflags_cpu="-mcpu=801" ;; - powerpc821) gcc_cflags_cpu="-mcpu=821" ;; - powerpc823) gcc_cflags_cpu="-mcpu=823" ;; - powerpc860) gcc_cflags_cpu="-mcpu=860" ;; - powerpc970) gcc_cflags_cpu="-mcpu=970" ;; - esac - - case $host in - *-*-aix*) - cclist="gcc xlc cc" - xlc_cflags="-O2 -qmaxmem=20000" - xlc_cflags_optlist="arch" - - # xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604, - # 403, rs64a - # -qarch=ppc is needed, so ensure everything falls back to that. - # FIXME: Perhaps newer versions know more flavours. - # - case $host_cpu in - powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;; - powerpc601) xlc_cflags_arch="-qarch=601 -qarch=ppc" ;; - powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;; - powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;; - powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;; - powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;; - powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;; - *) xlc_cflags_arch="-qarch=ppc" ;; - esac - ;; - esac - - case $host in - powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*) - case $host_cpu in - powerpc970) vmx_path="powerpc64/vmx" ;; - *) vmx_path="" ;; - esac - case $host in - *-*-aix*) - # On AIX a true 64-bit ABI is available. - # Need -Wc to pass object type flags through to the linker. - abilist="aix64 $abilist" - cclist_aix64="gcc xlc" - gcc_aix64_cflags="-O2 -maix64 -mpowerpc64" - gcc_aix64_cflags_optlist="cpu" - gcc_aix64_ldflags="-Wc,-maix64" - xlc_aix64_cflags="-O2 -q64 -qtune=pwr3 -qmaxmem=20000" - xlc_aix64_ldflags="-Wc,-q64" - # Must indicate object type to ar and nm - ar_aix64_flags="-X64" - nm_aix64_flags="-X64" - path_aix64="powerpc64/mode64 $vmx_path powerpc64" - # grab this object, though it's not a true cycle counter routine - SPEED_CYCLECOUNTER_OBJ_aix64=powerpc64.lo - cyclecounter_size_aix64=0 - ;; - *-*-darwin*) - # On Darwin we can use 64-bit instructions with a longlong limb, - # but the chip still in 32-bit mode. - # In theory this can be used on any OS which knows how to save - # 64-bit registers in a context switch. - # - # Note that we must use -mpowerpc64 with gcc, since the - # longlong.h macros expect limb operands in a single 64-bit - # register, not two 32-bit registers as would be given for a - # long long without -mpowerpc64. In theory we could detect and - # accomodate both styles, but the proper 64-bit registers will - # be fastest and are what we really want to use. - # - # One would think -mpowerpc64 would set the assembler in the right - # mode to handle 64-bit instructions. But for that, also - # -force_cpusubtype_ALL is needed. - # - # Do not use -fast for Darwin, it actually adds options - # incompatible with a shared library. - # - abilist="mode64 mode32 $abilist" - gcc_cflags_opt="-O3 -O2 -O1" # will this become used? - cclist_mode32="gcc" - gcc_mode32_cflags="-mpowerpc64" - gcc_mode32_cflags_optlist="subtype cpu opt" - gcc_mode32_cflags_subtype="-force_cpusubtype_ALL" - gcc_mode32_cflags_opt="-O3 -O2 -O1" - path_mode32="powerpc64/mode32 $vmx_path powerpc64" - limb_mode32=longlong - cclist_mode64="gcc" - gcc_mode64_cflags="-m64" - gcc_mode64_cflags_optlist="cpu opt" - gcc_mode64_cflags_opt="-O3 -O2 -O1" - path_mode64="powerpc64/mode64 $vmx_path powerpc64" - SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo - cyclecounter_size_mode64=0 - any_mode64_testlist="sizeof-long-8" - ;; - *-*-linux* | *-*-*bsd*) - # On GNU/Linux, assume the processor is in 64-bit mode. Some - # environments have a gcc that is always in 64-bit mode, while - # others require -m64, hence the use of cflags_maybe. The - # sizeof-long-8 test checks the mode is right (for the no option - # case). - # - # -mpowerpc64 is not used, since it should be the default in - # 64-bit mode. (We need its effect for the various longlong.h - # asm macros to be right of course.) - # - # gcc64 was an early port of gcc to 64-bit mode, but should be - # obsolete before too long. We prefer plain gcc when it knows - # 64-bits. - # - abilist="mode64 mode32 $abilist" - cclist_mode32="gcc" - gcc_mode32_cflags="-mpowerpc64" - gcc_mode32_cflags_optlist="cpu opt" - gcc_mode32_cflags_opt="-O3 -O2 -O1" - path_mode32="powerpc64/mode32 $vmx_path powerpc64" - limb_mode32=longlong - cclist_mode64="gcc gcc64" - gcc_mode64_cflags_maybe="-m64" - gcc_mode64_cflags_optlist="cpu opt" - gcc_mode64_cflags_opt="-O3 -O2 -O1" - path_mode64="powerpc64/mode64 $vmx_path powerpc64" - SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo - cyclecounter_size_mode64=0 - any_mode64_testlist="sizeof-long-8" - ;; - esac - ;; - esac - ;; - - - # POWER - power-*-* | power[12]-*-* | power2sc-*-*) - cat >>confdefs.h <<\_ACEOF -#define HAVE_HOST_CPU_FAMILY_power 1 -_ACEOF - - HAVE_HOST_CPU_FAMILY_power=1 - cclist="gcc" - extra_functions="udiv_w_sdiv" - path="power" - - # gcc 2.7.2 knows rios1, rios2, rsc - # - # -mcpu=rios2 can tickle an AIX assembler bug (see GMP_PROG_CC_WORKS) so - # there needs to be a fallback to just -mpower. - # - gcc_cflags_optlist="cpu" - case $host in - power-*-*) gcc_cflags_cpu="-mcpu=power -mpower" ;; - power1-*-*) gcc_cflags_cpu="-mcpu=rios1 -mpower" ;; - power2-*-*) gcc_cflags_cpu="-mcpu=rios2 -mpower" ;; - power2sc-*-*) gcc_cflags_cpu="-mcpu=rsc -mpower" ;; - esac - case $host in - *-*-aix*) - cclist="gcc xlc" - xlc_cflags="-O2 -qarch=pwr -qmaxmem=20000" - ;; - esac - ;; - - - pyramid-*-*) - path="pyr" - ;; - - - # IBM s/370 and similar - s3[6-9]0*-*-*) - gcc_cflags="$gcc_cflags $fomit_frame_pointer" - path="s390" - extra_functions="udiv_w_sdiv" - ;; - - - sh-*-*) path="sh" ;; - sh2-*-*) path="sh/sh2 sh" ;; - - - *sparc*-*-*) - # sizeof(long)==4 or 8 is tested, to ensure we get the right ABI. We've - # had various bug reports where users have set CFLAGS for their desired - # mode, but not set our ABI. For some reason it's sparc where this - # keeps coming up, presumably users there are accustomed to driving the - # compiler mode that way. The effect of our testlist setting is to - # reject ABI=64 in favour of ABI=32 if the user has forced the flags to - # 32-bit mode. - # - abilist="32" - cclist="gcc acc cc" - any_testlist="sizeof-long-4" - -echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i - - - case $host_cpu in - sparcv8 | microsparc | turbosparc) - path="sparc32/v8 sparc32" ;; - supersparc) - path="sparc32/v8/supersparc sparc32/v8 sparc32" ;; - sparc64 | sparcv9* | ultrasparc*) - path="sparc32/v9 sparc32/v8 sparc32" ;; - *) - path="sparc32" ;; - esac - - # gcc 2.7.2 doesn't know about v9 and doesn't pass -xarch=v8plus to the - # assembler. Add it explicitly since the solaris assembler won't accept - # our sparc32/v9 asm code without it. gas accepts -xarch=v8plus too, so - # it can be in the cflags unconditionally (though gas doesn't need it). - # - # gcc -m32 is needed to force 32-bit mode on a dual-ABI system, but past - # gcc doesn't know that flag, hence cflags_maybe. Note that -m32 cannot - # be done through the optlist since the plain cflags would be run first - # and we don't want to require the default mode (whatever it is) works. - # - # Note it's gcc_32_cflags_maybe and not gcc_cflags_maybe because the - # latter would be used in the 64-bit ABI on systems like "*bsd" where - # abilist="64" only. - # - case $host_cpu in - sparc64 | sparcv9* | ultrasparc*) - gcc_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;; - *) - gcc_cflags="$gcc_cflags" ;; - esac - gcc_32_cflags_maybe="-m32" - gcc_cflags_optlist="cpu" - - # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite. - # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934, - # sparclet, tsc701, v9, ultrasparc. A warning is given that the - # plain -m forms will disappear. - # gcc 3.0 adds nothing. - # gcc 3.1 adds nothing. - # gcc 3.2 adds nothing. - # gcc 3.3 adds ultrasparc3. - # - case $host_cpu in - supersparc) gcc_cflags_cpu="-mcpu=supersparc -msupersparc" ;; - sparcv8 | microsparc | turbosparc) - gcc_cflags_cpu="-mcpu=v8 -mv8" ;; - sparc64 | sparcv9*) gcc_cflags_cpu="-mcpu=v9 -mv8" ;; - ultrasparc3) gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mv8" ;; - ultrasparc*) gcc_cflags_cpu="-mcpu=ultrasparc -mv8" ;; - *) gcc_cflags_cpu="-mcpu=v7 -mcypress" ;; - esac - - # SunPRO cc and acc, and SunOS bundled cc - case $host in - *-*-solaris* | *-*-sunos*) - # Note no -g, it disables all optimizations. - cc_cflags= - cc_cflags_optlist="opt arch cpu" - - # SunOS cc doesn't know -xO4, fallback to -O2. - cc_cflags_opt="-xO4 -O2" - - # SunOS cc doesn't know -xarch, apparently always generating v7 - # code, so make this optional - case $host_cpu in - sparcv8 | microsparc | supersparc | turbosparc) - cc_cflags_arch="-xarch=v8" ;; - sparc64 | sparcv9* | ultrasparc*) cc_cflags_arch="-xarch=v8plus" ;; - *) cc_cflags_arch="-xarch=v7" ;; - esac - - # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent. - # SunPRO cc 5 recognises -xchip=generic, old, super, super2, micro, - # micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i. - # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu. - # - # FIXME: Which of ultra, ultra2 or ultra2i is the best fallback for - # ultrasparc3? - # - case $host_cpu in - supersparc) cc_cflags_cpu="-xchip=super" ;; - microsparc) cc_cflags_cpu="-xchip=micro" ;; - turbosparc) cc_cflags_cpu="-xchip=micro2" ;; - ultrasparc) cc_cflags_cpu="-xchip=ultra" ;; - ultrasparc2) cc_cflags_cpu="-xchip=ultra2" ;; - ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;; - ultrasparc3) cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;; - *) cc_cflags_cpu="-xchip=generic" ;; - esac - esac - - case $host_cpu in - sparc64 | sparcv9* | ultrasparc*) - case $host in - # Solaris 6 and earlier cannot run ABI=64 since it doesn't save - # registers properly, so ABI=32 is left as the only choice. - # - *-*-solaris2.[0-6] | *-*-solaris2.[0-6].*) ;; - - # BSD sparc64 ports are 64-bit-only systems, so ABI=64 is the only - # choice. In fact they need no special compiler flags, gcc -m64 - # is the default, but it doesn't hurt to add it. v9 CPUs always - # use the sparc64 port, since the plain 32-bit sparc ports don't - # run on a v9. - # - *-*-*bsd*) abilist="64" ;; - - # For all other systems, we try both 64 and 32. - # - # GNU/Linux sparc64 has only recently gained a 64-bit user mode. - # In the past sparc64 meant a v9 cpu, but there were no 64-bit - # operations in user mode. We assume that if "gcc -m64" works - # then the system is suitable. Hopefully even if someone attempts - # to put a new gcc and/or glibc on an old system it won't run. - # - *) abilist="64 32" ;; - esac - - path_64="sparc64" - cclist_64="gcc" - any_64_testlist="sizeof-long-8" - - # gcc -mptr64 is probably implied by -m64, but we're not sure if - # this was always so. On Solaris in the past we always used both - # "-m64 -mptr64". - # - # gcc -Wa,-xarch=v9 is thought to be necessary in some cases on - # solaris, but it would seem likely that if gcc is going to generate - # 64-bit code it will have to add that option itself where needed. - # An extra copy of this option should be harmless though, but leave - # it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the - # higher cpu types instead.) - # - gcc_64_cflags="$gcc_64_cflags -m64 -mptr64" - gcc_64_ldflags="-Wc,-m64" - gcc_64_cflags_optlist="cpu" - - case $host in - *-*-solaris*) - # Sun cc. - # - # We used to have -fast and some fixup options here, but it - # recurrently caused problems with miscompilation. Of course, - # -fast is documented as miscompiling things for the sake of speed. - # - cclist_64="$cclist_64 cc" - cc_64_cflags="-xO3 -xarch=v9" - cc_64_cflags_optlist="cpu" - ;; - esac - - # using the v9 %tick register - SPEED_CYCLECOUNTER_OBJ_32=sparcv9.lo - SPEED_CYCLECOUNTER_OBJ_64=sparcv9.lo - cyclecounter_size_32=2 - cyclecounter_size_64=2 - ;; - esac - ;; - - - # VAX - vax*-*-*) - # Currently gcc (version 3.0) on vax always uses a frame pointer - # (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer - # will be ignored. - # - gcc_cflags="$gcc_cflags $fomit_frame_pointer" - path="vax" - extra_functions="udiv_w_sdiv" - ;; - - - # AMD and Intel x86 configurations, including AMD64 - # - # Rumour has it gcc -O2 used to give worse register allocation than just - # -O, but lets assume that's no longer true. - # - # -m32 forces 32-bit mode on a bi-arch 32/64 amd64 build of gcc. -m64 is - # the default in such a build (we think), so -m32 is essential for ABI=32. - # This is, of course, done for any $host_cpu, not just x86_64, so we can - # get such a gcc into the right mode to cross-compile to say i486-*-*. - # - # -m32 is not available in gcc 2.95 and earlier, hence cflags_maybe to use - # it when it works. We check sizeof(long)==4 to ensure we get the right - # mode, in case -m32 has failed not because it's an old gcc, but because - # it's a dual 32/64-bit gcc without a 32-bit libc, or whatever. - # - i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*) - abilist="32" - cclist="gcc icc cc" - gcc_cflags="$gcc_cflags $fomit_frame_pointer" - gcc_32_cflags_maybe="-m32" - icc_cflags="-no-gcc" - icc_cflags_optlist="opt" - icc_cflags_opt="-O3 -O2 -O1" - any_32_testlist="sizeof-long-4" - CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo' - - # Availability of rdtsc is checked at run-time. - SPEED_CYCLECOUNTER_OBJ=pentium.lo - - # gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These - # represent -mcpu= since -m486 doesn't generate 486 specific insns. - # gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=. - # gcc 3.0 adds athlon. - # gcc 3.1 adds k6-2, k6-3, pentium-mmx, pentium2, pentium3, pentium4, - # athlon-tbird, athlon-4, athlon-xp, athlon-mp. - # gcc 3.2 adds winchip2. - # gcc 3.3 adds winchip-c6. - # gcc 3.3.1 from mandrake adds k8 and knows -mtune. - # gcc 3.4 adds c3, c3-2, k8, and deprecates -mcpu in favour of -mtune. - # - # In gcc 2.95.[0123], -march=pentiumpro provoked a stack slot bug in an - # old version of mpz/powm.c. Seems to be fine with the current code, so - # no need for any restrictions on that option. - # - # -march=pentiumpro can fail if the assembler doesn't know "cmov" - # (eg. solaris 2.8 native "as"), so always have -march=pentium after - # that as a fallback. - # - # -march=pentium4 and -march=k8 enable SSE2 instructions, which may or - # may not be supported by the assembler and/or the OS, and is bad in gcc - # prior to 3.3. The tests will reject these if no good, so fallbacks - # like "-march=pentium4 -mno-sse2" are given to try also without SSE2. - # Note the relevant -march types are listed in the optflags handling - # below, be sure to update there if adding new types emitting SSE2. - # - # -mtune is used at the start of each cpu option list to give something - # gcc 3.4 will use, thereby avoiding warnings from -mcpu. -mcpu forms - # are retained for use by prior gcc. For example pentium has - # "-mtune=pentium -mcpu=pentium ...", the -mtune is for 3.4 and the - # -mcpu for prior. If there's a brand new choice in 3.4 for a chip, - # like k8 for x86_64, then it can be the -mtune at the start, no need to - # duplicate anything. - # - gcc_cflags_optlist="cpu arch" - case $host_cpu in - i386*) - gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386" - gcc_cflags_arch="-march=i386" - ;; - i486*) - gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486" - gcc_cflags_arch="-march=i486" - ;; - i586 | pentium) - gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486" - gcc_cflags_arch="-march=pentium" - ;; - pentiummmx) - gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486" - gcc_cflags_arch="-march=pentium-mmx -march=pentium" - ;; - i686 | pentiumpro) - gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=pentiumpro -march=pentium" - ;; - pentium2) - gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium" - ;; - pentium3 | pentiumm) - gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium" - ;; - k6) - gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486" - gcc_cflags_arch="-march=k6" - ;; - k62) - gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486" - gcc_cflags_arch="-march=k6-2 -march=k6" - ;; - k63) - gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486" - gcc_cflags_arch="-march=k6-3 -march=k6" - ;; - geode) - gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486" - gcc_cflags_arch="-march=k6-3 -march=k6" - ;; - athlon) - # Athlon instruction costs are close to P6 (3 cycle load latency, - # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't - # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro. - gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium" - ;; - i786 | pentium4) - # pentiumpro is the primary fallback when gcc doesn't know pentium4. - # This gets us cmov to eliminate branches. Maybe "athlon" would be - # a possibility on gcc 3.0. - # - gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium" - ;; - viac32) - # Not sure of the best fallbacks here for -mcpu. - # c3-2 has sse and mmx, so pentium3 is good for -march. - gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486" - gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium" - ;; - viac3*) - # Not sure of the best fallbacks here. - gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486" - gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium" - ;; - athlon64 | x86_64) - gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486" - gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium" - ;; - core2) - gcc_cflags_cpu="-mtune=core2 -mtune=k8" - gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" - ;; - *) - gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486" - gcc_cflags_arch="-march=i486" - ;; - esac - - case $host_cpu in - i386*) path="x86" ;; - i486*) path="x86/i486 x86" ;; - i586 | pentium) path="x86/pentium x86" ;; - pentiummmx) path="x86/pentium/mmx x86/pentium x86" ;; - i686 | pentiumpro) path="x86/p6 x86" ;; - pentium2) path="x86/p6/mmx x86/p6 x86" ;; - pentium3) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";; - pentiumm | core2) path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86";; - k6[23]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;; - k6) path="x86/k6/mmx x86/k6 x86" ;; - geode) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;; - # we don't have any specific 32-bit code for athlon64/opteron, the - # athlon code should be reasonable - athlon | athlon64) path="x86/k7/mmx x86/k7 x86" ;; - i786 | pentium4) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;; - # VIA/Centaur processors, sold as CyrixIII and C3. - viac32) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";; - viac3*) path="x86/pentium/mmx x86/pentium x86";; - *) path="x86" ;; - esac - - # If the user asked for a fat build, override the path and flags set above - if test $enable_fat = yes; then - gcc_cflags_cpu="" - gcc_cflags_arch="" - extra_functions="$extra_functions fat fat_entry" - path="x86/fat x86" - fat_path="x86 x86/fat x86/i486 - x86/k6 x86/k6/mmx x86/k6/k62mmx - x86/k7 x86/k7/mmx - x86/pentium x86/pentium/mmx - x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2 - x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2" - fat_functions="add_n addmul_1 copyd copyi - dive_1 diveby3 divrem_1 gcd_1 lshift - mod_1 mod_34lsub1 mode1o mul_1 mul_basecase - pre_divrem_1 pre_mod_1 rshift - sqr_basecase sub_n submul_1" - fat_thresholds="MUL_KARATSUBA_THRESHOLD MUL_TOOM3_THRESHOLD - SQR_KARATSUBA_THRESHOLD SQR_TOOM3_THRESHOLD" - fi - - case $host_cpu in - athlon64 | atom | core2 | pentium4 | x86_64) - cclist_64="gcc" - gcc_64_cflags="$gcc_64_cflags -m64" - gcc_64_cflags_optlist="cpu" - CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo' - SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo - cyclecounter_size_64=2 - - case $host in - *-*-solaris*) - # Sun cc. - cclist_64="$cclist_64 cc" - cc_64_cflags="-xO3 -m64" - ;; - esac - - case $host_cpu in - athlon64 | x86_64) - abilist="64 32" - path_64="x86_64" - ;; - pentium4) - abilist="64 32" - path_64="x86_64/pentium4 x86_64" - ;; - core2) - abilist="64 32" - path_64="x86_64/core2 x86_64" - ;; - atom) - # The AMD K8/K9/K10 code seems best for Intel Atom - abilist="64 32" - path_64="x86_64/atom x86_64" - ;; - esac - ;; - esac - ;; - - - # FIXME: z8kx won't get through config.sub. Could make 16 versus 32 bit - # limb an ABI option perhaps. - z8kx*-*-*) - path="z8000x" - extra_functions="udiv_w_sdiv" - ;; - z8k*-*-*) - path="z8000" - extra_functions="udiv_w_sdiv" - ;; - - - # Special CPU "none" selects generic C. -DNO_ASM is used to disable gcc - # asm blocks in longlong.h (since they're driven by cpp pre-defined - # symbols like __alpha rather than the configured $host_cpu). - # - none-*-*) - abilist="long longlong" - cclist_long=$cclist - gcc_long_cflags=$gcc_cflags - gcc_long_cppflags="-DNO_ASM" - cc_long_cflags=$cc_cflags - cclist_longlong=$cclist - gcc_longlong_cflags=$gcc_cflags - gcc_longlong_cppflags="-DNO_ASM" - cc_longlong_cflags=$cc_cflags - limb_longlong=longlong - ;; - -esac - -# mingw can be built by the cygwin gcc if -mno-cygwin is added. For -# convenience add this automatically if it works. Actual mingw gcc accepts -# -mno-cygwin too, but of course is the default. mingw only runs on the -# x86s, but allow any CPU here so as to catch "none" too. -# -case $host in - *-*-mingw*) - gcc_cflags_optlist="$gcc_cflags_optlist nocygwin" - gcc_cflags_nocygwin="-mno-cygwin" - ;; -esac - - -CFLAGS_or_unset=${CFLAGS-'(unset)'} -CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'} - -cat >&5 <&5 -echo "$as_me: error: ABI=$ABI is not among the following valid choices: $abilist" >&2;} - { (exit 1); exit 1; }; } - fi - abilist="$ABI" -fi - -found_compiler=no - -for abi in $abilist; do - - echo "checking ABI=$abi" - - # Suppose abilist="64 32", then for abi=64, will have abi1="_64" and - # abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how - # $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the - # abilist), but there's no fallback for $gcc_64_cflags. - # - abi1=`echo _$abi | sed 's/[.]//g'` - if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi - - # Compiler choices under this ABI - eval cclist_chosen=\"\$cclist$abi1\" - test -n "$cclist_chosen" || eval cclist_chosen=\"\$cclist$abi2\" - - # If there's a user specified $CC then don't use a list for - # $cclist_chosen, just a single value for $ccbase. - # - if test -n "$CC"; then - - # The first word of $CC, stripped of any directory. For instance - # CC="/usr/local/bin/gcc -pipe" will give "gcc". - # - for ccbase in $CC; do break; done - ccbase=`echo $ccbase | sed 's:.*/::'` - - # If this $ccbase is in $cclist_chosen then it's a compiler we know and - # we can do flags defaulting with it. If not, then $cclist_chosen is - # set to "unrecognised" so no default flags are used. - # - # "unrecognised" is used to avoid bad effects with eval if $ccbase has - # non-symbol characters. For instance ccbase=my+cc would end up with - # something like cflags="$my+cc_cflags" which would give - # cflags="+cc_cflags" rather than the intended empty string for an - # unknown compiler. - # - found=unrecognised - for i in $cclist_chosen; do - if test "$ccbase" = $i; then - found=$ccbase - break - fi - done - cclist_chosen=$found - fi - - for ccbase in $cclist_chosen; do - - # When cross compiling, look for a compiler with the $host_alias as a - # prefix, the same way that AC_CHECK_TOOL does. But don't do this to a - # user-selected $CC. - # - # $cross_compiling will be yes/no/maybe at this point. Do the host - # prefixing for "maybe" as well as "yes". - # - if test "$cross_compiling" != no && test -z "$CC"; then - cross_compiling_prefix="${host_alias}-" - fi - - for ccprefix in $cross_compiling_prefix ""; do - - cc="$CC" - test -n "$cc" || cc="$ccprefix$ccbase" - - # If the compiler is gcc but installed under another name, then change - # $ccbase so as to use the flags we know for gcc. This helps for - # instance when specifying CC=gcc272 on Debian GNU/Linux, or the - # native cc which is really gcc on NeXT or MacOS-X. - # - # FIXME: There's a slight misfeature here. If cc is actually gcc but - # gcc is not a known compiler under this $abi then we'll end up - # testing it with no flags and it'll work, but chances are it won't be - # in the right mode for the ABI we desire. Let's quietly hope this - # doesn't happen. - # - if test $ccbase != gcc; then - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - rm -f conftest* - { echo "$as_me:$LINENO: checking whether $cc is gcc" >&5 -echo $ECHO_N "checking whether $cc is gcc... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - ccbase=gcc -else - rm -f conftest* - : -fi - - fi - - # Similarly if the compiler is IBM xlc but invoked as cc or whatever - # then change $ccbase and make the default xlc flags available. - if test $ccbase != xlc; then - gmp_command="$cc 2>&1 | grep xlc >/dev/null" -if { (eval echo "$as_me:$LINENO: \"$gmp_command\"") >&5 - (eval $gmp_command) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - { echo "$as_me:$LINENO: checking whether $cc is xlc" >&5 -echo $ECHO_N "checking whether $cc is xlc... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - ccbase=xlc -else - : -fi - - fi - - # acc was Sun's first unbundled compiler back in the SunOS days, or - # something like that, but today its man page says it's not meant to - # be used directly (instead via /usr/ucb/cc). The options are pretty - # much the same as the main SunPRO cc, so share those configs. - # - case $host in - *sparc*-*-solaris* | *sparc*-*-sunos*) - if test "$ccbase" = acc; then ccbase=cc; fi ;; - esac - - for tmp_cflags_maybe in yes no; do - eval cflags=\"\$${ccbase}${abi1}_cflags\" - test -n "$cflags" || eval cflags=\"\$${ccbase}${abi2}_cflags\" - - if test "$tmp_cflags_maybe" = yes; then - # don't try cflags_maybe when the user set CFLAGS - if test "$test_CFLAGS" = set; then continue; fi - eval cflags_maybe=\"\$${ccbase}${abi1}_cflags_maybe\" - test -n "$cflags_maybe" || eval cflags_maybe=\"\$${ccbase}${abi2}_cflags_maybe\" - # don't try cflags_maybe if there's nothing set - if test -z "$cflags_maybe"; then continue; fi - cflags="$cflags_maybe $cflags" - fi - - # Any user CFLAGS, even an empty string, takes precendence - if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi - - # Any user CPPFLAGS, even an empty string, takes precendence - eval cppflags=\"\$${ccbase}${abi1}_cppflags\" - test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\" - if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi - - # --enable-profiling adds -p/-pg even to user-specified CFLAGS. - # This is convenient, but it's perhaps a bit naughty to modify user - # CFLAGS. - case "$enable_profiling" in - prof) cflags="$cflags -p" ;; - gprof) cflags="$cflags -pg" ;; - instrument) cflags="$cflags -finstrument-functions" ;; - esac - - { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags" >&5 -echo $ECHO_N "checking compiler $cc $cflags $cppflags... $ECHO_C" >&6; } -gmp_prog_cc_works=yes - -# first see a simple "main()" works, then go on to other checks -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no" - ;; - norun) - gmp_prog_cc_works="no, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, function pointer return" - ;; - norun) - gmp_prog_cc_works="no, function pointer return, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <= 0 ? n : 0); } - -int main () { return 0; } -EOF - echo "Test compile: cmov instruction" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, cmov instruction" - ;; - norun) - gmp_prog_cc_works="no, cmov instruction, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < uint64 conversion). */ -double d; -unsigned long gcc303 () { return (unsigned long) d; } - -int main () { return 0; } -EOF - echo "Test compile: double -> ulong conversion" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double -> ulong conversion" - ;; - norun) - gmp_prog_cc_works="no, double -> ulong conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double negation" - ;; - norun) - gmp_prog_cc_works="no, double negation, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < float conversion" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double -> float conversion" - ;; - norun) - gmp_prog_cc_works="no, double -> float conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < /* for memcpy */ -struct try_t -{ - char dst[2]; - char size; - long d0, d1, d2, d3, d4, d5, d6; - char overlap; -}; -struct try_t param[6]; -int -param_init () -{ - struct try_t *p; - memcpy (p, ¶m[ 2 ], sizeof (*p)); - memcpy (p, ¶m[ 2 ], sizeof (*p)); - p->size = 2; - memcpy (p, ¶m[ 1 ], sizeof (*p)); - p->dst[0] = 1; - p->overlap = 2; - memcpy (p, ¶m[ 3 ], sizeof (*p)); - p->dst[0] = 1; - p->overlap = 8; - memcpy (p, ¶m[ 4 ], sizeof (*p)); - memcpy (p, ¶m[ 4 ], sizeof (*p)); - p->overlap = 8; - memcpy (p, ¶m[ 5 ], sizeof (*p)); - memcpy (p, ¶m[ 5 ], sizeof (*p)); - memcpy (p, ¶m[ 5 ], sizeof (*p)); - return 0; -} - -int main () { return 0; } -EOF - echo "Test compile: gnupro alpha ev6 char spilling" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, gnupro alpha ev6 char spilling" - ;; - norun) - gmp_prog_cc_works="no, gnupro alpha ev6 char spilling, program does not run" - ;; - esac -fi - - - - -# __builtin_alloca is not available everywhere, check it exists before -# seeing that it works -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, alloca array" - ;; - norun) - gmp_prog_cc_works="no, alloca array, program does not run" - ;; - esac -fi - - - - ;; - no) - - ;; - norun) - - ;; - esac -fi - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <= 0 ? x : -x); - return a * fp[0]; -} - -int main () { return 0; } -EOF - echo "Test compile: abs int -> double conversion" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, abs int -> double conversion" - ;; - norun) - gmp_prog_cc_works="no, abs int -> double conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, long long reliability test 1" - ;; - norun) - gmp_prog_cc_works="no, long long reliability test 1, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, long long reliability test 2" - ;; - norun) - gmp_prog_cc_works="no, long long reliability test 2, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <> tnc; - high_limb = low_limb << cnt; - for (i = n - 1; i != 0; i--) - { - low_limb = *up++; - *rp++ = ~(high_limb | (low_limb >> tnc)); - high_limb = low_limb << cnt; - } - return retval; -} -int -main () -{ - unsigned long cy, rp[2], up[2]; - up[0] = ~ 0L; - up[1] = 0; - cy = lshift_com (rp, up, 2L, 1); - if (cy != 1L) - return 1; - return 0; -} -#else -int -main () -{ - return 0; -} -#endif - -EOF - echo "Test compile: mpn_lshift_com optimization" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, mpn_lshift_com optimization" - ;; - norun) - gmp_prog_cc_works="no, mpn_lshift_com optimization, program does not run" - ;; - esac -fi - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < -void -lshift_com (rp, up, n, cnt) - unsigned long *rp; - unsigned long *up; - long n; - unsigned cnt; -{ - unsigned long high_limb, low_limb; - unsigned tnc; - long i; - up += n; - rp += n; - tnc = 8 * sizeof (unsigned long) - cnt; - low_limb = *--up; - high_limb = low_limb << cnt; - for (i = n - 1; i != 0; i--) - { - low_limb = *--up; - *--rp = ~(high_limb | (low_limb >> tnc)); - high_limb = low_limb << cnt; - } - *--rp = ~high_limb; -} -int -main () -{ - unsigned long *r, *r2; - unsigned long a[88 + 1]; - long i; - for (i = 0; i < 88 + 1; i++) - a[i] = ~0L; - r = malloc (10000 * sizeof (unsigned long)); - r2 = r; - for (i = 0; i < 528; i += 22) - { - lshift_com (r2, a, - i / (8 * sizeof (unsigned long)) + 1, - i % (8 * sizeof (unsigned long))); - r2 += 88 + 1; - } - if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 || - r[2052] != 0 || r[2053] != 0 || r[2054] != 0) - abort (); - return 0; -} -#else -int -main () -{ - return 0; -} -#endif - -EOF - echo "Test compile: mpn_lshift_com optimization 2" >&5 - gmp_compile="$cc $cflags $cppflags conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, mpn_lshift_com optimization 2" - ;; - norun) - gmp_prog_cc_works="no, mpn_lshift_com optimization 2, program does not run" - ;; - esac -fi - - - - -# A certain _GLOBAL_OFFSET_TABLE_ problem in past versions of gas, tickled -# by recent versions of gcc. -# -if test "$gmp_prog_cc_works" = yes; then - case $host in - i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-*) - # this problem only arises in PIC code, so don't need to test when - # --disable-shared. We don't necessarily have $enable_shared set to - # yes at this point, it will still be unset for the default (which is - # yes); hence the use of "!= no". - if test "$enable_shared" != no; then - echo "Testing gcc GOT with eax emitted" >&5 -cat >conftest.c <<\EOF -int foo; -int bar () { return foo; } -EOF -tmp_got_emitted=no -gmp_compile="$cc $cflags $cppflags -fPIC -S conftest.c >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep "addl.*_GLOBAL_OFFSET_TABLE_.*eax" conftest.s >/dev/null; then - tmp_got_emitted=yes - fi -fi -rm -f conftest.* -echo "Result: $tmp_got_emitted" >&5 -if test "$tmp_got_emitted" = yes; then - echo "Testing gas GOT with eax good" >&5 -cat >conftest.awk <<\EOF -BEGIN { - want[0] = "001" - want[1] = "043" - want[2] = "105" - want[3] = "147" - want[4] = "211" - want[5] = "253" - want[6] = "315" - want[7] = "357" - - want[8] = "005" - want[9] = "002" - want[10] = "000" - want[11] = "000" - want[12] = "000" - - want[13] = "376" - want[14] = "334" - want[15] = "272" - want[16] = "230" - want[17] = "166" - want[18] = "124" - want[19] = "062" - want[20] = "020" - - result = "yes" -} -{ - for (f = 2; f <= NF; f++) - { - for (i = 0; i < 20; i++) - got[i] = got[i+1]; - got[20] = $f; - - found = 1 - for (i = 0; i < 21; i++) - if (got[i] != want[i]) - { - found = 0 - break - } - if (found) - { - result = "no" - exit - } - } -} -END { - print result -} -EOF -cat >conftest.s <<\EOF - .text - .byte 1, 35, 69, 103, 137, 171, 205, 239 - addl $_GLOBAL_OFFSET_TABLE_, %eax - .byte 254, 220, 186, 152, 118, 84, 50, 16 -EOF -tmp_got_good=yes -gmp_compile="$cc $cflags $cppflags -fPIC -o conftest.o -c conftest.s >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - tmp_got_good=`od -b conftest.o | $AWK -f conftest.awk` -fi -rm -f conftest.* -echo "Result: $tmp_got_good" >&5 -if test "$tmp_got_good" = no; then - gmp_prog_cc_works="no, bad gas GOT with eax" -else - : -fi - -else - : -fi - - fi - ;; - esac -fi - -{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5 -echo "${ECHO_T}$gmp_prog_cc_works" >&6; } -case $gmp_prog_cc_works in - yes) - - ;; - *) - continue - ;; -esac - - - # If we're supposed to be using a "long long" for a limb, check that - # it works. - eval limb_chosen=\"\$limb$abi1\" - test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\" - if test "$limb_chosen" = longlong; then - { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags has long long" >&5 -echo $ECHO_N "checking compiler $cc $cflags $cppflags has long long... $ECHO_C" >&6; } -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - gmp_prog_cc_works=yes -else - echo "failed program was:" >&5 - cat conftest.c >&5 -fi -rm -f conftest* a.out b.out a.exe a_out.exe -{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5 -echo "${ECHO_T}$gmp_prog_cc_works" >&6; } -if test $gmp_prog_cc_works = yes; then - : -else - continue -fi - - fi - - # The tests to perform on this $cc, if any - eval testlist=\"\$${ccbase}${abi1}_testlist\" - test -n "$testlist" || eval testlist=\"\$${ccbase}${abi2}_testlist\" - test -n "$testlist" || eval testlist=\"\$any${abi1}_testlist\" - test -n "$testlist" || eval testlist=\"\$any${abi2}_testlist\" - - testlist_pass=yes - for tst in $testlist; do - case $tst in - hpc-hppa-2-0) { echo "$as_me:$LINENO: checking whether HP compiler $cc is good for 64-bits" >&5 -echo $ECHO_N "checking whether HP compiler $cc is good for 64-bits... $ECHO_C" >&6; } -# Bad compiler output: -# ccom: HP92453-01 G.10.32.05 HP C Compiler -# Good compiler output: -# ccom: HP92453-01 A.10.32.30 HP C Compiler -# Let A.10.32.30 or higher be ok. -echo >conftest.c -gmp_tmp_vs=`$cc -V -c -o conftest.$OBJEXT conftest.c 2>&1 | grep "^ccom:"` -echo "Version string: $gmp_tmp_vs" >&5 -rm conftest* -gmp_tmp_v1=`echo $gmp_tmp_vs | sed 's/.* .\.\([0-9]*\).*/\1/'` -gmp_tmp_v2=`echo $gmp_tmp_vs | sed 's/.* .\..*\.\(.*\)\..* HP C.*/\1/'` -gmp_tmp_v3=`echo $gmp_tmp_vs | sed 's/.* .\..*\..*\.\(.*\) HP C.*/\1/'` -echo "Version number: $gmp_tmp_v1.$gmp_tmp_v2.$gmp_tmp_v3" >&5 -if test -z "$gmp_tmp_v1"; then - gmp_hpc_64bit=not-applicable -else - gmp_compare_ge=no -if test -n "$gmp_tmp_v1"; then - if test "$gmp_tmp_v1" -gt 10; then - gmp_compare_ge=yes - else - if test "$gmp_tmp_v1" -eq 10; then - if test -n "$gmp_tmp_v2"; then - if test "$gmp_tmp_v2" -gt 32; then - gmp_compare_ge=yes - else - if test "$gmp_tmp_v2" -eq 32; then - if test -n "$gmp_tmp_v3" && test "$gmp_tmp_v3" -ge 30; then - gmp_compare_ge=yes -fi - - fi - fi -fi - - fi - fi -fi - - - gmp_hpc_64bit=$gmp_compare_ge -fi -{ echo "$as_me:$LINENO: result: $gmp_hpc_64bit" >&5 -echo "${ECHO_T}$gmp_hpc_64bit" >&6; } -if test $gmp_hpc_64bit = yes; then - : -else - testlist_pass=no -fi - ;; - gcc-arm-umodsi) { echo "$as_me:$LINENO: checking whether ARM gcc unsigned division works" >&5 -echo $ECHO_N "checking whether ARM gcc unsigned division works... $ECHO_C" >&6; } -tmp_version=`$cc --version` -echo "$tmp_version" >&5 -case $tmp_version in - 2.95 | 2.95.[123]) - testlist_pass=no - gmp_gcc_arm_umodsi_result="no, gcc 2.95.[0123]" ;; - *) - : - gmp_gcc_arm_umodsi_result=yes ;; -esac -{ echo "$as_me:$LINENO: result: $gmp_gcc_arm_umodsi_result" >&5 -echo "${ECHO_T}$gmp_gcc_arm_umodsi_result" >&6; } - ;; - gcc-mips-o32) { echo "$as_me:$LINENO: checking whether gcc supports o32" >&5 -echo $ECHO_N "checking whether gcc supports o32... $ECHO_C" >&6; } -echo 'int x;' >conftest.c -echo "$cc -mabi=32 -c conftest.c" >&5 -if $cc -mabi=32 -c conftest.c >conftest.out 2>&1; then - result=yes -else - cat conftest.out >&5 - if grep "cc1: Invalid option \`abi=32'" conftest.out >/dev/null; then - result=yes - else - result=no - fi -fi -rm -f conftest.* -{ echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } -if test $result = yes; then - : -else - testlist_pass=no -fi - ;; - hppa-level-2.0) { echo "$as_me:$LINENO: checking $cc $cflags assembler knows hppa 2.0" >&5 -echo $ECHO_N "checking $cc $cflags assembler knows hppa 2.0... $ECHO_C" >&6; } -result=no -cat >conftest.s <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - result=yes -else - echo "failed program was" >&5 - cat conftest.s >&5 -fi -rm -f conftest* -{ echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } -if test "$result" = yes; then - : -else - testlist_pass=no -fi - ;; - sizeof*) echo "configure: testlist $tst" >&5 -gmp_sizeof_type=`echo "$tst" | sed 's/sizeof-\([a-z]*\).*/\1/'` -gmp_sizeof_want=`echo "$tst" | sed 's/sizeof-[a-z]*-\([0-9]*\).*/\1/'` -{ echo "$as_me:$LINENO: checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want" >&5 -echo $ECHO_N "checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want... $ECHO_C" >&6; } -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - gmp_c_testlist_sizeof=yes -fi -rm -f conftest* -{ echo "$as_me:$LINENO: result: $gmp_c_testlist_sizeof" >&5 -echo "${ECHO_T}$gmp_c_testlist_sizeof" >&6; } -if test $gmp_c_testlist_sizeof = yes; then - : -else - testlist_pass=no -fi - ;; - esac - if test $testlist_pass = no; then break; fi - done - - if test $testlist_pass = yes; then - found_compiler=yes - break - fi - done - - if test $found_compiler = yes; then break; fi - done - - if test $found_compiler = yes; then break; fi - done - - if test $found_compiler = yes; then break; fi -done - - -# If we recognised the CPU, as indicated by $path being set, then insist -# that we have a working compiler, either from our $cclist choices or from -# $CC. We can't let AC_PROG_CC look around for a compiler because it might -# find one that we've rejected (for not supporting the modes our asm code -# demands, etc). -# -# If we didn't recognise the CPU (and this includes host_cpu=none), then -# fall through and let AC_PROG_CC look around for a compiler too. This is -# mostly in the interests of following a standard autoconf setup, after all -# we've already tested cc and gcc adequately (hopefully). As of autoconf -# 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft -# C on MS-DOS systems). -# -if test $found_compiler = no && test -n "$path"; then - { { echo "$as_me:$LINENO: error: could not find a working compiler, see config.log for details" >&5 -echo "$as_me: error: could not find a working compiler, see config.log for details" >&2;} - { (exit 1); exit 1; }; } -fi - - -if test $found_compiler = yes; then - - # If we're creating CFLAGS, then look for optional additions. If the user - # set CFLAGS then leave it alone. - # - if test "$test_CFLAGS" != set; then - eval optlist=\"\$${ccbase}${abi1}_cflags_optlist\" - test -n "$optlist" || eval optlist=\"\$${ccbase}${abi2}_cflags_optlist\" - - for opt in $optlist; do - eval optflags=\"\$${ccbase}${abi1}_cflags_${opt}\" - test -n "$optflags" || eval optflags=\"\$${ccbase}${abi2}_cflags_${opt}\" - test -n "$optflags" || eval optflags=\"\$${ccbase}_cflags_${opt}\" - - for flag in $optflags; do - - # ~ represents a space in an option spec - flag=`echo "$flag" | tr '~' ' '` - - case $flag in - -march=pentium4 | -march=k8) - # For -march settings which enable SSE2 we exclude certain bad - # gcc versions and we need an OS knowing how to save xmm regs. - # - # This is only for ABI=32, any 64-bit gcc is good and any OS - # knowing x86_64 will know xmm. - # - # -march=k8 was only introduced in gcc 3.3, so we shouldn't need - # the GMP_GCC_PENTIUM4_SSE2 check (for gcc 3.2 and prior). But - # it doesn't hurt to run it anyway, sharing code with the - # pentium4 case. - # - if test "$abi" = 32; then - { echo "$as_me:$LINENO: checking whether gcc is good for sse2" >&5 -echo $ECHO_N "checking whether gcc is good for sse2... $ECHO_C" >&6; } -case `$cc $cflags $cppflags -dumpversion` in - 3.[012] | 3.[012].*) result=no ;; - *) result=yes ;; -esac -{ echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } -if test "$result" = yes; then - : -else - continue -fi - - { echo "$as_me:$LINENO: checking whether the operating system supports XMM registers" >&5 -echo $ECHO_N "checking whether the operating system supports XMM registers... $ECHO_C" >&6; } -if test "${gmp_cv_os_x86_xmm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$build" = "$host"; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.s <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gmp_cv_os_x86_xmm=yes - else - gmp_cv_os_x86_xmm=no - fi - else - { echo "$as_me:$LINENO: WARNING: Oops, cannot compile test program" >&5 -echo "$as_me: WARNING: Oops, cannot compile test program" >&2;} - fi - rm -f conftest* -fi - -if test -z "$gmp_cv_os_x86_xmm"; then - case $host_os in - freebsd[123] | freebsd[123].*) - gmp_cv_os_x86_xmm=no ;; - freebsd*) - gmp_cv_os_x86_xmm=yes ;; - *) - gmp_cv_os_x86_xmm=probably ;; - esac -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_os_x86_xmm" >&5 -echo "${ECHO_T}$gmp_cv_os_x86_xmm" >&6; } - -if test "$gmp_cv_os_x86_xmm" = probably; then - { echo "$as_me:$LINENO: WARNING: Not certain of OS support for xmm when cross compiling." >&5 -echo "$as_me: WARNING: Not certain of OS support for xmm when cross compiling." >&2;} - { echo "$as_me:$LINENO: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&5 -echo "$as_me: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&2;} -fi - -case $gmp_cv_os_x86_xmm in -no) - continue - ;; -*) - - ;; -esac - - fi - ;; - -no-cpp-precomp) - # special check, avoiding a warning - if test "$ccbase" = gcc; then - { echo "$as_me:$LINENO: checking compiler $cc $cflags -no-cpp-precomp" >&5 -echo $ECHO_N "checking compiler $cc $cflags -no-cpp-precomp... $ECHO_C" >&6; } - result=no - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep "unrecognized option.*-no-cpp-precomp" conftest.out >/dev/null; then : ; - else - result=yes - fi - fi - cat conftest.out >&5 - rm -f conftest* a.out b.out a.exe a_out.exe - { echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } - if test "$result" = yes; then - cflags="$cflags $flag" - break - else - continue - fi -fi - - ;; - -Wa,-m*) - case $host in - alpha*-*-*) - { echo "$as_me:$LINENO: checking assembler $cc $cflags $flag" >&5 -echo $ECHO_N "checking assembler $cc $cflags $flag... $ECHO_C" >&6; } -result=no -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep "Unknown CPU identifier" conftest.out >/dev/null; then : ; - else - result=yes - fi -fi -cat conftest.out >&5 -rm -f conftest* -{ echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } -if test "$result" = yes; then - : -else - continue -fi - - ;; - esac - ;; - -Wa,-oldas) - { echo "$as_me:$LINENO: checking for $cc $cflags $cppflags -Wa,-oldas" >&5 -echo $ECHO_N "checking for $cc $cflags $cppflags -Wa,-oldas... $ECHO_C" >&6; } -result=no -cat >conftest.c <&5 -gmp_compile="$cc $cflags $cppflags -c conftest.c >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : ; -else - # empty fails - gmp_compile="$cc $cflags $cppflags -Wa,-oldas -c conftest.c >&5 2>&1" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # but with -Wa,-oldas it works - result=yes - fi -fi -rm -f conftest* -{ echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6; } -if test "$result" = yes; then - cflags="$cflags $flag" - break -else - continue -fi - - ;; - esac - - { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags $flag" >&5 -echo $ECHO_N "checking compiler $cc $cflags $cppflags $flag... $ECHO_C" >&6; } -gmp_prog_cc_works=yes - -# first see a simple "main()" works, then go on to other checks -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no" - ;; - norun) - gmp_prog_cc_works="no, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, function pointer return" - ;; - norun) - gmp_prog_cc_works="no, function pointer return, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <= 0 ? n : 0); } - -int main () { return 0; } -EOF - echo "Test compile: cmov instruction" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, cmov instruction" - ;; - norun) - gmp_prog_cc_works="no, cmov instruction, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < uint64 conversion). */ -double d; -unsigned long gcc303 () { return (unsigned long) d; } - -int main () { return 0; } -EOF - echo "Test compile: double -> ulong conversion" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double -> ulong conversion" - ;; - norun) - gmp_prog_cc_works="no, double -> ulong conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double negation" - ;; - norun) - gmp_prog_cc_works="no, double negation, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < float conversion" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, double -> float conversion" - ;; - norun) - gmp_prog_cc_works="no, double -> float conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < /* for memcpy */ -struct try_t -{ - char dst[2]; - char size; - long d0, d1, d2, d3, d4, d5, d6; - char overlap; -}; -struct try_t param[6]; -int -param_init () -{ - struct try_t *p; - memcpy (p, ¶m[ 2 ], sizeof (*p)); - memcpy (p, ¶m[ 2 ], sizeof (*p)); - p->size = 2; - memcpy (p, ¶m[ 1 ], sizeof (*p)); - p->dst[0] = 1; - p->overlap = 2; - memcpy (p, ¶m[ 3 ], sizeof (*p)); - p->dst[0] = 1; - p->overlap = 8; - memcpy (p, ¶m[ 4 ], sizeof (*p)); - memcpy (p, ¶m[ 4 ], sizeof (*p)); - p->overlap = 8; - memcpy (p, ¶m[ 5 ], sizeof (*p)); - memcpy (p, ¶m[ 5 ], sizeof (*p)); - memcpy (p, ¶m[ 5 ], sizeof (*p)); - return 0; -} - -int main () { return 0; } -EOF - echo "Test compile: gnupro alpha ev6 char spilling" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, gnupro alpha ev6 char spilling" - ;; - norun) - gmp_prog_cc_works="no, gnupro alpha ev6 char spilling, program does not run" - ;; - esac -fi - - - - -# __builtin_alloca is not available everywhere, check it exists before -# seeing that it works -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, alloca array" - ;; - norun) - gmp_prog_cc_works="no, alloca array, program does not run" - ;; - esac -fi - - - - ;; - no) - - ;; - norun) - - ;; - esac -fi - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <= 0 ? x : -x); - return a * fp[0]; -} - -int main () { return 0; } -EOF - echo "Test compile: abs int -> double conversion" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, abs int -> double conversion" - ;; - norun) - gmp_prog_cc_works="no, abs int -> double conversion, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, long long reliability test 1" - ;; - norun) - gmp_prog_cc_works="no, long long reliability test 1, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, long long reliability test 2" - ;; - norun) - gmp_prog_cc_works="no, long long reliability test 2, program does not run" - ;; - esac -fi - - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c <> tnc; - high_limb = low_limb << cnt; - for (i = n - 1; i != 0; i--) - { - low_limb = *up++; - *rp++ = ~(high_limb | (low_limb >> tnc)); - high_limb = low_limb << cnt; - } - return retval; -} -int -main () -{ - unsigned long cy, rp[2], up[2]; - up[0] = ~ 0L; - up[1] = 0; - cy = lshift_com (rp, up, 2L, 1); - if (cy != 1L) - return 1; - return 0; -} -#else -int -main () -{ - return 0; -} -#endif - -EOF - echo "Test compile: mpn_lshift_com optimization" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, mpn_lshift_com optimization" - ;; - norun) - gmp_prog_cc_works="no, mpn_lshift_com optimization, program does not run" - ;; - esac -fi - - - -if test "$gmp_prog_cc_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.c < -void -lshift_com (rp, up, n, cnt) - unsigned long *rp; - unsigned long *up; - long n; - unsigned cnt; -{ - unsigned long high_limb, low_limb; - unsigned tnc; - long i; - up += n; - rp += n; - tnc = 8 * sizeof (unsigned long) - cnt; - low_limb = *--up; - high_limb = low_limb << cnt; - for (i = n - 1; i != 0; i--) - { - low_limb = *--up; - *--rp = ~(high_limb | (low_limb >> tnc)); - high_limb = low_limb << cnt; - } - *--rp = ~high_limb; -} -int -main () -{ - unsigned long *r, *r2; - unsigned long a[88 + 1]; - long i; - for (i = 0; i < 88 + 1; i++) - a[i] = ~0L; - r = malloc (10000 * sizeof (unsigned long)); - r2 = r; - for (i = 0; i < 528; i += 22) - { - lshift_com (r2, a, - i / (8 * sizeof (unsigned long)) + 1, - i % (8 * sizeof (unsigned long))); - r2 += 88 + 1; - } - if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 || - r[2052] != 0 || r[2053] != 0 || r[2054] != 0) - abort (); - return 0; -} -#else -int -main () -{ - return 0; -} -#endif - -EOF - echo "Test compile: mpn_lshift_com optimization 2" >&5 - gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cc_works_part=yes - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - cc_works_part=norun - fi - fi - else - cc_works_part=no - fi - if test "$cc_works_part" != yes; then - echo "failed program was:" >&5 - cat conftest.c >&5 - fi - rm -f conftest* a.out b.out a.exe a_out.exe - case $cc_works_part in - yes) - - ;; - no) - gmp_prog_cc_works="no, mpn_lshift_com optimization 2" - ;; - norun) - gmp_prog_cc_works="no, mpn_lshift_com optimization 2, program does not run" - ;; - esac -fi - - - - -# A certain _GLOBAL_OFFSET_TABLE_ problem in past versions of gas, tickled -# by recent versions of gcc. -# -if test "$gmp_prog_cc_works" = yes; then - case $host in - i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-*) - # this problem only arises in PIC code, so don't need to test when - # --disable-shared. We don't necessarily have $enable_shared set to - # yes at this point, it will still be unset for the default (which is - # yes); hence the use of "!= no". - if test "$enable_shared" != no; then - echo "Testing gcc GOT with eax emitted" >&5 -cat >conftest.c <<\EOF -int foo; -int bar () { return foo; } -EOF -tmp_got_emitted=no -gmp_compile="$cc $cflags $cppflags $flag -fPIC -S conftest.c >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep "addl.*_GLOBAL_OFFSET_TABLE_.*eax" conftest.s >/dev/null; then - tmp_got_emitted=yes - fi -fi -rm -f conftest.* -echo "Result: $tmp_got_emitted" >&5 -if test "$tmp_got_emitted" = yes; then - echo "Testing gas GOT with eax good" >&5 -cat >conftest.awk <<\EOF -BEGIN { - want[0] = "001" - want[1] = "043" - want[2] = "105" - want[3] = "147" - want[4] = "211" - want[5] = "253" - want[6] = "315" - want[7] = "357" - - want[8] = "005" - want[9] = "002" - want[10] = "000" - want[11] = "000" - want[12] = "000" - - want[13] = "376" - want[14] = "334" - want[15] = "272" - want[16] = "230" - want[17] = "166" - want[18] = "124" - want[19] = "062" - want[20] = "020" - - result = "yes" -} -{ - for (f = 2; f <= NF; f++) - { - for (i = 0; i < 20; i++) - got[i] = got[i+1]; - got[20] = $f; - - found = 1 - for (i = 0; i < 21; i++) - if (got[i] != want[i]) - { - found = 0 - break - } - if (found) - { - result = "no" - exit - } - } -} -END { - print result -} -EOF -cat >conftest.s <<\EOF - .text - .byte 1, 35, 69, 103, 137, 171, 205, 239 - addl $_GLOBAL_OFFSET_TABLE_, %eax - .byte 254, 220, 186, 152, 118, 84, 50, 16 -EOF -tmp_got_good=yes -gmp_compile="$cc $cflags $cppflags $flag -fPIC -o conftest.o -c conftest.s >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - tmp_got_good=`od -b conftest.o | $AWK -f conftest.awk` -fi -rm -f conftest.* -echo "Result: $tmp_got_good" >&5 -if test "$tmp_got_good" = no; then - gmp_prog_cc_works="no, bad gas GOT with eax" -else - : -fi - -else - : -fi - - fi - ;; - esac -fi - -{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5 -echo "${ECHO_T}$gmp_prog_cc_works" >&6; } -case $gmp_prog_cc_works in - yes) - cflags="$cflags $flag" - break - ;; - *) - - ;; -esac - - done - done - fi - - ABI="$abi" - CC="$cc" - CFLAGS="$cflags" - CPPFLAGS="$cppflags" - - - # Could easily have this in config.h too, if desired. - ABI_nodots=`echo $ABI | sed 's/\./_/'` - -echo "define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')" >> $gmp_tmpconfigm4p - - - - # GMP_LDFLAGS substitution, selected according to ABI. - # These are needed on libgmp.la and libmp.la, but currently not on - # convenience libraries like tune/libspeed.la or mpz/libmpz.la. - # - eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\" - test -n "$GMP_LDFLAGS" || eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\" - - - - - # extra_functions, selected according to ABI - eval tmp=\"\$extra_functions$abi1\" - test -n "$tmp" || eval tmp=\"\$extra_functions$abi2\" - extra_functions="$tmp" - - - # Cycle counter, selected according to ABI. - # - eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi1\" - test -n "$tmp" || eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi2\" - SPEED_CYCLECOUNTER_OBJ="$tmp" - eval tmp=\"\$cyclecounter_size$abi1\" - test -n "$tmp" || eval tmp=\"\$cyclecounter_size$abi2\" - cyclecounter_size="$tmp" - - if test -n "$SPEED_CYCLECOUNTER_OBJ"; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_SPEED_CYCLECOUNTER $cyclecounter_size -_ACEOF - - fi - - - - # Calling conventions checking, selected according to ABI. - # - eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\" - test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\" - CALLING_CONVENTIONS_OBJS="$tmp" - - if test -n "$CALLING_CONVENTIONS_OBJS"; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CALLING_CONVENTIONS 1 -_ACEOF - - fi - - -fi - - -# If the user gave an MPN_PATH, use that verbatim, otherwise choose -# according to the ABI and add "generic". -# -if test -n "$MPN_PATH"; then - path="$MPN_PATH" -else - eval tmp=\"\$path$abi1\" - test -n "$tmp" || eval tmp=\"\$path$abi2\" - path="$tmp generic" -fi - - -# Long long limb setup for gmp.h. -case $limb_chosen in -longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;; -*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;; -esac - - - -# The C compiler and preprocessor, put into ANSI mode if possible. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - case $ac_cv_prog_cc_stdc in - no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; - *) { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c99+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c99=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no -fi - - -fi - - ;; -esac - { echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5 -echo $ECHO_N "checking for $CC option to accept ISO Standard C... $ECHO_C" >&6; } - if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi - - case $ac_cv_prog_cc_stdc in - no) { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - '') { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - *) { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -case $ac_cv_prog_cc_stdc in - no) - ;; - *) - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - -#if ! __GMP_HAVE_PROTOTYPES -die die die -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise compiler as ANSI, prototypes and \"const\" will be unavailable" >&5 -echo "$as_me: WARNING: gmp.h doesnt recognise compiler as ANSI, prototypes and \"const\" will be unavailable" >&2;} -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -esac - - - -# The C compiler on the build system, and associated tests. - -if test -n "$CC_FOR_BUILD"; then - { echo "$as_me:$LINENO: checking build system compiler $CC_FOR_BUILD" >&5 -echo $ECHO_N "checking build system compiler $CC_FOR_BUILD... $ECHO_C" >&6; } -# remove anything that might look like compiler output to our "||" expression -rm -f conftest* a.out b.out a.exe a_out.exe -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then - cc_for_build_works=yes - fi -fi -rm -f conftest* a.out b.out a.exe a_out.exe -{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5 -echo "${ECHO_T}$cc_for_build_works" >&6; } -if test "$cc_for_build_works" = yes; then - : -else - { { echo "$as_me:$LINENO: error: Specified CC_FOR_BUILD doesn't seem to work" >&5 -echo "$as_me: error: Specified CC_FOR_BUILD doesn't seem to work" >&2;} - { (exit 1); exit 1; }; } -fi - -elif test -n "$HOST_CC"; then - { echo "$as_me:$LINENO: checking build system compiler $HOST_CC" >&5 -echo $ECHO_N "checking build system compiler $HOST_CC... $ECHO_C" >&6; } -# remove anything that might look like compiler output to our "||" expression -rm -f conftest* a.out b.out a.exe a_out.exe -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then - cc_for_build_works=yes - fi -fi -rm -f conftest* a.out b.out a.exe a_out.exe -{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5 -echo "${ECHO_T}$cc_for_build_works" >&6; } -if test "$cc_for_build_works" = yes; then - CC_FOR_BUILD=$HOST_CC -else - { { echo "$as_me:$LINENO: error: Specified HOST_CC doesn't seem to work" >&5 -echo "$as_me: error: Specified HOST_CC doesn't seem to work" >&2;} - { (exit 1); exit 1; }; } -fi - -else - for i in "$CC" "$CC $CFLAGS $CPPFLAGS" cc gcc c89 c99; do - { echo "$as_me:$LINENO: checking build system compiler $i" >&5 -echo $ECHO_N "checking build system compiler $i... $ECHO_C" >&6; } -# remove anything that might look like compiler output to our "||" expression -rm -f conftest* a.out b.out a.exe a_out.exe -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then - cc_for_build_works=yes - fi -fi -rm -f conftest* a.out b.out a.exe a_out.exe -{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5 -echo "${ECHO_T}$cc_for_build_works" >&6; } -if test "$cc_for_build_works" = yes; then - CC_FOR_BUILD=$i - break -else - : -fi - - done - if test -z "$CC_FOR_BUILD"; then - { { echo "$as_me:$LINENO: error: Cannot find a build system compiler" >&5 -echo "$as_me: error: Cannot find a build system compiler" >&2;} - { (exit 1); exit 1; }; } - fi -fi - - - - - -{ echo "$as_me:$LINENO: checking for build system preprocessor" >&5 -echo $ECHO_N "checking for build system preprocessor... $ECHO_C" >&6; } -if test -z "$CPP_FOR_BUILD"; then - if test "${gmp_cv_prog_cpp_for_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >&5 2>&1; then - gmp_cv_prog_cpp_for_build=$i - break - fi - done - rm -f conftest* a.out b.out a.exe a_out.exe - if test -z "$gmp_cv_prog_cpp_for_build"; then - { { echo "$as_me:$LINENO: error: Cannot find build system C preprocessor." >&5 -echo "$as_me: error: Cannot find build system C preprocessor." >&2;} - { (exit 1); exit 1; }; } - fi - -fi - - CPP_FOR_BUILD=$gmp_cv_prog_cpp_for_build -fi -{ echo "$as_me:$LINENO: result: $CPP_FOR_BUILD" >&5 -echo "${ECHO_T}$CPP_FOR_BUILD" >&6; } - - - - - -{ echo "$as_me:$LINENO: checking for build system executable suffix" >&5 -echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6; } -if test "${gmp_cv_prog_exeext_for_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if (./conftest) 2>&5; then - gmp_cv_prog_exeext_for_build=$i - break - fi - fi -done -rm -f conftest* -if test "${gmp_cv_prog_exeext_for_build+set}" != set; then - { { echo "$as_me:$LINENO: error: Cannot determine executable suffix" >&5 -echo "$as_me: error: Cannot determine executable suffix" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_prog_exeext_for_build" >&5 -echo "${ECHO_T}$gmp_cv_prog_exeext_for_build" >&6; } -EXEEXT_FOR_BUILD=$gmp_cv_prog_exeext_for_build - - - -{ echo "$as_me:$LINENO: checking whether build system compiler is ANSI" >&5 -echo $ECHO_N "checking whether build system compiler is ANSI... $ECHO_C" >&6; } -if test "${gmp_cv_c_for_build_ansi+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - gmp_cv_c_for_build_ansi=yes -else - gmp_cv_c_for_build_ansi=no -fi -rm -f conftest* a.out b.out a.exe a_out.exe - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_for_build_ansi" >&5 -echo "${ECHO_T}$gmp_cv_c_for_build_ansi" >&6; } -if test "$gmp_cv_c_for_build_ansi" = yes; then - U_FOR_BUILD= -else - U_FOR_BUILD=_ - -fi - - -{ echo "$as_me:$LINENO: checking for build system compiler math library" >&5 -echo $ECHO_N "checking for build system compiler math library... $ECHO_C" >&6; } -if test "${gmp_cv_check_libm_for_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - gmp_cv_check_libm_for_build=-lm -else - gmp_cv_check_libm_for_build=no -fi -rm -f conftest* a.out b.out a.exe a_out.exe - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_check_libm_for_build" >&5 -echo "${ECHO_T}$gmp_cv_check_libm_for_build" >&6; } -case $gmp_cv_check_libm_for_build in - yes) LIBM_FOR_BUILD=-lm - ;; - no) LIBM_FOR_BUILD= ;; - *) LIBM_FOR_BUILD=$gmp_cv_check_libm_for_build ;; -esac - - - -# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am. -# Using the compiler is a lot easier than figuring out how to invoke the -# assembler directly. -# -test -n "$CCAS" || CCAS="$CC -c" - - - -# The C++ compiler, if desired. -want_cxx=no -if test $enable_cxx != no; then - test_CXXFLAGS=${CXXFLAGS+set} - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CXXFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&5 - cxxflags_ac_prog_cxx=$CXXFLAGS - cxxflags_list=ac_prog_cxx - - # If the user didn't specify $CXXFLAGS, then try $CFLAGS, with -g removed - # if AC_PROG_CXX thinks that doesn't work. $CFLAGS stands a good chance - # of working, eg. on a GNU system where CC=gcc and CXX=g++. - # - if test "$test_CXXFLAGS" != set; then - cxxflags_cflags=$CFLAGS - cxxflags_list="cflags $cxxflags_list" - if test "$ac_prog_cxx_g" = no; then - cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'` - fi - fi - - # See if the C++ compiler works. If the user specified CXXFLAGS then all - # we're doing is checking whether AC_PROG_CXX succeeded, since it doesn't - # give a fatal error, just leaves CXX set to a default g++. If on the - # other hand the user didn't specify CXXFLAGS then we get to try here our - # $cxxflags_list alternatives. - # - # Automake includes $CPPFLAGS in a C++ compile, so we do the same here. - # - for cxxflags_choice in $cxxflags_list; do - eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\" - { echo "$as_me:$LINENO: checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS" >&5 -echo $ECHO_N "checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS... $ECHO_C" >&6; } -gmp_prog_cxx_works=yes - -# start with a plain "main()", then go on to further checks -if test "$gmp_prog_cxx_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.cc <&5 - gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5 - (eval $gmp_cxxcompile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - gmp_prog_cxx_works="no, program does not run" - fi - fi - else - gmp_prog_cxx_works="no" - fi - case $gmp_prog_cxx_works in - no*) - echo "failed program was:" >&5 - cat conftest.cc >&5 - ;; - esac - rm -f conftest* a.out b.out a.exe a_out.exe -fi - - -if test "$gmp_prog_cxx_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.cc <&5 - gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5 - (eval $gmp_cxxcompile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - gmp_prog_cxx_works="no, namespace, program does not run" - fi - fi - else - gmp_prog_cxx_works="no, namespace" - fi - case $gmp_prog_cxx_works in - no*) - echo "failed program was:" >&5 - cat conftest.cc >&5 - ;; - esac - rm -f conftest* a.out b.out a.exe a_out.exe -fi - - -# GMP requires the standard C++ iostream classes -if test "$gmp_prog_cxx_works" = yes; then - # remove anything that might look like compiler output to our "||" expression - rm -f conftest* a.out b.out a.exe a_out.exe - cat >conftest.cc <, only a - pre-standard iostream.h. */ -#include - -/* This test rejects OSF 5.1 Compaq C++ in its default pre-standard iostream - mode, since that mode puts cout in the global namespace, not "std". */ -void someoutput (void) { std::cout << 123; } - -int main (void) { return 0; } -EOF - echo "Test compile: std iostream" >&5 - gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5 - (eval $gmp_cxxcompile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$cross_compiling" = no; then - if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then :; - else - gmp_prog_cxx_works="no, std iostream, program does not run" - fi - fi - else - gmp_prog_cxx_works="no, std iostream" - fi - case $gmp_prog_cxx_works in - no*) - echo "failed program was:" >&5 - cat conftest.cc >&5 - ;; - esac - rm -f conftest* a.out b.out a.exe a_out.exe -fi - - -{ echo "$as_me:$LINENO: result: $gmp_prog_cxx_works" >&5 -echo "${ECHO_T}$gmp_prog_cxx_works" >&6; } -case $gmp_prog_cxx_works in - yes) - want_cxx=yes - break - ;; - *) - - ;; -esac - - done - - # If --enable-cxx=yes but a C++ compiler can't be found, then abort. - if test $want_cxx = no && test $enable_cxx = yes; then - { { echo "$as_me:$LINENO: error: C++ compiler not available, see config.log for details" >&5 -echo "$as_me: error: C++ compiler not available, see config.log for details" >&2;} - { (exit 1); exit 1; }; } - fi -fi - - - -if test $want_cxx = yes; then - WANT_CXX_TRUE= - WANT_CXX_FALSE='#' -else - WANT_CXX_TRUE='#' - WANT_CXX_FALSE= -fi - - -# FIXME: We're not interested in CXXCPP for ourselves, but if we don't do it -# here then AC_PROG_LIBTOOL will AC_REQUIRE it (via _LT_AC_TAGCONFIG) and -# hence execute it unconditionally, and that will fail if there's no C++ -# compiler (and no generic /lib/cpp). -# -if test $want_cxx = yes; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi - - -# Path setups for Cray, according to IEEE or CFP. These must come after -# deciding the compiler. -# - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -case $host_cpu in - c90 | t90) - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef _CRAYIEEE -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - add_path="cray/ieee" -else - add_path="cray/cfp"; extra_functions="mulwwc90" -fi -rm -f conftest* - - ;; - j90 | sv1) - add_path="cray/cfp"; extra_functions="mulwwj90" - ;; -esac - - - -if test -z "$MPN_PATH"; then - path="$add_path $path" -fi - -# For a nail build, also look in "nails" subdirectories. -# -if test $GMP_NAIL_BITS != 0 && test -z "$MPN_PATH"; then - new_path= - for i in $path; do - case $i in - generic) new_path="$new_path $i" ;; - *) new_path="$new_path $i/nails $i" ;; - esac - done - path=$new_path -fi - - -# Put all directories into CPUVEC_list so as to get a full set of -# CPUVEC_SETUP_$tmp_suffix defines into config.h, even if some of them are -# empty because mmx and/or sse2 had to be dropped. -# -for i in $fat_path; do - tmp_suffix=`echo $i | sed -e '/\//s:^[^/]*/::' -e 's:[\\/]:_:g'` - CPUVEC_list="$CPUVEC_list CPUVEC_SETUP_$tmp_suffix" -done - - -# If there's any sse2 or mmx in the path, check whether the assembler -# supports it, and remove if not. -# -# We only need this in ABI=32, for ABI=64 on x86_64 we can assume a new -# enough assembler. -# -case $host in - i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*) - if test "$ABI" = 32; then - case "$path $fat_path" in - *mmx*) { echo "$as_me:$LINENO: checking if the assembler knows about MMX instructions" >&5 -echo $ECHO_N "checking if the assembler knows about MMX instructions... $ECHO_C" >&6; } -if test "${gmp_cv_asm_x86_mmx+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_x86_mmx=yes -case $host in -*-*-solaris*) - if (dis conftest.$OBJEXT >conftest.out) 2>/dev/null; then - if grep "0f 6f c1" conftest.out >/dev/null; then - gmp_cv_asm_x86_mmx=movq-bug - fi - else - { echo "$as_me:$LINENO: WARNING: \"dis\" not available to check for \"as\" movq bug" >&5 -echo "$as_me: WARNING: \"dis\" not available to check for \"as\" movq bug" >&2;} - fi -esac -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_x86_mmx=no -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_mmx" >&5 -echo "${ECHO_T}$gmp_cv_asm_x86_mmx" >&6; } - -case $gmp_cv_asm_x86_mmx in -movq-bug) - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5 -echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;} - { echo "$as_me:$LINENO: WARNING: | Host CPU has MMX code, but the assembler" >&5 -echo "$as_me: WARNING: | Host CPU has MMX code, but the assembler" >&2;} - { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5 -echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;} - { echo "$as_me:$LINENO: WARNING: | has the Solaris 2.6 and 2.7 bug where register to register" >&5 -echo "$as_me: WARNING: | has the Solaris 2.6 and 2.7 bug where register to register" >&2;} - { echo "$as_me:$LINENO: WARNING: | movq operands are reversed." >&5 -echo "$as_me: WARNING: | movq operands are reversed." >&2;} - { echo "$as_me:$LINENO: WARNING: | Non-MMX replacements will be used." >&5 -echo "$as_me: WARNING: | Non-MMX replacements will be used." >&2;} - { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5 -echo "$as_me: WARNING: | This will be an inferior build." >&2;} - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - ;; -no) - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5 -echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;} - { echo "$as_me:$LINENO: WARNING: | Host CPU has MMX code, but it can't be assembled by" >&5 -echo "$as_me: WARNING: | Host CPU has MMX code, but it can't be assembled by" >&2;} - { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5 -echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;} - { echo "$as_me:$LINENO: WARNING: | Non-MMX replacements will be used." >&5 -echo "$as_me: WARNING: | Non-MMX replacements will be used." >&2;} - { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5 -echo "$as_me: WARNING: | This will be an inferior build." >&2;} - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - ;; -esac -if test "$gmp_cv_asm_x86_mmx" = yes; then - : -else - tmp_path= -for i in $path; do - case $i in - */*mmx*) ;; - *) tmp_path="$tmp_path $i" ;; - esac -done -path="$tmp_path" - -tmp_path= -for i in $fat_path; do - case $i in - */*mmx*) ;; - *) tmp_path="$tmp_path $i" ;; - esac -done -fat_path="$tmp_path" - - -fi - ;; - esac - case "$path $fat_path" in - *sse2*) { echo "$as_me:$LINENO: checking if the assembler knows about SSE2 instructions" >&5 -echo $ECHO_N "checking if the assembler knows about SSE2 instructions... $ECHO_C" >&6; } -if test "${gmp_cv_asm_x86_sse2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_x86_sse2=yes -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_x86_sse2=no -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_sse2" >&5 -echo "${ECHO_T}$gmp_cv_asm_x86_sse2" >&6; } -case $gmp_cv_asm_x86_sse2 in -yes) - : - ;; -*) - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5 -echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;} - { echo "$as_me:$LINENO: WARNING: | Host CPU has SSE2 code, but it can't be assembled by" >&5 -echo "$as_me: WARNING: | Host CPU has SSE2 code, but it can't be assembled by" >&2;} - { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5 -echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;} - { echo "$as_me:$LINENO: WARNING: | Non-SSE2 replacements will be used." >&5 -echo "$as_me: WARNING: | Non-SSE2 replacements will be used." >&2;} - { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5 -echo "$as_me: WARNING: | This will be an inferior build." >&2;} - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - tmp_path= -for i in $path; do - case $i in - */sse2) ;; - *) tmp_path="$tmp_path $i" ;; - esac -done -path="$tmp_path" - -tmp_path= -for i in $fat_path; do - case $i in - */sse2) ;; - *) tmp_path="$tmp_path $i" ;; - esac -done -fat_path="$tmp_path" - - - ;; -esac - ;; - esac - fi - ;; -esac - - -cat >&5 <&5 -echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; } -if test "$ac_cv_prog_cc_c89" != no; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define PROTOTYPES 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define __PROTOTYPES 1 -_ACEOF - -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -if test "$ac_cv_prog_cc_stdc" != no; then - U= ANSI2KNR= -else - U=_ ANSI2KNR=./ansi2knr -fi -# Ensure some checks needed by ansi2knr itself. - - -for ac_header in string.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -{ echo "$as_me:$LINENO: checking whether assembler supports --noexecstack option" >&5 -echo $ECHO_N "checking whether assembler supports --noexecstack option... $ECHO_C" >&6; } -if test "${cl_cv_as_noexecstack+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.c <&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } \ - && grep .note.GNU-stack conftest.s >/dev/null \ - && { ac_try='${CC} $CFLAGS $CPPFLAGS -Wa,--noexecstack - -c -o conftest.o conftest.s >/dev/null' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } - then - cl_cv_as_noexecstack=yes - else - cl_cv_as_noexecstack=no - fi - rm -f conftest* -fi -{ echo "$as_me:$LINENO: result: $cl_cv_as_noexecstack" >&5 -echo "${ECHO_T}$cl_cv_as_noexecstack" >&6; } - if test "$cl_cv_as_noexecstack" = yes; then - ASMFLAGS="$ASMFLAGS -Wa,--noexecstack" - fi - - - - -gmp_user_AR=$AR -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="ar" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -if test -z "$gmp_user_AR"; then - eval arflags=\"\$ar${abi1}_flags\" - test -n "$arflags" || eval arflags=\"\$ar${abi2}_flags\" - if test -n "$arflags"; then - { echo "$as_me:$LINENO: checking for extra ar flags" >&5 -echo $ECHO_N "checking for extra ar flags... $ECHO_C" >&6; } - AR="$AR $arflags" - ac_cv_prog_AR="$AR $arflags" - ac_cv_prog_ac_ct_AR="$AR $arflags" - { echo "$as_me:$LINENO: result: $arflags" >&5 -echo "${ECHO_T}$arflags" >&6; } - fi -fi -if test -z "$AR_FLAGS"; then - AR_FLAGS=cq -fi - - -gmp_user_NM=$NM -{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi -{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6; } -NM="$lt_cv_path_NM" - - -# FIXME: When cross compiling (ie. $ac_tool_prefix not empty), libtool -# defaults to plain "nm" if a "${ac_tool_prefix}nm" is not found. In this -# case run it again to try the native "nm", firstly so that likely locations -# are searched, secondly so that -B or -p are added if necessary for BSD -# format. This is necessary for instance on OSF with "./configure -# --build=alphaev5-dec-osf --host=alphaev6-dec-osf". -# -if test -z "$gmp_user_NM" && test -n "$ac_tool_prefix" && test "$NM" = nm; then - $as_unset lt_cv_path_NM - gmp_save_ac_tool_prefix=$ac_tool_prefix - ac_tool_prefix= - NM= - { echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi -{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6; } -NM="$lt_cv_path_NM" - - ac_tool_prefix=$gmp_save_ac_tool_prefix -fi - -if test -z "$gmp_user_NM"; then - eval nmflags=\"\$nm${abi1}_flags\" - test -n "$nmflags" || eval nmflags=\"\$nm${abi2}_flags\" - if test -n "$nmflags"; then - { echo "$as_me:$LINENO: checking for extra nm flags" >&5 -echo $ECHO_N "checking for extra nm flags... $ECHO_C" >&6; } - NM="$NM $nmflags" - { echo "$as_me:$LINENO: result: $nmflags" >&5 -echo "${ECHO_T}$nmflags" >&6; } - fi -fi - - -case $host in - # FIXME: On AIX 3 and 4, $libname.a is included in libtool - # $library_names_spec, so libgmp.a becomes a symlink to libgmp.so, making - # it impossible to build shared and static libraries simultaneously. - # Disable shared libraries by default, but let the user override with - # --enable-shared --disable-static. - # - # FIXME: This $libname.a problem looks like it might apply to *-*-amigaos* - # and *-*-os2* too, but wait for someone to test this before worrying - # about it. If there is a problem then of course libtool is the right - # place to fix it. - # - *-*-aix[34]*) - if test -z "$enable_shared"; then enable_shared=no; fi ;; -esac - - -# Configs for Windows DLLs. - - - - -LIBGMP_DLL=0 - -case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # By default, build only static. - if test -z "$enable_shared"; then - enable_shared=no - fi - # Don't allow both static and DLL. - if test "$enable_shared" != no && test "$enable_static" != no; then - { { echo "$as_me:$LINENO: error: cannot build both static and DLL, since gmp.h is different for each. -Use \"--disable-static --enable-shared\" to build just a DLL." >&5 -echo "$as_me: error: cannot build both static and DLL, since gmp.h is different for each. -Use \"--disable-static --enable-shared\" to build just a DLL." >&2;} - { (exit 1); exit 1; }; } - fi - - # "-no-undefined" is required when building a DLL, see documentation on - # AC_LIBTOOL_WIN32_DLL. - # - # "-Wl,--export-all-symbols" is a bit of a hack, it gets all libgmp and - # libgmpxx functions and variables exported. This is what libtool did - # in the past, and it's convenient for us in the test programs. - # - # Maybe it'd be prudent to check for --export-all-symbols before using - # it, but it seems to have been in ld since at least 2000, and there's - # not really any alternative we want to take up at the moment. - # - # "-Wl,output-def" is used to get a .def file for use by MS lib to make - # a .lib import library, described in the manual. libgmp-3.dll.def - # corresponds to the libmp-3.dll.def generated by libtool (as a result - # of -export-symbols on that library). - # - # Incidentally, libtool does generate an import library libgmp.dll.a, - # but it's "ar" format and cannot be used by the MS linker. There - # doesn't seem to be any GNU tool for generating or converting to .lib. - # - # FIXME: The .def files produced by -Wl,output-def include isascii, - # iscsym, iscsymf and toascii, apparently because mingw ctype.h doesn't - # inline isascii (used in gmp). It gives an extern inline for - # __isascii, but for some reason not the plain isascii. - # - if test "$enable_shared" = yes; then - GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols" - LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def" - LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def" - LIBGMP_DLL=1 - fi - ;; -esac - - -# Ensure that $CONFIG_SHELL is available for AC_LIBTOOL_SYS_MAX_CMD_LEN. -# It's often set already by _LT_AC_PROG_ECHO_BACKSLASH or -# _AS_LINENO_PREPARE, but not always. -# -# The symptom of CONFIG_SHELL unset is some "expr" errors during the test, -# and an empty result. This only happens when invoked as "sh configure", -# ie. no path, and can be seen for instance on ia64-*-hpux*. -# -# FIXME: Newer libtool should have it's own fix for this. -# -if test -z "$CONFIG_SHELL"; then - CONFIG_SHELL=$SHELL -fi - -# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on -# mingw and cygwin. Under --disable-cxx this avoids some error messages -# from libtool arising from the fact we didn't actually run AC_PROG_CXX. -# Notice that any user-supplied --with-tags setting takes precedence. -# -# FIXME: Is this the right way to get this effect? Very possibly not, but -# the current _LT_AC_TAGCONFIG doesn't really suggest an alternative. -# -if test "${with_tags+set}" != set; then - if test $want_cxx = yes; then - with_tags=CXX - else - with_tags= - fi -fi - -# The dead hand of AC_REQUIRE makes AC_PROG_LIBTOOL expand and execute -# AC_PROG_F77, even when F77 is not in the selected with_tags. This is -# probably harmless, but it's unsightly and bloats our configure, so pretend -# AC_PROG_F77 has been expanded already. -# -# FIXME: Rumour has it libtool will one day provide a way for a configure.in -# to say what it wants from among supported languages etc. -# - - -# Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - -# Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - -{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - -fi - -SED=$lt_cv_path_SED - -{ echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6; } - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } -else - { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - -{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - -{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else - { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6; } -fi - -{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 -echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 11447 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - lt_cv_cc_needs_belf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_cc_needs_belf=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-cygwin* | *-*-mingw* | *-*-pw32*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_DLLTOOL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { echo "$as_me:$LINENO: result: $DLLTOOL" >&5 -echo "${ECHO_T}$DLLTOOL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5 -echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AS="${ac_tool_prefix}as" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { echo "$as_me:$LINENO: result: $AS" >&5 -echo "${ECHO_T}$AS" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_AS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AS="as" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5 -echo "${ECHO_T}$ac_ct_AS" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { echo "$as_me:$LINENO: result: $OBJDUMP" >&5 -echo "${ECHO_T}$OBJDUMP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 -echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; - -esac - -need_locks="$enable_libtool_lock" - - - -for ac_header in dlfcn.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -fi - - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } -else - { echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6; } -fi - - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux* | k*bsd*-gnu) - if test "$host_cpu" = ia64; then - symcode='[ABCDGIRSTW]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6; } -else - { echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6; } -fi - -{ echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { echo "$as_me:$LINENO: checking for file" >&5 -echo $ECHO_N "checking for file... $ECHO_C" >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -enable_dlopen=no -enable_win32_dll=yes - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13273: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13277: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - esac - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - -{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_pic_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13563: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13567: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; } - -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; } - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - -{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13667: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13671: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | k*bsd*-gnu) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - *) - tmp_sharedflag='-shared' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -echo "${ECHO_T}$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $rm conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac - -{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`echo $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6; } - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - ;; - *) - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - { echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_shl_load || defined __stub___shl_load -choke me -#endif - -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_shl_load=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_shl_load=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - { echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_dlopen || defined __stub___dlopen -choke me -#endif - -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dl_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_svld_dlopen=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_dld_dld_link=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# Report which library types will actually be built -{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6; } - -{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -{ echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6; } - -{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -{ echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6; } - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - fix_srcfile_path \ - exclude_expsyms \ - include_expsyms; do - - case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" -#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - -# Check whether --with-tags was given. -if test "${with_tags+set}" = set; then - withval=$with_tags; tagnames="$withval" -fi - - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - if test -z "$LTCFLAGS"; then - eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - $as_unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - $as_unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } -else - { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc*) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC*) - # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - else - ld_shlibs_CXX=no - fi - ;; - osf3*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - # So that behaviour is only enabled if SCOABSPATH is set to a - # non-empty value in the environment. Most likely only useful for - # creating official distributions of packages. - # This is a hack until libtool officially supports absolute path - # names for shared libraries. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - # - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC*) - # Portland Group C++ compiler. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18536: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:18540: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_static_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_CXX=yes - fi - else - lt_prog_compiler_static_works_CXX=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - -{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18640: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:18644: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $rm conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } - ;; - esac - fi - ;; -esac - -{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" - -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - fix_srcfile_path_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="\ - subroutine t - return - end -" - -# Code to be used in simple link tests -lt_simple_link_test_code="\ - program t - end -" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6; } - -{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -{ echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6; } - -{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -{ echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6; } - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-fpic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - lt_prog_compiler_wl_F77='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - lt_prog_compiler_wl_F77='' - ;; - esac - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static_F77='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_can_build_shared_F77=no - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20202: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:20206: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; } - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_static_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works_F77=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_F77=yes - fi - else - lt_prog_compiler_static_works_F77=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; } - -if test x"$lt_prog_compiler_static_works_F77" = xyes; then - : -else - lt_prog_compiler_static_F77= -fi - - -{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20306: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:20310: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_F77=no - fi - ;; - - interix[3-9]*) - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | k*bsd*-gnu) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - *) - tmp_sharedflag='-shared' ;; - esac - archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs_F77=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77='$convenience' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_F77='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - *) - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs_F77=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_F77='${wl}-z,text' - archive_cmds_need_lc_F77=no - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_F77='${wl}-z,text' - allow_undefined_flag_F77='${wl}-z,nodefs' - archive_cmds_need_lc_F77=no - hardcode_shlibpath_var_F77=no - hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6; } -test "$ld_shlibs_F77" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $rm conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - pic_flag=$lt_prog_compiler_pic_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } - ;; - esac - fi - ;; -esac - -{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" - -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6; } - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - fix_srcfile_path_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - -old_archive_cmds_GCJ=$old_archive_cmds - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22493: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:22497: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux* | k*bsd*-gnu) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - lt_prog_compiler_wl_GCJ='' - ;; - esac - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_can_build_shared_GCJ=no - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22783: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:22787: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; } - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" -{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } -if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works_GCJ=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works_GCJ=yes - fi - else - lt_prog_compiler_static_works_GCJ=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; } - -if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then - : -else - lt_prog_compiler_static_GCJ= -fi - - -{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22887: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:22891: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . 2>&5 - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6; } - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - interix[3-9]*) - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | k*bsd*-gnu) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - *) - tmp_sharedflag='-shared' ;; - esac - archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs_GCJ=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ='$convenience' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - *) - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs_GCJ=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_GCJ='${wl}-z,text' - archive_cmds_need_lc_GCJ=no - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_GCJ='${wl}-z,text' - allow_undefined_flag_GCJ='${wl}-z,nodefs' - archive_cmds_need_lc_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } - $rm conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - pic_flag=$lt_prog_compiler_pic_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } - ;; - esac - fi - ;; -esac - -{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" - -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6; } - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - fix_srcfile_path_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - fix_srcfile_path_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - - - - - - - - - - - - - - - - - - - - - -# Generate an error here if attempting to build both shared and static when -# $libname.a is in $library_names_spec (as mentioned above), rather than -# wait for ar or ld to fail. -# -if test "$enable_shared" = yes && test "$enable_static" = yes; then - case $library_names_spec in - *libname.a*) - { { echo "$as_me:$LINENO: error: cannot create both shared and static libraries on this system, --disable one of the two" >&5 -echo "$as_me: error: cannot create both shared and static libraries on this system, --disable one of the two" >&2;} - { (exit 1); exit 1; }; } - ;; - esac -fi - - - -if test "$enable_static" = yes; then - ENABLE_STATIC_TRUE= - ENABLE_STATIC_FALSE='#' -else - ENABLE_STATIC_TRUE='#' - ENABLE_STATIC_FALSE= -fi - - - -# Many of these library and header checks are for the benefit of -# supplementary programs. libgmp doesn't use anything too weird. - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_time=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - - -# Reasons for testing: -# float.h - not in SunOS bundled cc -# invent.h - IRIX specific -# langinfo.h - X/Open standard only, not in djgpp for instance -# locale.h - old systems won't have this -# nl_types.h - X/Open standard only, not in djgpp for instance -# (usually langinfo.h gives nl_item etc, but not on netbsd 1.4.1) -# sys/attributes.h - IRIX specific -# sys/iograph.h - IRIX specific -# sys/mman.h - not in Cray Unicos -# sys/param.h - not in mingw -# sys/processor.h - solaris specific, though also present in macos -# sys/pstat.h - HPUX specific -# sys/resource.h - not in mingw -# sys/sysctl.h - not in mingw -# sys/sysinfo.h - OSF specific -# sys/syssgi.h - IRIX specific -# sys/systemcfg.h - AIX specific -# sys/time.h - autoconf suggests testing, don't know anywhere without it -# sys/times.h - not in mingw -# machine/hal_sysinfo.h - OSF specific -# -# inttypes.h, stdint.h, unistd.h and sys/types.h are already in the autoconf -# default tests -# - - - - - - - - - - - - - - - - - -for ac_header in fcntl.h float.h invent.h langinfo.h locale.h nl_types.h sys/attributes.h sys/iograph.h sys/mman.h sys/param.h sys/processor.h sys/pstat.h sys/sysinfo.h sys/syssgi.h sys/systemcfg.h sys/time.h sys/times.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# On SunOS, sys/resource.h needs sys/time.h (for struct timeval) - -for ac_header in sys/resource.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# On NetBSD and OpenBSD, sys/sysctl.h needs sys/param.h for various constants - -for ac_header in sys/sysctl.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if HAVE_SYS_PARAM_H -# include -#endif - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# On OSF 4.0, must have for ulong_t - -for ac_header in machine/hal_sysinfo.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if HAVE_SYS_SYSINFO_H -# include -#endif - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Reasons for testing: -# optarg - not declared in mingw -# fgetc, fscanf, ungetc, vfprintf - not declared in SunOS 4 -# sys_errlist, sys_nerr - not declared in SunOS 4 -# -# optarg should be in unistd.h and the rest in stdio.h, both of which are -# in the autoconf default includes. -# -# sys_errlist and sys_nerr are supposed to be in on SunOS according -# to the man page (but aren't), in glibc they're in stdio.h. -# -{ echo "$as_me:$LINENO: checking whether fgetc is declared" >&5 -echo $ECHO_N "checking whether fgetc is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_fgetc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fgetc - (void) fgetc; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_fgetc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_fgetc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgetc" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fgetc" >&6; } -if test $ac_cv_have_decl_fgetc = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FGETC 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FGETC 0 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking whether fscanf is declared" >&5 -echo $ECHO_N "checking whether fscanf is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_fscanf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef fscanf - (void) fscanf; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_fscanf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_fscanf=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fscanf" >&5 -echo "${ECHO_T}$ac_cv_have_decl_fscanf" >&6; } -if test $ac_cv_have_decl_fscanf = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FSCANF 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_FSCANF 0 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking whether optarg is declared" >&5 -echo $ECHO_N "checking whether optarg is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_optarg+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef optarg - (void) optarg; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_optarg=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_optarg=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_optarg" >&5 -echo "${ECHO_T}$ac_cv_have_decl_optarg" >&6; } -if test $ac_cv_have_decl_optarg = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_OPTARG 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_OPTARG 0 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking whether ungetc is declared" >&5 -echo $ECHO_N "checking whether ungetc is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_ungetc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef ungetc - (void) ungetc; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_ungetc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_ungetc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_ungetc" >&5 -echo "${ECHO_T}$ac_cv_have_decl_ungetc" >&6; } -if test $ac_cv_have_decl_ungetc = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UNGETC 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UNGETC 0 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking whether vfprintf is declared" >&5 -echo $ECHO_N "checking whether vfprintf is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_vfprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef vfprintf - (void) vfprintf; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_vfprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_vfprintf=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_vfprintf" >&5 -echo "${ECHO_T}$ac_cv_have_decl_vfprintf" >&6; } -if test $ac_cv_have_decl_vfprintf = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_VFPRINTF 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_VFPRINTF 0 -_ACEOF - - -fi - - -{ echo "$as_me:$LINENO: checking whether sys_errlist is declared" >&5 -echo $ECHO_N "checking whether sys_errlist is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_sys_errlist+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#ifndef sys_errlist - (void) sys_errlist; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_sys_errlist=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_sys_errlist=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_errlist" >&5 -echo "${ECHO_T}$ac_cv_have_decl_sys_errlist" >&6; } -if test $ac_cv_have_decl_sys_errlist = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SYS_ERRLIST 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SYS_ERRLIST 0 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking whether sys_nerr is declared" >&5 -echo $ECHO_N "checking whether sys_nerr is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_sys_nerr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#ifndef sys_nerr - (void) sys_nerr; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_sys_nerr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_sys_nerr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_nerr" >&5 -echo "${ECHO_T}$ac_cv_have_decl_sys_nerr" >&6; } -if test $ac_cv_have_decl_sys_nerr = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SYS_NERR 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SYS_NERR 0 -_ACEOF - - -fi - - - -{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_signal=int -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_signal=void -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - - -# Reasons for testing: -# intmax_t - C99 -# long double - not in the HP bundled K&R cc -# long long - only in reasonably recent compilers -# ptrdiff_t - seems to be everywhere, maybe don't need to check this -# quad_t - BSD specific -# uint_least32_t - C99 -# -# the default includes are sufficient for all these types -# -{ echo "$as_me:$LINENO: checking for intmax_t" >&5 -echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; } -if test "${ac_cv_type_intmax_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef intmax_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_intmax_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_intmax_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5 -echo "${ECHO_T}$ac_cv_type_intmax_t" >&6; } -if test $ac_cv_type_intmax_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTMAX_T 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for long double" >&5 -echo $ECHO_N "checking for long double... $ECHO_C" >&6; } -if test "${ac_cv_type_long_double+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef long double ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_long_double=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_long_double=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 -echo "${ECHO_T}$ac_cv_type_long_double" >&6; } -if test $ac_cv_type_long_double = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_LONG_DOUBLE 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for long long" >&5 -echo $ECHO_N "checking for long long... $ECHO_C" >&6; } -if test "${ac_cv_type_long_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef long long ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_long_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_long_long=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_long_long" >&6; } -if test $ac_cv_type_long_long = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_LONG_LONG 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 -echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; } -if test "${ac_cv_type_ptrdiff_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef ptrdiff_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_ptrdiff_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_ptrdiff_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 -echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; } -if test $ac_cv_type_ptrdiff_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTRDIFF_T 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for quad_t" >&5 -echo $ECHO_N "checking for quad_t... $ECHO_C" >&6; } -if test "${ac_cv_type_quad_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef quad_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_quad_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_quad_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_quad_t" >&5 -echo "${ECHO_T}$ac_cv_type_quad_t" >&6; } -if test $ac_cv_type_quad_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_QUAD_T 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for uint_least32_t" >&5 -echo $ECHO_N "checking for uint_least32_t... $ECHO_C" >&6; } -if test "${ac_cv_type_uint_least32_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef uint_least32_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_uint_least32_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_uint_least32_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_uint_least32_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint_least32_t" >&6; } -if test $ac_cv_type_uint_least32_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT_LEAST32_T 1 -_ACEOF - - -fi - - -{ echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5 -echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6; } -if test "${ac_cv_c_stringize+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define x(y) #y - -char *s = x(teststring); -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "#teststring" >/dev/null 2>&1; then - ac_cv_c_stringize=no -else - ac_cv_c_stringize=yes -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5 -echo "${ECHO_T}$ac_cv_c_stringize" >&6; } -if test $ac_cv_c_stringize = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STRINGIZE 1 -_ACEOF - -fi - - -# FIXME: Really want #ifndef __cplusplus around the #define volatile -# replacement autoconf gives, since volatile is always available in C++. -# But we don't use it in C++ currently. -{ echo "$as_me:$LINENO: checking for working volatile" >&5 -echo $ECHO_N "checking for working volatile... $ECHO_C" >&6; } -if test "${ac_cv_c_volatile+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - -volatile int x; -int * volatile y = (int *) 0; -return !x && !y; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_volatile=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_volatile=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 -echo "${ECHO_T}$ac_cv_c_volatile" >&6; } -if test $ac_cv_c_volatile = no; then - -cat >>confdefs.h <<\_ACEOF -#define volatile -_ACEOF - -fi - - -{ echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 -echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; } -if test "${ac_cv_c_restrict+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_c_restrict=no - # Try the official restrict keyword, then gcc's __restrict, and - # the less common variants. - for ac_kw in restrict __restrict __restrict__ _Restrict; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - } -int -main () -{ -int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_restrict=$ac_kw -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 -echo "${ECHO_T}$ac_cv_c_restrict" >&6; } - case $ac_cv_c_restrict in - restrict) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define restrict -_ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac - - -{ echo "$as_me:$LINENO: checking whether exists and works" >&5 -echo $ECHO_N "checking whether exists and works... $ECHO_C" >&6; } -if test "${gmp_cv_c_stdarg+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int foo (int x, ...) -{ - va_list ap; - int y; - va_start (ap, x); - y = va_arg (ap, int); - va_end (ap); - return y; -} -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gmp_cv_c_stdarg=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_c_stdarg=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_stdarg" >&5 -echo "${ECHO_T}$gmp_cv_c_stdarg" >&6; } -if test $gmp_cv_c_stdarg = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDARG 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((const)) works" >&5 -echo $ECHO_N "checking whether gcc __attribute__ ((const)) works... $ECHO_C" >&6; } -if test "${gmp_cv_c_attribute_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int foo (int x) __attribute__ ((const)); -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gmp_cv_c_attribute_const=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_c_attribute_const=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_const" >&5 -echo "${ECHO_T}$gmp_cv_c_attribute_const" >&6; } -if test $gmp_cv_c_attribute_const = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ATTRIBUTE_CONST 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((malloc)) works" >&5 -echo $ECHO_N "checking whether gcc __attribute__ ((malloc)) works... $ECHO_C" >&6; } -if test "${gmp_cv_c_attribute_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep "attribute directive ignored" conftest.out >/dev/null; then - gmp_cv_c_attribute_malloc=no - else - gmp_cv_c_attribute_malloc=yes - fi -else - gmp_cv_c_attribute_malloc=no -fi -cat conftest.out >&5 -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_malloc" >&5 -echo "${ECHO_T}$gmp_cv_c_attribute_malloc" >&6; } -if test $gmp_cv_c_attribute_malloc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ATTRIBUTE_MALLOC 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((mode (XX))) works" >&5 -echo $ECHO_N "checking whether gcc __attribute__ ((mode (XX))) works... $ECHO_C" >&6; } -if test "${gmp_cv_c_attribute_mode+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -typedef int SItype __attribute__ ((mode (SI))); -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gmp_cv_c_attribute_mode=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_c_attribute_mode=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_mode" >&5 -echo "${ECHO_T}$gmp_cv_c_attribute_mode" >&6; } -if test $gmp_cv_c_attribute_mode = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ATTRIBUTE_MODE 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((noreturn)) works" >&5 -echo $ECHO_N "checking whether gcc __attribute__ ((noreturn)) works... $ECHO_C" >&6; } -if test "${gmp_cv_c_attribute_noreturn+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -void foo (int x) __attribute__ ((noreturn)); -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gmp_cv_c_attribute_noreturn=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_c_attribute_noreturn=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_noreturn" >&5 -echo "${ECHO_T}$gmp_cv_c_attribute_noreturn" >&6; } -if test $gmp_cv_c_attribute_noreturn = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ATTRIBUTE_NORETURN 1 -_ACEOF - -fi - - -{ echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6; } -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_inline=$ac_kw -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6; } - - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - - -case $ac_cv_c_inline in -no) ;; -*) - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE_INLINE 1 -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - -#ifndef __GMP_EXTERN_INLINE -die die die -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - case $ac_cv_c_inline in - yes) tmp_inline=inline ;; - *) tmp_inline=$ac_cv_c_inline ;; - esac - { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&5 -echo "$as_me: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&2;} -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; -esac - - -# from libtool -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - { echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5 -echo $ECHO_N "checking for _mwvalidcheckl in -lmw... $ECHO_C" >&6; } -if test "${ac_cv_lib_mw__mwvalidcheckl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmw $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char _mwvalidcheckl (); -int -main () -{ -return _mwvalidcheckl (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_mw__mwvalidcheckl=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mw__mwvalidcheckl=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_mw__mwvalidcheckl" >&5 -echo "${ECHO_T}$ac_cv_lib_mw__mwvalidcheckl" >&6; } -if test $ac_cv_lib_mw__mwvalidcheckl = yes; then - LIBM="-lmw" -fi - - { echo "$as_me:$LINENO: checking for cos in -lm" >&5 -echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; } -if test "${ac_cv_lib_m_cos+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char cos (); -int -main () -{ -return cos (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_m_cos=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_m_cos=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 -echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; } -if test $ac_cv_lib_m_cos = yes; then - LIBM="$LIBM -lm" -fi - - ;; -*) - { echo "$as_me:$LINENO: checking for cos in -lm" >&5 -echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; } -if test "${ac_cv_lib_m_cos+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char cos (); -int -main () -{ -return cos (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_m_cos=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_m_cos=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5 -echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; } -if test $ac_cv_lib_m_cos = yes; then - LIBM="-lm" -fi - - ;; -esac - - - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ echo "$as_me:$LINENO: checking for working alloca.h" >&5 -echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } -if test "${gmp_cv_header_alloca+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -char *p = (char *) alloca (2 * sizeof (int)); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gmp_cv_header_alloca=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_header_alloca=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_header_alloca" >&5 -echo "${ECHO_T}$gmp_cv_header_alloca" >&6; } -if test $gmp_cv_header_alloca = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA_H 1 -_ACEOF - -fi - - -{ echo "$as_me:$LINENO: checking for alloca (via gmp-impl.h)" >&5 -echo $ECHO_N "checking for alloca (via gmp-impl.h)... $ECHO_C" >&6; } -if test "${gmp_cv_func_alloca+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - -#include "$srcdir/gmp-impl.h" - -int -main () -{ -char *p = (char *) alloca (1); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - gmp_cv_func_alloca=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gmp_cv_func_alloca=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_func_alloca" >&5 -echo "${ECHO_T}$gmp_cv_func_alloca" >&6; } -if test $gmp_cv_func_alloca = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA 1 -_ACEOF - -fi - - -{ echo "$as_me:$LINENO: checking how to allocate temporary memory" >&5 -echo $ECHO_N "checking how to allocate temporary memory... $ECHO_C" >&6; } -if test "${gmp_cv_option_alloca+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $enable_alloca in - yes) - gmp_cv_option_alloca=alloca - ;; - no) - gmp_cv_option_alloca=malloc-reentrant - ;; - reentrant | notreentrant) - case $gmp_cv_func_alloca in - yes) gmp_cv_option_alloca=alloca ;; - *) gmp_cv_option_alloca=malloc-$enable_alloca ;; - esac - ;; - *) - gmp_cv_option_alloca=$enable_alloca - ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_option_alloca" >&5 -echo "${ECHO_T}$gmp_cv_option_alloca" >&6; } - - - - -case $gmp_cv_option_alloca in - alloca) - if test $gmp_cv_func_alloca = no; then - { { echo "$as_me:$LINENO: error: --enable-alloca=alloca specified, but alloca not available" >&5 -echo "$as_me: error: --enable-alloca=alloca specified, but alloca not available" >&2;} - { (exit 1); exit 1; }; } - fi - cat >>confdefs.h <<\_ACEOF -#define WANT_TMP_ALLOCA 1 -_ACEOF - - TAL_OBJECT=tal-reent$U.lo - ;; - malloc-reentrant) - cat >>confdefs.h <<\_ACEOF -#define WANT_TMP_REENTRANT 1 -_ACEOF - - TAL_OBJECT=tal-reent$U.lo - ;; - malloc-notreentrant) - cat >>confdefs.h <<\_ACEOF -#define WANT_TMP_NOTREENTRANT 1 -_ACEOF - - TAL_OBJECT=tal-notreent$U.lo - ;; - debug) - cat >>confdefs.h <<\_ACEOF -#define WANT_TMP_DEBUG 1 -_ACEOF - - TAL_OBJECT=tal-debug$U.lo - ;; - *) - # checks at the start of configure.in should protect us - { { echo "$as_me:$LINENO: error: unrecognised --enable-alloca=$gmp_cv_option_alloca" >&5 -echo "$as_me: error: unrecognised --enable-alloca=$gmp_cv_option_alloca" >&2;} - { (exit 1); exit 1; }; } - ;; -esac - - - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - -#if ! _GMP_H_HAVE_FILE -die die die -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise , FILE prototypes will be unavailable" >&5 -echo "$as_me: WARNING: gmp.h doesnt recognise , FILE prototypes will be unavailable" >&2;} -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ - && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_bigendian=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=no -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } -case $ac_cv_c_bigendian in - yes) - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIMB_BIG_ENDIAN 1 -_ACEOF - - -echo "define_not_for_expansion(\`HAVE_LIMB_BIG_ENDIAN')" >> $gmp_tmpconfigm4p - ;; - no) - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIMB_LITTLE_ENDIAN 1 -_ACEOF - - -echo "define_not_for_expansion(\`HAVE_LIMB_LITTLE_ENDIAN')" >> $gmp_tmpconfigm4p - - ;; - *) - : ;; -esac - - - - - - -{ echo "$as_me:$LINENO: checking format of \`double' floating point" >&5 -echo $ECHO_N "checking format of \`double' floating point... $ECHO_C" >&6; } -if test "${gmp_cv_c_double_format+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_c_double_format=unknown -cat >conftest.c <<\EOF -struct { - char before[8]; - double x; - char after[8]; -} foo = { - { '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' }, - -123456789.0, - { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }, -}; -EOF -gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5 2>&1" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then -cat >conftest.awk <<\EOF - -BEGIN { - found = 0 -} - -{ - for (f = 2; f <= NF; f++) - { - for (i = 0; i < 23; i++) - got[i] = got[i+1]; - got[23] = $f; - - # match the special begin and end sequences - if (got[0] != "001") continue - if (got[1] != "043") continue - if (got[2] != "105") continue - if (got[3] != "147") continue - if (got[4] != "211") continue - if (got[5] != "253") continue - if (got[6] != "315") continue - if (got[7] != "357") continue - if (got[16] != "376") continue - if (got[17] != "334") continue - if (got[18] != "272") continue - if (got[19] != "230") continue - if (got[20] != "166") continue - if (got[21] != "124") continue - if (got[22] != "062") continue - if (got[23] != "020") continue - - saw = " (" got[8] " " got[9] " " got[10] " " got[11] " " got[12] " " got[13] " " got[14] " " got[15] ")" - - if (got[8] == "000" && \ - got[9] == "000" && \ - got[10] == "000" && \ - got[11] == "124" && \ - got[12] == "064" && \ - got[13] == "157" && \ - got[14] == "235" && \ - got[15] == "301") - { - print "IEEE little endian" - found = 1 - exit - } - - # Little endian with the two 4-byte halves swapped, as used by ARM - # when the chip is in little endian mode. - # - if (got[8] == "064" && \ - got[9] == "157" && \ - got[10] == "235" && \ - got[11] == "301" && \ - got[12] == "000" && \ - got[13] == "000" && \ - got[14] == "000" && \ - got[15] == "124") - { - print "IEEE little endian, swapped halves" - found = 1 - exit - } - - # gcc 2.95.4 on one GNU/Linux ARM system was seen generating 000 in - # the last byte, whereas 124 is correct. Not sure where the bug - # actually lies, but a running program didn't seem to get a full - # mantissa worth of working bits. - # - # We match this case explicitly so we can give a nice result message, - # but we deliberately exclude it from the normal IEEE double setups - # since it's too broken. - # - if (got[8] == "064" && \ - got[9] == "157" && \ - got[10] == "235" && \ - got[11] == "301" && \ - got[12] == "000" && \ - got[13] == "000" && \ - got[14] == "000" && \ - got[15] == "000") - { - print "bad ARM software floats" - found = 1 - exit - } - - if (got[8] == "301" && \ - got[9] == "235" && \ - got[10] == "157" && \ - got[11] == "064" && \ - got[12] == "124" && \ - got[13] == "000" && \ - got[14] == "000" && \ - got[15] == "000") - { - print "IEEE big endian" - found = 1 - exit - } - - if (got[8] == "353" && \ - got[9] == "315" && \ - got[10] == "242" && \ - got[11] == "171" && \ - got[12] == "000" && \ - got[13] == "240" && \ - got[14] == "000" && \ - got[15] == "000") - { - print "VAX D" - found = 1 - exit - } - - if (got[8] == "275" && \ - got[9] == "301" && \ - got[10] == "064" && \ - got[11] == "157" && \ - got[12] == "000" && \ - got[13] == "124" && \ - got[14] == "000" && \ - got[15] == "000") - { - print "VAX G" - found = 1 - exit - } - - if (got[8] == "300" && \ - got[9] == "033" && \ - got[10] == "353" && \ - got[11] == "171" && \ - got[12] == "242" && \ - got[13] == "240" && \ - got[14] == "000" && \ - got[15] == "000") - { - print "Cray CFP" - found = 1 - exit - } - } -} - -END { - if (! found) - print "unknown", saw -} - -EOF - gmp_cv_c_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk` - case $gmp_cv_c_double_format in - unknown*) - echo "cannot match anything, conftest.$OBJEXT contains" >&5 - od -b conftest.$OBJEXT >&5 - ;; - esac -else - { echo "$as_me:$LINENO: WARNING: oops, cannot compile test program" >&5 -echo "$as_me: WARNING: oops, cannot compile test program" >&2;} -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_c_double_format" >&5 -echo "${ECHO_T}$gmp_cv_c_double_format" >&6; } - - - - -case $gmp_cv_c_double_format in - "IEEE big endian") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_IEEE_BIG_ENDIAN 1 -_ACEOF - - -echo "define_not_for_expansion(\`HAVE_DOUBLE_IEEE_BIG_ENDIAN')" >> $gmp_tmpconfigm4p - - ;; - "IEEE little endian") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1 -_ACEOF - - -echo "define_not_for_expansion(\`HAVE_DOUBLE_IEEE_LITTLE_ENDIAN')" >> $gmp_tmpconfigm4p - - ;; - "IEEE little endian, swapped halves") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_IEEE_LITTLE_SWAPPED 1 -_ACEOF - ;; - "VAX D") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_VAX_D 1 -_ACEOF - ;; - "VAX G") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_VAX_G 1 -_ACEOF - ;; - "Cray CFP") - cat >>confdefs.h <<\_ACEOF -#define HAVE_DOUBLE_CRAY_CFP 1 -_ACEOF - ;; - "bad ARM software floats") - ;; - unknown*) - { echo "$as_me:$LINENO: WARNING: Could not determine float format." >&5 -echo "$as_me: WARNING: Could not determine float format." >&2;} - { echo "$as_me:$LINENO: WARNING: Conversions to and from \"double\" may be slow." >&5 -echo "$as_me: WARNING: Conversions to and from \"double\" may be slow." >&2;} - ;; - *) - { echo "$as_me:$LINENO: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&5 -echo "$as_me: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&2;} - ;; -esac - - - -# Reasons for testing: -# alarm - not in mingw -# attr_get - IRIX specific -# clock_gettime - not in glibc 2.2.4, only very recent systems -# cputime - not in glibc -# getsysinfo - OSF specific -# getrusage - not in mingw -# gettimeofday - not in mingw -# mmap - not in mingw, djgpp -# nl_langinfo - X/Open standard only, not in djgpp for instance -# obstack_vprintf - glibc specific -# processor_info - solaris specific -# pstat_getprocessor - HPUX specific (10.x and up) -# raise - an ANSI-ism, though probably almost universal by now -# read_real_time - AIX specific -# sigaction - not in mingw -# sigaltstack - not in mingw, or old AIX (reputedly) -# sigstack - not in mingw -# strerror - not in SunOS -# strnlen - glibc extension (some other systems too) -# syssgi - IRIX specific -# times - not in mingw -# -# clock_gettime is in librt on *-*-osf5.1. We could look for it -# there, but that's not worth bothering with unless it has a decent -# resolution (in a quick test clock_getres said only 1 millisecond). -# -# AC_FUNC_STRNLEN is not used because we don't want the AC_LIBOBJ -# replacement setups it gives. It detects a faulty strnlen on AIX, but -# missing out on that test is ok since our only use of strnlen is in -# __gmp_replacement_vsnprintf which is not required on AIX since it has a -# vsnprintf. -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -for ac_func in alarm attr_get clock clock_gettime cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - -{ echo "$as_me:$LINENO: checking for vsnprintf" >&5 -echo $ECHO_N "checking for vsnprintf... $ECHO_C" >&6; } -if test "${ac_cv_func_vsnprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define vsnprintf to an innocuous variant, in case declares vsnprintf. - For example, HP-UX 11i declares gettimeofday. */ -#define vsnprintf innocuous_vsnprintf - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vsnprintf (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef vsnprintf - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char vsnprintf (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_vsnprintf || defined __stub___vsnprintf -choke me -#endif - -int -main () -{ -return vsnprintf (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_vsnprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func_vsnprintf=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf" >&5 -echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6; } -if test $ac_cv_func_vsnprintf = yes; then - gmp_vsnprintf_exists=yes -else - gmp_vsnprintf_exists=no -fi - -if test "$gmp_vsnprintf_exists" = no; then - gmp_cv_func_vsnprintf=no -else - { echo "$as_me:$LINENO: checking whether vsnprintf works" >&5 -echo $ECHO_N "checking whether vsnprintf works... $ECHO_C" >&6; } -if test "${gmp_cv_func_vsnprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_func_vsnprintf=yes - for i in 'check ("hello world");' 'int n; check ("%nhello world", &n);'; do - if test "$cross_compiling" = yes; then - gmp_cv_func_vsnprintf=probably; break -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include /* for strcmp */ -#include /* for vsnprintf */ - -#if HAVE_STDARG -#include -#else -#include -#endif - -int -#if HAVE_STDARG -check (const char *fmt, ...) -#else -check (va_alist) - va_dcl -#endif -{ - static char buf[128]; - va_list ap; - int ret; - -#if HAVE_STDARG - va_start (ap, fmt); -#else - char *fmt; - va_start (ap); - fmt = va_arg (ap, char *); -#endif - - ret = vsnprintf (buf, 4, fmt, ap); - - if (strcmp (buf, "hel") != 0) - exit (1); - - /* allowed return values */ - if (ret != -1 && ret != 3 && ret != 11) - exit (2); - - return 0; -} - -int -main () -{ -$i - exit (0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gmp_cv_func_vsnprintf=no; break -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - - done - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_func_vsnprintf" >&5 -echo "${ECHO_T}$gmp_cv_func_vsnprintf" >&6; } - if test "$gmp_cv_func_vsnprintf" = probably; then - { echo "$as_me:$LINENO: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&5 -echo "$as_me: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&2;} - fi - if test "$gmp_cv_func_vsnprintf" != no; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_VSNPRINTF 1 -_ACEOF - - fi -fi - -{ echo "$as_me:$LINENO: checking whether sscanf needs writable input" >&5 -echo $ECHO_N "checking whether sscanf needs writable input... $ECHO_C" >&6; } -if test "${gmp_cv_func_sscanf_writable_input+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $host in - *-*-hpux9 | *-*-hpux9.*) - gmp_cv_func_sscanf_writable_input=yes ;; - *) gmp_cv_func_sscanf_writable_input=no ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_func_sscanf_writable_input" >&5 -echo "${ECHO_T}$gmp_cv_func_sscanf_writable_input" >&6; } -case $gmp_cv_func_sscanf_writable_input in - yes) -cat >>confdefs.h <<\_ACEOF -#define SSCANF_WRITABLE_INPUT 1 -_ACEOF - ;; - no) ;; - *) { { echo "$as_me:$LINENO: error: unrecognised \$gmp_cv_func_sscanf_writable_input" >&5 -echo "$as_me: error: unrecognised \$gmp_cv_func_sscanf_writable_input" >&2;} - { (exit 1); exit 1; }; } ;; -esac - - -# Reasons for checking: -# pst_processor psp_iticksperclktick - not in hpux 9 -# -{ echo "$as_me:$LINENO: checking for struct pst_processor.psp_iticksperclktick" >&5 -echo $ECHO_N "checking for struct pst_processor.psp_iticksperclktick... $ECHO_C" >&6; } -if test "${ac_cv_member_struct_pst_processor_psp_iticksperclktick+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main () -{ -static struct pst_processor ac_aggr; -if (ac_aggr.psp_iticksperclktick) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_pst_processor_psp_iticksperclktick=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main () -{ -static struct pst_processor ac_aggr; -if (sizeof ac_aggr.psp_iticksperclktick) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_member_struct_pst_processor_psp_iticksperclktick=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_member_struct_pst_processor_psp_iticksperclktick=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_pst_processor_psp_iticksperclktick" >&5 -echo "${ECHO_T}$ac_cv_member_struct_pst_processor_psp_iticksperclktick" >&6; } -if test $ac_cv_member_struct_pst_processor_psp_iticksperclktick = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_PSP_ITICKSPERCLKTICK 1 -_ACEOF - -fi - - -# C++ tests, when required -# -if test $enable_cxx = yes; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - # Reasons for testing: - # - not in g++ 2.95.2 - # std::locale - not in g++ 2.95.4 - # - - -for ac_header in sstream -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - { echo "$as_me:$LINENO: checking for std::locale" >&5 -echo $ECHO_N "checking for std::locale... $ECHO_C" >&6; } -if test "${ac_cv_type_std__locale+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -typedef std::locale ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_std__locale=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_std__locale=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_std__locale" >&5 -echo "${ECHO_T}$ac_cv_type_std__locale" >&6; } -if test $ac_cv_type_std__locale = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STD__LOCALE 1 -_ACEOF - - -fi - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi - - -# Pick the correct source files in $path and link them to mpn/. -# $gmp_mpn_functions lists all functions we need. -# -# The rule is to find a file with the function name and a .asm, .S, -# .s, or .c extension. Certain multi-function files with special names -# can provide some functions too. (mpn/Makefile.am passes -# -DOPERATION_ to get them to generate the right code.) - -# Note: The following lines defining $gmp_mpn_functions_optional -# and $gmp_mpn_functions are parsed by the "macos/configure" -# Perl script. So if you change the lines in a major way -# make sure to run and examine the output from -# -# % (cd macos; perl configure) -# -# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former -# can optionally provide the latter as an extra entrypoint. Likewise -# divrem_1 and pre_divrem_1. - -gmp_mpn_functions_optional="umul udiv copyi copyd com_n - and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \ - invert_limb sqr_diagonal \ - mul_2 mul_3 mul_4 \ - addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \ - addlsh1_n sublsh1_n rsh1add_n rsh1sub_n addsub_n addaddmul_1msb0 lshiftc" - -gmp_mpn_functions="$extra_functions \ - add add_1 add_n sub sub_1 sub_n neg_n mul_1 addmul_1 \ - submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \ - fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \ - mod_1_1 mod_1_2 mod_1_3 mod_1_4 \ - mul mul_fft mul_n mul_basecase sqr_basecase random random2 pow_1 \ - rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \ - bdivmod gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step \ - gcdext_lehmer gcdext_subdiv_step \ - tdiv_qr dc_divrem_n sb_divrem_mn jacbase get_d \ - matrix22_mul hgcd2 hgcd mullow_n mullow_basecase \ - toom22_mul toom33_mul toom44_mul \ - toom32_mul toom42_mul toom62_mul toom53_mul \ - toom2_sqr toom3_sqr toom4_sqr \ - toom_interpolate_5pts toom_interpolate_7pts invert binvert \ - sb_div_qr sb_divappr_q sb_div_q dc_div_qr dc_divappr_q dc_div_q \ - mu_div_qr mu_divappr_q mu_div_q \ - sb_bdiv_q sb_bdiv_qr dc_bdiv_q dc_bdiv_qr mu_bdiv_q mu_bdiv_qr \ - divexact bdiv_dbm1c redc_1 redc_2 powm powlo powm_sec subcnd_n \ - $gmp_mpn_functions_optional" - - - -# the list of all object files used by mpn/Makefile.in and the -# top-level Makefile.in, respectively -mpn_objects= -mpn_objs_in_libgmp= - -# links from the sources, to be removed by "make distclean" -gmp_srclinks= - - -# mpn_relative_top_srcdir is $top_srcdir, but for use from within the mpn -# build directory. If $srcdir is relative then we use a relative path too, -# so the two trees can be moved together. -case $srcdir in - [\\/]* | ?:[\\/]*) # absolute, as per autoconf - mpn_relative_top_srcdir=$srcdir ;; - *) # relative - mpn_relative_top_srcdir=../$srcdir ;; -esac - - - - - - -# Fat binary setups. -# -# We proceed through each $fat_path directory, and look for $fat_function -# routines there. Those found are incorporated in the build by generating a -# little mpn/.asm or mpn/.c file in the build directory, with -# suitable function renaming, and adding that to $mpn_objects (the same as a -# normal mpn file). -# -# fat.h is generated with macros to let internal calls to each $fat_function -# go directly through __gmpn_cpuvec, plus macros and declarations helping to -# setup that structure, on a per-directory basis ready for -# mpn//fat/fat.c. -# -# fat.h includes thesholds listed in $fat_thresholds, extracted from -# gmp-mparam.h in each directory. An overall maximum for each threshold is -# established, for use in making fixed size arrays of temporary space. -# (Eg. MUL_TOOM3_THRESHOLD_LIMIT used by mpn/generic/mul.c.) -# -# It'd be possible to do some of this manually, but when there's more than a -# few functions and a few directories it becomes very tedious, and very -# prone to having some routine accidentally omitted. On that basis it seems -# best to automate as much as possible, even if the code to do so is a bit -# ugly. -# - -if test -n "$fat_path"; then - # Usually the mpn build directory is created with mpn/Makefile - # instantiation, but we want to write to it sooner. - mkdir mpn 2>/dev/null - - echo "/* fat.h - setups for fat binaries." >fat.h - echo " Generated by configure - DO NOT EDIT. */" >>fat.h - - -cat >>confdefs.h <<\_ACEOF -#define WANT_FAT_BINARY 1 -_ACEOF - - -echo 'define(, )' >>$gmp_tmpconfigm4 - - - # Don't want normal copies of fat functions - for tmp_fn in $fat_functions; do - remove_from_list_tmp= -for remove_from_list_i in $gmp_mpn_functions; do - if test $remove_from_list_i = $tmp_fn; then :; - else - remove_from_list_tmp="$remove_from_list_tmp $remove_from_list_i" - fi -done -gmp_mpn_functions=$remove_from_list_tmp - - remove_from_list_tmp= -for remove_from_list_i in $gmp_mpn_functions_optional; do - if test $remove_from_list_i = $tmp_fn; then :; - else - remove_from_list_tmp="$remove_from_list_tmp $remove_from_list_i" - fi -done -gmp_mpn_functions_optional=$remove_from_list_tmp - - done - - for tmp_fn in $fat_functions; do - case $tmp_fn in - dive_1) tmp_fbase=divexact_1 ;; - diveby3) tmp_fbase=divexact_by3c ;; - pre_divrem_1) tmp_fbase=preinv_divrem_1 ;; - mode1o) tmp_fbase=modexact_1c_odd ;; - pre_mod_1) tmp_fbase=preinv_mod_1 ;; - *) tmp_fbase=$tmp_fn ;; -esac - - echo " -#ifndef OPERATION_$tmp_fn -#undef mpn_$tmp_fbase -#define mpn_$tmp_fbase (*__gmpn_cpuvec.$tmp_fbase) -#endif -DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h - # encourage various macros to use fat functions - cat >>confdefs.h <<_ACEOF -#define HAVE_NATIVE_$tmp_fbase 1 -_ACEOF - - done - - echo "" >>fat.h - echo "/* variable thresholds */" >>fat.h - for tmp_tn in $fat_thresholds; do - echo "#undef $tmp_tn" >>fat.h - echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr A-Z a-z`)" >>fat.h - done - - echo " -/* Copy all fields into __gmpn_cpuvec. - memcpy is not used because it might operate byte-wise (depending on its - implemenation), and we need the function pointer writes to be atomic. - "volatile" discourages the compiler from trying to optimize this. */ -#define CPUVEC_INSTALL(vec) \\ - do { \\ - volatile struct cpuvec_t *p = &__gmpn_cpuvec; \\" >>fat.h - for tmp_fn in $fat_functions; do - case $tmp_fn in - dive_1) tmp_fbase=divexact_1 ;; - diveby3) tmp_fbase=divexact_by3c ;; - pre_divrem_1) tmp_fbase=preinv_divrem_1 ;; - mode1o) tmp_fbase=modexact_1c_odd ;; - pre_mod_1) tmp_fbase=preinv_mod_1 ;; - *) tmp_fbase=$tmp_fn ;; -esac - - echo " p->$tmp_fbase = vec.$tmp_fbase; \\" >>fat.h - done - for tmp_tn in $fat_thresholds; do - tmp_field_name=`echo $tmp_tn | tr A-Z a-z` - echo " p->$tmp_field_name = vec.$tmp_field_name; \\" >>fat.h - done - echo " } while (0)" >>fat.h - - echo " -/* A helper to check all fields are filled. */ -#define ASSERT_CPUVEC(vec) \\ - do { \\" >>fat.h - for tmp_fn in $fat_functions; do - case $tmp_fn in - dive_1) tmp_fbase=divexact_1 ;; - diveby3) tmp_fbase=divexact_by3c ;; - pre_divrem_1) tmp_fbase=preinv_divrem_1 ;; - mode1o) tmp_fbase=modexact_1c_odd ;; - pre_mod_1) tmp_fbase=preinv_mod_1 ;; - *) tmp_fbase=$tmp_fn ;; -esac - - echo " ASSERT (vec.$tmp_fbase != NULL); \\" >>fat.h - done - for tmp_tn in $fat_thresholds; do - tmp_field_name=`echo $tmp_tn | tr A-Z a-z` - echo " ASSERT (vec.$tmp_field_name != 0); \\" >>fat.h - done - echo " } while (0)" >>fat.h - - echo " -/* Call ITERATE(field) for each fat threshold field. */ -#define ITERATE_FAT_THRESHOLDS() \\ - do { \\" >>fat.h - for tmp_tn in $fat_thresholds; do - tmp_field_name=`echo $tmp_tn | tr A-Z a-z` - echo " ITERATE ($tmp_tn, $tmp_field_name); \\" >>fat.h - done - echo " } while (0)" >>fat.h - - for tmp_dir in $fat_path; do - CPUVEC_SETUP= - THRESH_ASM_SETUP= - echo "" >>fat.h - tmp_suffix=`echo $tmp_dir | sed -e '/\//s:^[^/]*/::' -e 's:[\\/]:_:g'` - - # In order to keep names unique on a DOS 8.3 filesystem, use a prefix - # (rather than a suffix) for the generated file names, and abbreviate. - case $tmp_suffix in - pentium) tmp_prefix=p ;; - pentium_mmx) tmp_prefix=pm ;; - p6_mmx) tmp_prefix=p2 ;; - p6_p3mmx) tmp_prefix=p3 ;; - pentium4) tmp_prefix=p4 ;; - pentium4_mmx) tmp_prefix=p4m ;; - pentium4_sse2) tmp_prefix=p4s ;; - k6_mmx) tmp_prefix=k6m ;; - k6_k62mmx) tmp_prefix=k62 ;; - k7_mmx) tmp_prefix=k7m ;; - *) tmp_prefix=$tmp_suffix ;; - esac - - # Extract desired thresholds from gmp-mparam.h file in this directory, - # if prsent. - tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h - if test -f $tmp_mparam; then - for tmp_tn in $fat_thresholds; do - tmp_thresh=`sed -n "s/^#define $tmp_tn[ ]*\\([0-9][0-9]*\\).*$/\\1/p" $tmp_mparam` - if test -n "$tmp_thresh"; then - THRESH_ASM_SETUP="${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh) -" - CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr A-Z a-z` = $tmp_thresh; \\ -" - eval tmp_limit=\$${tmp_tn}_LIMIT - if test -z "$tmp_limit"; then - tmp_limit=0 - fi - if test $tmp_thresh -gt $tmp_limit; then - eval ${tmp_tn}_LIMIT=$tmp_thresh - fi - fi - done - fi - - for tmp_fn in $fat_functions; do - # functions that can be provided by multi-function files -tmp_mulfunc= -case $tmp_fn in - add_n|sub_n) tmp_mulfunc="aors_n" ;; - addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;; - popcount|hamdist) tmp_mulfunc="popham" ;; - and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n) - tmp_mulfunc="logops_n" ;; - lshift|rshift) tmp_mulfunc="lorrshift";; - addlsh1_n|sublsh1_n) - tmp_mulfunc="aorslsh1_n";; - rsh1add_n|rsh1sub_n) - tmp_mulfunc="rsh1aors_n";; -esac - - - for tmp_base in $tmp_fn $tmp_mulfunc; do - for tmp_ext in asm S s c; do - tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext - if test -f $tmp_file; then - - mpn_objects="$mpn_objects ${tmp_prefix}_$tmp_fn.lo" - mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_prefix}_$tmp_fn.lo" - - case $tmp_fn in - dive_1) tmp_fbase=divexact_1 ;; - diveby3) tmp_fbase=divexact_by3c ;; - pre_divrem_1) tmp_fbase=preinv_divrem_1 ;; - mode1o) tmp_fbase=modexact_1c_odd ;; - pre_mod_1) tmp_fbase=preinv_mod_1 ;; - *) tmp_fbase=$tmp_fn ;; -esac - - - # carry-in variant, eg. divrem_1c or modexact_1c_odd - case $tmp_fbase in - *_1*) tmp_fbasec=`echo $tmp_fbase | sed 's/_1/_1c/'` ;; - *) tmp_fbasec=${tmp_fbase}c ;; - esac - - # Create a little file doing an include from srcdir. The - # OPERATION and renamings aren't all needed all the time, but - # they don't hurt if unused. - # - # FIXME: Should generate these via config.status commands. - # Would need them all in one AC_CONFIG_COMMANDS though, since - # that macro doesn't accept a set of separate commands generated - # by shell code. - # - case $tmp_ext in - asm) - # hide the d-n-l from autoconf's error checking - tmp_d_n_l=d""nl - echo "$tmp_d_n_l mpn_$tmp_fbase - from $tmp_dir directory for fat binary. -$tmp_d_n_l Generated by configure - DO NOT EDIT. - -define(OPERATION_$tmp_fn) -define(__gmpn_$tmp_fbase, __gmpn_${tmp_fbase}_$tmp_suffix) -define(__gmpn_$tmp_fbasec,__gmpn_${tmp_fbasec}_${tmp_suffix}) -define(__gmpn_preinv_${tmp_fbase},__gmpn_preinv_${tmp_fbase}_${tmp_suffix}) - -$tmp_d_n_l For k6 and k7 gcd_1 calling their corresponding mpn_modexact_1_odd -ifdef(\`__gmpn_modexact_1_odd',, -\`define(__gmpn_modexact_1_odd,__gmpn_modexact_1_odd_${tmp_suffix})') - -$THRESH_ASM_SETUP -include($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm) -" >mpn/${tmp_prefix}_$tmp_fn.asm - ;; - c) - echo "/* mpn_$tmp_fbase - from $tmp_dir directory for fat binary. - Generated by configure - DO NOT EDIT. */ - -#define OPERATION_$tmp_fn 1 -#define __gmpn_$tmp_fbase __gmpn_${tmp_fbase}_$tmp_suffix -#define __gmpn_$tmp_fbasec __gmpn_${tmp_fbasec}_${tmp_suffix} -#define __gmpn_preinv_${tmp_fbase} __gmpn_preinv_${tmp_fbase}_${tmp_suffix} - -#include \"$mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.c\" -" >mpn/${tmp_prefix}_$tmp_fn.c - ;; - esac - - # Prototype, and append to CPUVEC_SETUP for this directory. - echo "DECL_$tmp_fbase (__gmpn_${tmp_fbase}_$tmp_suffix);" >>fat.h - CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.$tmp_fbase = __gmpn_${tmp_fbase}_${tmp_suffix}; \\ -" - # Ditto for any preinv variant (preinv_divrem_1, preinv_mod_1). - if grep "^PROLOGUE(mpn_preinv_$tmp_fn)" $tmp_file >/dev/null; then - echo "DECL_preinv_$tmp_fbase (__gmpn_preinv_${tmp_fbase}_$tmp_suffix);" >>fat.h - CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.preinv_$tmp_fbase = __gmpn_preinv_${tmp_fbase}_${tmp_suffix}; \\ -" - fi - fi - done - done - done - - # Emit CPUVEC_SETUP for this directory - echo "" >>fat.h - echo "#define CPUVEC_SETUP_$tmp_suffix \\" >>fat.h - echo " do { \\" >>fat.h - echo "$CPUVEC_SETUP } while (0)" >>fat.h - done - - # Emit threshold limits - echo "" >>fat.h - for tmp_tn in $fat_thresholds; do - eval tmp_limit=\$${tmp_tn}_LIMIT - echo "#define ${tmp_tn}_LIMIT $tmp_limit" >>fat.h - done -fi - - -# Normal binary setups. -# - -for tmp_ext in asm S s c; do - eval found_$tmp_ext=no -done - -for tmp_fn in $gmp_mpn_functions; do - for tmp_ext in asm S s c; do - test "$no_create" = yes || rm -f mpn/$tmp_fn.$tmp_ext - done - - # mpn_preinv_divrem_1 might have been provided by divrem_1.asm, likewise - # mpn_preinv_mod_1 by mod_1.asm. - case $tmp_fn in - pre_divrem_1) - if test "$HAVE_NATIVE_mpn_preinv_divrem_1" = yes; then continue; fi ;; - pre_mod_1) - if test "$HAVE_NATIVE_mpn_preinv_mod_1" = yes; then continue; fi ;; - esac - - # functions that can be provided by multi-function files -tmp_mulfunc= -case $tmp_fn in - add_n|sub_n) tmp_mulfunc="aors_n" ;; - addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;; - popcount|hamdist) tmp_mulfunc="popham" ;; - and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n) - tmp_mulfunc="logops_n" ;; - lshift|rshift) tmp_mulfunc="lorrshift";; - addlsh1_n|sublsh1_n) - tmp_mulfunc="aorslsh1_n";; - rsh1add_n|rsh1sub_n) - tmp_mulfunc="rsh1aors_n";; -esac - - - found=no - for tmp_dir in $path; do - for tmp_base in $tmp_fn $tmp_mulfunc; do - for tmp_ext in asm S s c; do - tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext - if test -f $tmp_file; then - - # For a nails build, check if the file supports our nail bits. - # Generic code always supports all nails. - # - # FIXME: When a multi-function file is selected to provide one of - # the nails-neutral routines, like logops_n for and_n, the - # PROLOGUE grepping will create HAVE_NATIVE_mpn_ defines for - # all functions in that file, even if they haven't all been - # nailified. Not sure what to do about this, it's only really a - # problem for logops_n, and it's not too terrible to insist those - # get nailified always. - # - if test $GMP_NAIL_BITS != 0 && test $tmp_dir != generic; then - case $tmp_fn in - and_n | ior_n | xor_n | andn_n | \ - copyi | copyd | \ - popcount | hamdist | \ - udiv | udiv_w_sdiv | umul | \ - cntlz | invert_limb) - # these operations are either unaffected by nails or defined - # to operate on full limbs - ;; - *) - nails=`sed -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file ` - for n in $nails; do - case $n in - *-*) - n_start=`echo "$n" | sed -n 's/\(.*\)-.*/\1/p'` - n_end=`echo "$n" | sed -n 's/.*-\(.*\)/\1/p'` - ;; - *) - n_start=$n - n_end=$n - ;; - esac - if test $GMP_NAIL_BITS -ge $n_start && test $GMP_NAIL_BITS -le $n_end; then - found=yes - break - fi - done - if test $found != yes; then - continue - fi - ;; - esac - fi - - found=yes - eval found_$tmp_ext=yes - - if test $tmp_ext = c; then - tmp_u='$U' - else - tmp_u= - fi - - mpn_objects="$mpn_objects $tmp_fn$tmp_u.lo" - mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/$tmp_fn$tmp_u.lo" - ac_config_links="$ac_config_links mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext" - - gmp_srclinks="$gmp_srclinks mpn/$tmp_fn.$tmp_ext" - - # Duplicate AC_DEFINEs are harmless, so it doesn't matter - # that multi-function files get grepped here repeatedly. - # The PROLOGUE pattern excludes the optional second parameter. - gmp_ep=` - sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ; - sed -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file - ` - for gmp_tmp in $gmp_ep; do - cat >>confdefs.h <<_ACEOF -#define HAVE_NATIVE_$gmp_tmp 1 -_ACEOF - - eval HAVE_NATIVE_$gmp_tmp=yes - done - - case $tmp_fn in - sqr_basecase) sqr_basecase_source=$tmp_file ;; - esac - - break - fi - done - if test $found = yes; then break ; fi - done - if test $found = yes; then break ; fi - done - - if test $found = no; then - for tmp_optional in $gmp_mpn_functions_optional; do - if test $tmp_optional = $tmp_fn; then - found=yes - fi - done - if test $found = no; then - { { echo "$as_me:$LINENO: error: no version of $tmp_fn found in path: $path" >&5 -echo "$as_me: error: no version of $tmp_fn found in path: $path" >&2;} - { (exit 1); exit 1; }; } - fi - fi -done - -# All cycle counters are .asm files currently -if test -n "$SPEED_CYCLECOUNTER_OBJ"; then - found_asm=yes -fi - - - - - - -# Don't demand an m4 unless it's actually needed. -if test $found_asm = yes; then - -{ echo "$as_me:$LINENO: checking for suitable m4" >&5 -echo $ECHO_N "checking for suitable m4... $ECHO_C" >&6; } -if test "${gmp_cv_prog_m4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$M4"; then - gmp_cv_prog_m4="$M4" -else - cat >conftest.m4 <<\EOF -define(dollarhash,``$#'')ifelse(dollarhash(x),1,`define(t1,Y)', -``bad: $# not supported (SunOS /usr/bin/m4) -'')ifelse(eval(89),89,`define(t2,Y)', -`bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4) -')ifelse(t1`'t2,YY,`good -') -EOF - echo "trying m4" >&5 - gmp_tmp_val=`(m4 conftest.m4) 2>&5` - echo "$gmp_tmp_val" >&5 - if test "$gmp_tmp_val" = good; then - gmp_cv_prog_m4="m4" - else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH:/usr/5bin" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - echo "trying $ac_dir/m4" >&5 - gmp_tmp_val=`($ac_dir/m4 conftest.m4) 2>&5` - echo "$gmp_tmp_val" >&5 - if test "$gmp_tmp_val" = good; then - gmp_cv_prog_m4="$ac_dir/m4" - break - fi - done - IFS="$ac_save_ifs" - if test -z "$gmp_cv_prog_m4"; then - { { echo "$as_me:$LINENO: error: No usable m4 in \$PATH or /usr/5bin (see config.log for reasons)." >&5 -echo "$as_me: error: No usable m4 in \$PATH or /usr/5bin (see config.log for reasons)." >&2;} - { (exit 1); exit 1; }; } - fi - fi - rm -f conftest.m4 -fi -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_prog_m4" >&5 -echo "${ECHO_T}$gmp_cv_prog_m4" >&6; } -M4="$gmp_cv_prog_m4" - - - -{ echo "$as_me:$LINENO: checking if m4wrap produces spurious output" >&5 -echo $ECHO_N "checking if m4wrap produces spurious output... $ECHO_C" >&6; } -if test "${gmp_cv_m4_m4wrap_spurious+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # hide the d-n-l from autoconf's error checking -tmp_d_n_l=d""nl -cat >conftest.m4 <&5 -cat conftest.m4 >&5 -tmp_chars=`$M4 conftest.m4 | wc -c` -echo produces $tmp_chars chars output >&5 -rm -f conftest.m4 -if test $tmp_chars = 0; then - gmp_cv_m4_m4wrap_spurious=no -else - gmp_cv_m4_m4wrap_spurious=yes -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_m4_m4wrap_spurious" >&5 -echo "${ECHO_T}$gmp_cv_m4_m4wrap_spurious" >&6; } - -echo "define(,<$gmp_cv_m4_m4wrap_spurious>)" >> $gmp_tmpconfigm4 - - -else - M4=m4-not-needed -fi - -# Only do the GMP_ASM checks if there's a .S or .asm wanting them. -if test $found_asm = no && test $found_S = no; then - gmp_asm_syntax_testing=no -fi - -if test "$gmp_asm_syntax_testing" != no; then - { echo "$as_me:$LINENO: checking how to switch to text section" >&5 -echo $ECHO_N "checking how to switch to text section... $ECHO_C" >&6; } -if test "${gmp_cv_asm_text+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for i in ".text" ".code" ".csect .text[PR]"; do - echo "trying $i" >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_text=$i - rm -f conftest* - break -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - -done -if test -z "$gmp_cv_asm_text"; then - { { echo "$as_me:$LINENO: error: Cannot determine text section directive" >&5 -echo "$as_me: error: Cannot determine text section directive" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_text" >&5 -echo "${ECHO_T}$gmp_cv_asm_text" >&6; } -echo "define(, <$gmp_cv_asm_text>)" >> $gmp_tmpconfigm4 - - { echo "$as_me:$LINENO: checking how to switch to data section" >&5 -echo $ECHO_N "checking how to switch to data section... $ECHO_C" >&6; } -if test "${gmp_cv_asm_data+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $host in - *-*-aix*) gmp_cv_asm_data=".csect .data[RW]" ;; - *) gmp_cv_asm_data=".data" ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_data" >&5 -echo "${ECHO_T}$gmp_cv_asm_data" >&6; } -echo "define(, <$gmp_cv_asm_data>)" >> $gmp_tmpconfigm4 - - -{ echo "$as_me:$LINENO: checking for assembler label suffix" >&5 -echo $ECHO_N "checking for assembler label suffix... $ECHO_C" >&6; } -if test "${gmp_cv_asm_label_suffix+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_label_suffix=unknown -for i in "" ":"; do - echo "trying $i" >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_label_suffix=$i - rm -f conftest* - break -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - cat conftest.out >&5 -fi -rm -f conftest* - -done -if test "$gmp_cv_asm_label_suffix" = "unknown"; then - { { echo "$as_me:$LINENO: error: Cannot determine label suffix" >&5 -echo "$as_me: error: Cannot determine label suffix" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_label_suffix" >&5 -echo "${ECHO_T}$gmp_cv_asm_label_suffix" >&6; } -echo "define(, <$gmp_cv_asm_label_suffix>)" >> $gmp_tmpconfigm4 - - -{ echo "$as_me:$LINENO: checking for assembler global directive" >&5 -echo $ECHO_N "checking for assembler global directive... $ECHO_C" >&6; } -if test "${gmp_cv_asm_globl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $host in - hppa*-*-*) gmp_cv_asm_globl=.export ;; - ia64*-*-* | itanium-*-* | itanium2-*-*) gmp_cv_asm_globl=.global ;; - *) gmp_cv_asm_globl=.globl ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_globl" >&5 -echo "${ECHO_T}$gmp_cv_asm_globl" >&6; } -echo "define(, <$gmp_cv_asm_globl>)" >> $gmp_tmpconfigm4 - - -{ echo "$as_me:$LINENO: checking for assembler global directive attribute" >&5 -echo $ECHO_N "checking for assembler global directive attribute... $ECHO_C" >&6; } -if test "${gmp_cv_asm_globl_attr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $gmp_cv_asm_globl in - .export) gmp_cv_asm_globl_attr=",entry" ;; - *) gmp_cv_asm_globl_attr="" ;; -esac - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_globl_attr" >&5 -echo "${ECHO_T}$gmp_cv_asm_globl_attr" >&6; } -echo "define(, <$gmp_cv_asm_globl_attr>)" >> $gmp_tmpconfigm4 - - -{ echo "$as_me:$LINENO: checking if globals are prefixed by underscore" >&5 -echo $ECHO_N "checking if globals are prefixed by underscore... $ECHO_C" >&6; } -if test "${gmp_cv_asm_underscore+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_underscore="unknown" -cat >conftest.c <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - $NM conftest.$OBJEXT >conftest.out - if grep _gurkmacka conftest.out >/dev/null; then - gmp_cv_asm_underscore=yes - elif grep gurkmacka conftest.out >/dev/null; then - gmp_cv_asm_underscore=no - else - echo "configure: $NM doesn't have gurkmacka:" >&5 - cat conftest.out >&5 - fi -else - echo "configure: failed program was:" >&5 - cat conftest.c >&5 -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_underscore" >&5 -echo "${ECHO_T}$gmp_cv_asm_underscore" >&6; } -case $gmp_cv_asm_underscore in - yes) - -echo 'define(, <_>)' >>$gmp_tmpconfigm4 - ;; - no) - -echo 'define(, <>)' >>$gmp_tmpconfigm4 - ;; - *) - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - { echo "$as_me:$LINENO: WARNING: | Cannot determine global symbol prefix." >&5 -echo "$as_me: WARNING: | Cannot determine global symbol prefix." >&2;} - { echo "$as_me:$LINENO: WARNING: | $NM output doesn't contain a global data symbol." >&5 -echo "$as_me: WARNING: | $NM output doesn't contain a global data symbol." >&2;} - { echo "$as_me:$LINENO: WARNING: | Will proceed with no underscore." >&5 -echo "$as_me: WARNING: | Will proceed with no underscore." >&2;} - { echo "$as_me:$LINENO: WARNING: | If this is wrong then you'll get link errors referring" >&5 -echo "$as_me: WARNING: | If this is wrong then you'll get link errors referring" >&2;} - { echo "$as_me:$LINENO: WARNING: | to ___gmpn_add_n (note three underscores)." >&5 -echo "$as_me: WARNING: | to ___gmpn_add_n (note three underscores)." >&2;} - { echo "$as_me:$LINENO: WARNING: | In this case do a fresh build with an override," >&5 -echo "$as_me: WARNING: | In this case do a fresh build with an override," >&2;} - { echo "$as_me:$LINENO: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&5 -echo "$as_me: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&2;} - { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5 -echo "$as_me: WARNING: +----------------------------------------------------------" >&2;} - -echo 'define(, <>)' >>$gmp_tmpconfigm4 - - ;; -esac - - - - - -{ echo "$as_me:$LINENO: checking how to switch to read-only data section" >&5 -echo $ECHO_N "checking how to switch to read-only data section... $ECHO_C" >&6; } -if test "${gmp_cv_asm_rodata+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -case $host in -i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | x86_64-*-*) - gmp_cv_asm_rodata="$gmp_cv_asm_data" ;; -*) - gmp_cv_asm_rodata="$gmp_cv_asm_text" ;; -esac - -cat >conftest.c <&5 -cat conftest.c >&5 -gmp_compile="$CC $CFLAGS $CPPFLAGS -S conftest.c >&5" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - echo "Compiler output:" >&5 - cat conftest.s >&5 - if test $gmp_cv_asm_underscore = yes; then - tmp_gsym_prefix=_ - else - tmp_gsym_prefix= - fi - # must see our label - if grep "^${tmp_gsym_prefix}foo$gmp_cv_asm_label_suffix" conftest.s >/dev/null 2>&5; then - # take the last directive before our label (hence skipping segments - # getting debugging info etc) - tmp_match=`sed -n "/^${tmp_gsym_prefix}foo$gmp_cv_asm_label_suffix/q - /^[. ]*data/p - /^[. ]*rdata/p - /^[. ]*text/p - /^[. ]*section/p - /^[. ]*csect/p - /^[. ]*CSECT/p" conftest.s | sed -n '$p'` - echo "Match: $tmp_match" >&5 - if test -n "$tmp_match"; then - gmp_cv_asm_rodata=$tmp_match - fi - else - echo "Couldn't find label: ^${tmp_gsym_prefix}foo$gmp_cv_asm_label_suffix" >&5 - fi -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_rodata" >&5 -echo "${ECHO_T}$gmp_cv_asm_rodata" >&6; } -echo "define(, <$gmp_cv_asm_rodata>)" >> $gmp_tmpconfigm4 - - { echo "$as_me:$LINENO: checking for assembler .type directive" >&5 -echo $ECHO_N "checking for assembler .type directive... $ECHO_C" >&6; } -if test "${gmp_cv_asm_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_type= -for gmp_tmp_prefix in @ \# %; do - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - if grep "\.type pseudo-op used outside of \.def/\.endef ignored" conftest.out >/dev/null; then : ; - else - gmp_cv_asm_type=".type \$1,${gmp_tmp_prefix}\$2" - break - fi -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - -done -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_type" >&5 -echo "${ECHO_T}$gmp_cv_asm_type" >&6; } -echo "define(, <$gmp_cv_asm_type>)" >> $gmp_tmpconfigm4 - - { echo "$as_me:$LINENO: checking for assembler .size directive" >&5 -echo $ECHO_N "checking for assembler .size directive... $ECHO_C" >&6; } -if test "${gmp_cv_asm_size+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_size= -cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - if grep "\.size pseudo-op used outside of \.def/\.endef ignored" conftest.out >/dev/null; then : ; - else - gmp_cv_asm_size=".size \$1,\$2" - fi -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_size" >&5 -echo "${ECHO_T}$gmp_cv_asm_size" >&6; } -echo "define(, <$gmp_cv_asm_size>)" >> $gmp_tmpconfigm4 - - - - -{ echo "$as_me:$LINENO: checking for assembler local label prefix" >&5 -echo $ECHO_N "checking for assembler local label prefix... $ECHO_C" >&6; } -if test "${gmp_cv_asm_lsym_prefix+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_tmp_pre_appears=yes -for gmp_tmp_pre in L .L $L $ L$; do - echo "Trying $gmp_tmp_pre" >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - if $NM conftest.$OBJEXT >conftest.nm 2>&5; then : ; else - cat conftest.nm >&5 - { echo "$as_me:$LINENO: WARNING: \"$NM\" failure" >&5 -echo "$as_me: WARNING: \"$NM\" failure" >&2;} - break - fi - cat conftest.nm >&5 - if grep gurkmacka conftest.nm >/dev/null; then : ; else - # no mention of the symbol, this is good - echo "$gmp_tmp_pre label doesn't appear in object file at all (good)" >&5 - gmp_cv_asm_lsym_prefix="$gmp_tmp_pre" - gmp_tmp_pre_appears=no - break - fi - if grep ' [a-zN] .*gurkmacka' conftest.nm >/dev/null; then - # symbol mentioned as a local, use this if nothing better - echo "$gmp_tmp_pre label is local but still in object file" >&5 - if test -z "$gmp_cv_asm_lsym_prefix"; then - gmp_cv_asm_lsym_prefix="$gmp_tmp_pre" - fi - else - echo "$gmp_tmp_pre label is something unknown" >&5 - fi - -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - -done -rm -f conftest* -if test -z "$gmp_cv_asm_lsym_prefix"; then - gmp_cv_asm_lsym_prefix=L - { echo "$as_me:$LINENO: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&5 -echo "$as_me: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&2;} -fi -# for development purposes, note whether we got a purely temporary local label -echo "Local label appears in object files: $gmp_tmp_pre_appears" >&5 - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_lsym_prefix" >&5 -echo "${ECHO_T}$gmp_cv_asm_lsym_prefix" >&6; } -echo "define(, <${gmp_cv_asm_lsym_prefix}>)" >> $gmp_tmpconfigm4 - -cat >>confdefs.h <<_ACEOF -#define LSYM_PREFIX "$gmp_cv_asm_lsym_prefix" -_ACEOF - - - - -{ echo "$as_me:$LINENO: checking for assembler byte directive" >&5 -echo $ECHO_N "checking for assembler byte directive... $ECHO_C" >&6; } -if test "${gmp_cv_asm_byte+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for i in .byte data1; do - echo "trying $i" >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_byte=$i - rm -f conftest* - break -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - cat conftest.out >&5 -fi -rm -f conftest* - -done -if test -z "$gmp_cv_asm_byte"; then - { { echo "$as_me:$LINENO: error: Cannot determine how to emit a data byte" >&5 -echo "$as_me: error: Cannot determine how to emit a data byte" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_byte" >&5 -echo "${ECHO_T}$gmp_cv_asm_byte" >&6; } - - - - - - -{ echo "$as_me:$LINENO: checking how to define a 32-bit word" >&5 -echo $ECHO_N "checking how to define a 32-bit word... $ECHO_C" >&6; } -if test "${gmp_cv_asm_w32+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $host in - *-*-hpux*) - # FIXME: HPUX puts first symbol at 0x40000000, breaking our assumption - # that it's at 0x0. We'll have to declare another symbol before the - # .long/.word and look at the distance between the two symbols. The - # only problem is that the sed expression(s) barfs (on Solaris, for - # example) for the symbol with value 0. For now, HPUX uses .word. - gmp_cv_asm_w32=".word" - ;; - *-*-*) - gmp_tmp_val= - for gmp_tmp_op in .long .word data4; do - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_tmp_val=`$NM conftest.$OBJEXT | grep foo | \ - sed -e 's;[[][0-9][]]\(.*\);\1;' -e 's;[^1-9]*\([0-9]*\).*;\1;'` - if test "$gmp_tmp_val" = 4; then - gmp_cv_asm_w32="$gmp_tmp_op" - break - fi -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - - done - rm -f conftest* - ;; -esac -if test -z "$gmp_cv_asm_w32"; then - { { echo "$as_me:$LINENO: error: cannot determine how to define a 32-bit word" >&5 -echo "$as_me: error: cannot determine how to define a 32-bit word" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_w32" >&5 -echo "${ECHO_T}$gmp_cv_asm_w32" >&6; } -echo "define(, <$gmp_cv_asm_w32>)" >> $gmp_tmpconfigm4 - - - - - - -{ echo "$as_me:$LINENO: checking if .align assembly directive is logarithmic" >&5 -echo $ECHO_N "checking if .align assembly directive is logarithmic... $ECHO_C" >&6; } -if test "${gmp_cv_asm_align_log+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_tmp_val=`$NM conftest.$OBJEXT | grep foo | \ - sed -e 's;[[][0-9][]]\(.*\);\1;' -e 's;[^1-9]*\([0-9]*\).*;\1;'` - if test "$gmp_tmp_val" = "10" || test "$gmp_tmp_val" = "16"; then - gmp_cv_asm_align_log=yes - else - gmp_cv_asm_align_log=no - fi -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - { { echo "$as_me:$LINENO: error: cannot assemble alignment test" >&5 -echo "$as_me: error: cannot assemble alignment test" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_align_log" >&5 -echo "${ECHO_T}$gmp_cv_asm_align_log" >&6; } - - -echo "define(,<$gmp_cv_asm_align_log>)" >> $gmp_tmpconfigm4 - - - - case $host in - hppa*-*-*) - # for both pa32 and pa64 - -echo "include_mpn(\`pa32/pa-defs.m4')" >> $gmp_tmpconfigm4i - - ;; - ia64*-*-* | itanium-*-* | itanium2-*-*) - { echo "$as_me:$LINENO: checking whether assembler .align padding is good" >&5 -echo $ECHO_N "checking whether assembler .align padding is good... $ECHO_C" >&6; } -if test "${gmp_cv_asm_ia64_align_ok+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.awk <<\EOF -BEGIN { - want[0] = "011" - want[1] = "160" - want[2] = "074" - want[3] = "040" - want[4] = "000" - want[5] = "040" - want[6] = "020" - want[7] = "221" - want[8] = "114" - want[9] = "000" - want[10] = "100" - want[11] = "200" - want[12] = "122" - want[13] = "261" - want[14] = "000" - want[15] = "200" - - want[16] = "000" - want[17] = "004" - want[18] = "000" - want[19] = "000" - want[20] = "000" - want[21] = "000" - want[22] = "002" - want[23] = "000" - want[24] = "000" - want[25] = "000" - want[26] = "000" - want[27] = "001" - want[28] = "000" - want[29] = "000" - want[30] = "000" - want[31] = "014" - - want[32] = "011" - want[33] = "270" - want[34] = "140" - want[35] = "062" - want[36] = "000" - want[37] = "040" - want[38] = "240" - want[39] = "331" - want[40] = "160" - want[41] = "000" - want[42] = "100" - want[43] = "240" - want[44] = "343" - want[45] = "371" - want[46] = "000" - want[47] = "200" - - result = "yes" -} -{ - for (f = 2; f <= NF; f++) - { - for (i = 0; i < 47; i++) - got[i] = got[i+1]; - got[47] = $f; - - found = 1 - for (i = 0; i < 48; i++) - if (got[i] != want[i]) - { - found = 0 - break - } - if (found) - { - result = "no" - exit - } - } -} -END { - print result -} -EOF -cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_ia64_align_ok=`od -b conftest.$OBJEXT | $AWK -f conftest.awk` -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - { echo "$as_me:$LINENO: WARNING: oops, cannot compile test program" >&5 -echo "$as_me: WARNING: oops, cannot compile test program" >&2;} - gmp_cv_asm_ia64_align_ok=yes -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_ia64_align_ok" >&5 -echo "${ECHO_T}$gmp_cv_asm_ia64_align_ok" >&6; } - -echo "define(, <\`$gmp_cv_asm_ia64_align_ok'>)" >> $gmp_tmpconfigm4 - - - ;; - m68k-*-* | m68[0-9][0-9][0-9]-*-*) - -{ echo "$as_me:$LINENO: checking assembler instruction and register style" >&5 -echo $ECHO_N "checking assembler instruction and register style... $ECHO_C" >&6; } -if test "${gmp_cv_asm_m68k_instruction+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for i in "addl %d0,%d1" "add.l %d0,%d1" "addl d0,d1" "add.l d0,d1"; do - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_m68k_instruction=$i - rm -f conftest* - break -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - -done -if test -z "$gmp_cv_asm_m68k_instruction"; then - { { echo "$as_me:$LINENO: error: cannot determine assembler instruction and register style" >&5 -echo "$as_me: error: cannot determine assembler instruction and register style" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_instruction" >&5 -echo "${ECHO_T}$gmp_cv_asm_m68k_instruction" >&6; } -case $gmp_cv_asm_m68k_instruction in -"addl d0,d1") want_dot_size=no; want_register_percent=no ;; -"addl %d0,%d1") want_dot_size=no; want_register_percent=yes ;; -"add.l d0,d1") want_dot_size=yes; want_register_percent=no ;; -"add.l %d0,%d1") want_dot_size=yes; want_register_percent=yes ;; -*) { { echo "$as_me:$LINENO: error: oops, unrecognised instruction and register style" >&5 -echo "$as_me: error: oops, unrecognised instruction and register style" >&2;} - { (exit 1); exit 1; }; } ;; -esac - -echo "define(, <\`$want_register_percent'>)" >> $gmp_tmpconfigm4 - - -echo "define(, <\`$want_dot_size'>)" >> $gmp_tmpconfigm4 - - - - -{ echo "$as_me:$LINENO: checking assembler addressing style" >&5 -echo $ECHO_N "checking assembler addressing style... $ECHO_C" >&6; } -if test "${gmp_cv_asm_m68k_addressing+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $gmp_cv_asm_m68k_instruction in -addl*) movel=movel ;; -add.l*) movel=move.l ;; -*) { { echo "$as_me:$LINENO: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&5 -echo "$as_me: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&2;} - { (exit 1); exit 1; }; } ;; -esac -case $gmp_cv_asm_m68k_instruction in -*"%d0,%d1") dreg=%d0; areg=%a0 ;; -*"d0,d1") dreg=d0; areg=a0 ;; -*) { { echo "$as_me:$LINENO: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&5 -echo "$as_me: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&2;} - { (exit 1); exit 1; }; } ;; -esac -cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_m68k_addressing=mit -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_m68k_addressing=motorola -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - { { echo "$as_me:$LINENO: error: cannot determine assembler addressing style" >&5 -echo "$as_me: error: cannot determine assembler addressing style" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest* - -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_addressing" >&5 -echo "${ECHO_T}$gmp_cv_asm_m68k_addressing" >&6; } - -echo "define(, <\`$gmp_cv_asm_m68k_addressing'>)" >> $gmp_tmpconfigm4 - - - -{ echo "$as_me:$LINENO: checking assembler shortest branches" >&5 -echo $ECHO_N "checking assembler shortest branches... $ECHO_C" >&6; } -if test "${gmp_cv_asm_m68k_branches+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - for i in jra jbra bra; do - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_m68k_branches=$i - rm -f conftest* - break -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - : -fi -rm -f conftest* - -done -if test -z "$gmp_cv_asm_m68k_branches"; then - { { echo "$as_me:$LINENO: error: cannot determine assembler branching style" >&5 -echo "$as_me: error: cannot determine assembler branching style" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_branches" >&5 -echo "${ECHO_T}$gmp_cv_asm_m68k_branches" >&6; } - -echo "define(, <\`$gmp_cv_asm_m68k_branches'>)" >> $gmp_tmpconfigm4 - - - ;; - powerpc*-*-* | power[3-9]-*-*) - -{ echo "$as_me:$LINENO: checking whether compiler output is PIC by default" >&5 -echo $ECHO_N "checking whether compiler output is PIC by default... $ECHO_C" >&6; } -if test "${gmp_cv_asm_powerpc_pic+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_powerpc_pic=yes -cat >conftest.c <&5 -cat conftest.c >&5 -gmp_compile="$CC $CFLAGS $CPPFLAGS -S conftest.c >&5" -if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - echo "Compiler output:" >&5 - cat conftest.s >&5 - if grep 'foo@ha' conftest.s >/dev/null 2>&5; then - gmp_cv_asm_powerpc_pic=no - fi - if grep 'ha16(_foo)' conftest.s >/dev/null 2>&5; then - gmp_cv_asm_powerpc_pic=no - fi -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_powerpc_pic" >&5 -echo "${ECHO_T}$gmp_cv_asm_powerpc_pic" >&6; } - -echo "define(,<$gmp_cv_asm_powerpc_pic>)" >> $gmp_tmpconfigm4 - - - -{ echo "$as_me:$LINENO: checking if the assembler needs r on registers" >&5 -echo $ECHO_N "checking if the assembler needs r on registers... $ECHO_C" >&6; } -if test "${gmp_cv_asm_powerpc_r_registers+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_powerpc_r_registers=no -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_powerpc_r_registers=yes -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - { { echo "$as_me:$LINENO: error: neither \"mtctr 6\" nor \"mtctr r6\" works" >&5 -echo "$as_me: error: neither \"mtctr 6\" nor \"mtctr r6\" works" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest* - -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_powerpc_r_registers" >&5 -echo "${ECHO_T}$gmp_cv_asm_powerpc_r_registers" >&6; } - - -echo "define(,<$gmp_cv_asm_powerpc_r_registers>)" >> $gmp_tmpconfigm4 - - - -echo "include_mpn(\`powerpc32/powerpc-defs.m4')" >> $gmp_tmpconfigm4i - - case $host in - *-*-aix*) - case $ABI in - 64 | aix64) -echo "include_mpn(\`powerpc64/aix.m4')" >> $gmp_tmpconfigm4i - ;; - *) -echo "include_mpn(\`powerpc32/aix.m4')" >> $gmp_tmpconfigm4i - ;; - esac - ;; - *-*-linux* | *-*-*bsd*) - case $ABI in - mode64) -echo "include_mpn(\`powerpc64/elf.m4')" >> $gmp_tmpconfigm4i - ;; - mode32 | 32) -echo "include_mpn(\`powerpc32/elf.m4')" >> $gmp_tmpconfigm4i - ;; - esac - ;; - *-*-darwin*) - case $ABI in - mode64) -echo "include_mpn(\`powerpc64/darwin.m4')" >> $gmp_tmpconfigm4i - ;; - mode32 | 32) -echo "include_mpn(\`powerpc32/darwin.m4')" >> $gmp_tmpconfigm4i - ;; - esac - ;; - *) - # Assume unrecognized operating system is the powerpc eABI - -echo "include_mpn(\`powerpc32/eabi.m4')" >> $gmp_tmpconfigm4i - - ;; - esac - ;; - power*-*-aix*) - -echo "include_mpn(\`powerpc32/aix.m4')" >> $gmp_tmpconfigm4i - - ;; - sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*) - case $ABI in - 64) - -{ echo "$as_me:$LINENO: checking if the assembler accepts \".register\"" >&5 -echo $ECHO_N "checking if the assembler accepts \".register\"... $ECHO_C" >&6; } -if test "${gmp_cv_asm_sparc_register+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_sparc_register=yes -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_sparc_register=no -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_sparc_register" >&5 -echo "${ECHO_T}$gmp_cv_asm_sparc_register" >&6; } - - -echo "define(,<$gmp_cv_asm_sparc_register>)" >> $gmp_tmpconfigm4 - - - ;; - esac - ;; - i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*) - -{ echo "$as_me:$LINENO: checking if the .align directive accepts an 0x90 fill in .text" >&5 -echo $ECHO_N "checking if the .align directive accepts an 0x90 fill in .text... $ECHO_C" >&6; } -if test "${gmp_cv_asm_align_fill_0x90+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then - echo "Supressing this warning by omitting 0x90" 1>&5 - gmp_cv_asm_align_fill_0x90=no -else - gmp_cv_asm_align_fill_0x90=yes -fi -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_align_fill_0x90=no -fi -rm -f conftest* - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_align_fill_0x90" >&5 -echo "${ECHO_T}$gmp_cv_asm_align_fill_0x90" >&6; } - - -echo "define(,<$gmp_cv_asm_align_fill_0x90>)" >> $gmp_tmpconfigm4 - - - case $ABI in - 32) - -echo "include_mpn(\`x86/x86-defs.m4')" >> $gmp_tmpconfigm4i - - cat >>confdefs.h <<\_ACEOF -#define HAVE_HOST_CPU_FAMILY_x86 1 -_ACEOF - - - - - - -{ echo "$as_me:$LINENO: checking for assembler COFF type directives" >&5 -echo $ECHO_N "checking for assembler COFF type directives... $ECHO_C" >&6; } -if test "${gmp_cv_asm_x86_coff_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_x86_coff_type=yes -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_x86_coff_type=no -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_coff_type" >&5 -echo "${ECHO_T}$gmp_cv_asm_x86_coff_type" >&6; } -echo "define(, <$gmp_cv_asm_x86_coff_type>)" >> $gmp_tmpconfigm4 - - - - - - - -{ echo "$as_me:$LINENO: checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore" >&5 -echo $ECHO_N "checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore... $ECHO_C" >&6; } -if test "${gmp_cv_asm_x86_got_underscore+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gmp_cv_asm_x86_got_underscore="not applicable" -if test $gmp_cv_asm_underscore = yes; then - tmp_gsym_prefix=_ -else - tmp_gsym_prefix= -fi -for tmp_underscore in "" "_"; do - cat >conftest.s <&5 - (eval $gmp_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$tmp_underscore" = "_"; then - gmp_cv_asm_x86_got_underscore=yes - else - gmp_cv_asm_x86_got_underscore=no - fi - break - fi -done -rm -f conftest* a.out b.out a.exe a_out.exe - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_got_underscore" >&5 -echo "${ECHO_T}$gmp_cv_asm_x86_got_underscore" >&6; } -if test "$gmp_cv_asm_x86_got_underscore" = "yes"; then - -echo 'define(, <_>)' >>$gmp_tmpconfigm4 - -else - -echo 'define(, <>)' >>$gmp_tmpconfigm4 - -fi - - -{ echo "$as_me:$LINENO: checking if the assembler takes cl with shldl" >&5 -echo $ECHO_N "checking if the assembler takes cl with shldl... $ECHO_C" >&6; } -if test "${gmp_cv_asm_x86_shldl_cl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.s <&5 - (eval $gmp_assemble) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - cat conftest.out >&5 - gmp_cv_asm_x86_shldl_cl=yes -else - cat conftest.out >&5 - echo "configure: failed program was:" >&5 - cat conftest.s >&5 - gmp_cv_asm_x86_shldl_cl=no -fi -rm -f conftest* - - -fi -{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_shldl_cl" >&5 -echo "${ECHO_T}$gmp_cv_asm_x86_shldl_cl" >&6; } -if test "$gmp_cv_asm_x86_shldl_cl" = "yes"; then - -echo 'define(, <1>)' >>$gmp_tmpconfigm4 - -else - -echo 'define(, <0>)' >>$gmp_tmpconfigm4 - -fi - - case $enable_profiling in - prof | gprof) - -{ echo "$as_me:$LINENO: checking how to call x86 mcount" >&5 -echo $ECHO_N "checking how to call x86 mcount... $ECHO_C" >&6; } -cat >conftest.c <&5 - (eval $gmp_asmout_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep '\.data' conftest.s >/dev/null; then - mcount_nonpic_reg=`sed -n '/esp/!s/.*movl.*,\(%[a-z]*\).*$/\1/p' conftest.s` - else - mcount_nonpic_reg= - fi - mcount_nonpic_call=`grep 'call.*mcount' conftest.s` - if test -z "$mcount_nonpic_call"; then - { { echo "$as_me:$LINENO: error: Cannot find mcount call for non-PIC" >&5 -echo "$as_me: error: Cannot find mcount call for non-PIC" >&2;} - { (exit 1); exit 1; }; } - fi - else - { { echo "$as_me:$LINENO: error: Cannot compile test program for non-PIC" >&5 -echo "$as_me: error: Cannot compile test program for non-PIC" >&2;} - { (exit 1); exit 1; }; } - fi -fi - -if test "$enable_shared" = yes; then - gmp_asmout_compile="$CC $CFLAGS $CPPFLAGS $lt_prog_compiler_pic -S conftest.c 1>&5" - if { (eval echo "$as_me:$LINENO: \"$gmp_asmout_compile\"") >&5 - (eval $gmp_asmout_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep '\.data' conftest.s >/dev/null; then - case $lt_prog_compiler_pic in - *-DDLL_EXPORT*) - # Windows DLLs have non-PIC style mcount - mcount_pic_reg=`sed -n '/esp/!s/.*movl.*,\(%[a-z]*\).*$/\1/p' conftest.s` - ;; - *) - mcount_pic_reg=`sed -n 's/.*GOTOFF.*,\(%[a-z]*\).*$/\1/p' conftest.s` - ;; - esac - else - mcount_pic_reg= - fi - mcount_pic_call=`grep 'call.*mcount' conftest.s` - if test -z "$mcount_pic_call"; then - { { echo "$as_me:$LINENO: error: Cannot find mcount call for PIC" >&5 -echo "$as_me: error: Cannot find mcount call for PIC" >&2;} - { (exit 1); exit 1; }; } - fi - else - { { echo "$as_me:$LINENO: error: Cannot compile test program for PIC" >&5 -echo "$as_me: error: Cannot compile test program for PIC" >&2;} - { (exit 1); exit 1; }; } - fi -fi - - -echo "define(, <\`$mcount_nonpic_reg'>)" >> $gmp_tmpconfigm4 - - -echo "define(,<\`$mcount_nonpic_call'>)" >> $gmp_tmpconfigm4 - - -echo "define(, <\`$mcount_pic_reg'>)" >> $gmp_tmpconfigm4 - - -echo "define(, <\`$mcount_pic_call'>)" >> $gmp_tmpconfigm4 - - -rm -f conftest.* -{ echo "$as_me:$LINENO: result: determined" >&5 -echo "${ECHO_T}determined" >&6; } - ;; - esac - case $host in - *-*-darwin*) - -echo "include_mpn(\`x86/darwin.m4')" >> $gmp_tmpconfigm4i - ;; - esac - ;; - 64) - -echo "include_mpn(\`x86_64/x86_64-defs.m4')" >> $gmp_tmpconfigm4i - - case $host in - *-*-darwin*) - -echo "include_mpn(\`x86_64/darwin.m4')" >> $gmp_tmpconfigm4i - ;; - esac - ;; - esac - ;; - esac -fi - -# For --enable-minithres, prepend "minithres" to path so that its special -# gmp-mparam.h will be used. -if test $enable_minithres = yes; then - path="minithres $path" -fi - -# Create link for gmp-mparam.h. -gmp_mparam_source= -for gmp_mparam_dir in $path; do - test "$no_create" = yes || rm -f gmp-mparam.h - tmp_file=$srcdir/mpn/$gmp_mparam_dir/gmp-mparam.h - if test -f $tmp_file; then - ac_config_links="$ac_config_links gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h" - - gmp_srclinks="$gmp_srclinks gmp-mparam.h" - gmp_mparam_source=$tmp_file - break - fi -done -if test -z "$gmp_mparam_source"; then - { { echo "$as_me:$LINENO: error: no version of gmp-mparam.h found in path: $path" >&5 -echo "$as_me: error: no version of gmp-mparam.h found in path: $path" >&2;} - { (exit 1); exit 1; }; } -fi - -# For a helpful message from tune/tuneup.c -gmp_mparam_suggest=$gmp_mparam_source -if test "$gmp_mparam_dir" = generic; then - for i in $path; do break; done - if test "$i" != generic; then - gmp_mparam_suggest="new file $srcdir/mpn/$i/gmp-mparam.h" - fi -fi - -cat >>confdefs.h <<_ACEOF -#define GMP_MPARAM_H_SUGGEST "$gmp_mparam_source" -_ACEOF - - - -# Copy any SQR_KARATSUBA_THRESHOLD from gmp-mparam.h to config.m4. -# Some versions of sqr_basecase.asm use this. -# Fat binaries do this on a per-file basis, so skip in that case. -# -if test -z "$fat_path"; then - tmp_gmp_karatsuba_sqr_threshold=`sed -n 's/^#define SQR_KARATSUBA_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source` - if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then - -echo "define(,<$tmp_gmp_karatsuba_sqr_threshold>)" >> $gmp_tmpconfigm4 - - fi -fi - - -# Sizes of some types, needed at preprocessing time. -# -# FIXME: The assumption that BITS_PER_MP_LIMB is 8*sizeof(mp_limb_t) might -# be slightly rash, but it's true everwhere we know of and ought to be true -# of any sensible system. In a generic C build, grepping LONG_BIT out of -# might be an alternative, for maximum portability. -# -{ echo "$as_me:$LINENO: checking for unsigned short" >&5 -echo $ECHO_N "checking for unsigned short... $ECHO_C" >&6; } -if test "${ac_cv_type_unsigned_short+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef unsigned short ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_unsigned_short=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned_short=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned_short" >&6; } - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ echo "$as_me:$LINENO: checking size of unsigned short" >&5 -echo $ECHO_N "checking size of unsigned short... $ECHO_C" >&6; } -if test "${ac_cv_sizeof_unsigned_short+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_unsigned_short=$ac_lo;; -'') if test "$ac_cv_type_unsigned_short" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned short) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned_short=0 - fi ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned short ac__type_sizeof_; -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (ac__type_sizeof_))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_unsigned_short=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -if test "$ac_cv_type_unsigned_short" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned short) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned_short=0 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val -fi -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short" >&5 -echo "${ECHO_T}$ac_cv_sizeof_unsigned_short" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short -_ACEOF - - -{ echo "$as_me:$LINENO: checking for unsigned" >&5 -echo $ECHO_N "checking for unsigned... $ECHO_C" >&6; } -if test "${ac_cv_type_unsigned+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef unsigned ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_unsigned=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned" >&6; } - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ echo "$as_me:$LINENO: checking size of unsigned" >&5 -echo $ECHO_N "checking size of unsigned... $ECHO_C" >&6; } -if test "${ac_cv_sizeof_unsigned+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_unsigned=$ac_lo;; -'') if test "$ac_cv_type_unsigned" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned=0 - fi ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned ac__type_sizeof_; -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (ac__type_sizeof_))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_unsigned=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -if test "$ac_cv_type_unsigned" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned=0 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val -fi -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned" >&5 -echo "${ECHO_T}$ac_cv_sizeof_unsigned" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED $ac_cv_sizeof_unsigned -_ACEOF - - -{ echo "$as_me:$LINENO: checking for unsigned long" >&5 -echo $ECHO_N "checking for unsigned long... $ECHO_C" >&6; } -if test "${ac_cv_type_unsigned_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef unsigned long ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_unsigned_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_unsigned_long=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned_long" >&6; } - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ echo "$as_me:$LINENO: checking size of unsigned long" >&5 -echo $ECHO_N "checking size of unsigned long... $ECHO_C" >&6; } -if test "${ac_cv_sizeof_unsigned_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_unsigned_long=$ac_lo;; -'') if test "$ac_cv_type_unsigned_long" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned long) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned_long=0 - fi ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - typedef unsigned long ac__type_sizeof_; -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (ac__type_sizeof_))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_unsigned_long=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -if test "$ac_cv_type_unsigned_long" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (unsigned long) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_unsigned_long=0 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val -fi -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_unsigned_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long -_ACEOF - - -{ echo "$as_me:$LINENO: checking for mp_limb_t" >&5 -echo $ECHO_N "checking for mp_limb_t... $ECHO_C" >&6; } -if test "${ac_cv_type_mp_limb_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - -typedef mp_limb_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_mp_limb_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_mp_limb_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_mp_limb_t" >&5 -echo "${ECHO_T}$ac_cv_type_mp_limb_t" >&6; } - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ echo "$as_me:$LINENO: checking size of mp_limb_t" >&5 -echo $ECHO_N "checking size of mp_limb_t... $ECHO_C" >&6; } -if test "${ac_cv_sizeof_mp_limb_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo=`expr '(' $ac_mid ')' + 1` -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_mp_limb_t=$ac_lo;; -'') if test "$ac_cv_type_mp_limb_t" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (mp_limb_t) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (mp_limb_t) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_mp_limb_t=0 - fi ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ -#define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ -#define GMP_LIMB_BITS 123 -$DEFN_LONG_LONG_LIMB -#include "$srcdir/gmp-h.in" - - - typedef mp_limb_t ac__type_sizeof_; -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (ac__type_sizeof_))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (ac__type_sizeof_)))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_mp_limb_t=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -if test "$ac_cv_type_mp_limb_t" = yes; then - { { echo "$as_me:$LINENO: error: cannot compute sizeof (mp_limb_t) -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (mp_limb_t) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - else - ac_cv_sizeof_mp_limb_t=0 - fi -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val -fi -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_mp_limb_t" >&5 -echo "${ECHO_T}$ac_cv_sizeof_mp_limb_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_MP_LIMB_T $ac_cv_sizeof_mp_limb_t -_ACEOF - - -if test "$ac_cv_sizeof_mp_limb_t" = 0; then - { { echo "$as_me:$LINENO: error: Oops, mp_limb_t doesn't seem to work" >&5 -echo "$as_me: error: Oops, mp_limb_t doesn't seem to work" >&2;} - { (exit 1); exit 1; }; } -fi -BITS_PER_MP_LIMB=`expr 8 \* $ac_cv_sizeof_mp_limb_t` - - -echo "define(,<$ac_cv_sizeof_unsigned>)" >> $gmp_tmpconfigm4 - - -# Check compiler limb size matches gmp-mparam.h -# -# FIXME: Some of the cycle counter objects in the tune directory depend on -# the size of ulong, it'd be possible to check that here, though a mismatch -# probably wouldn't want to be fatal, none of the libgmp assembler code -# depends on ulong. -# -mparam_bits=`sed -n 's/^#define BITS_PER_MP_LIMB[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source` -if test -n "$mparam_bits" && test "$mparam_bits" -ne $BITS_PER_MP_LIMB; then - if test "$test_CFLAGS" = set; then - { { echo "$as_me:$LINENO: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code -in this configuration expects $mparam_bits bits. -You appear to have set \$CFLAGS, perhaps you also need to tell GMP the -intended ABI, see \"ABI and ISA\" in the manual." >&5 -echo "$as_me: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code -in this configuration expects $mparam_bits bits. -You appear to have set \$CFLAGS, perhaps you also need to tell GMP the -intended ABI, see \"ABI and ISA\" in the manual." >&2;} - { (exit 1); exit 1; }; } - else - { { echo "$as_me:$LINENO: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code -in this configuration expects $mparam_bits bits." >&5 -echo "$as_me: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code -in this configuration expects $mparam_bits bits." >&2;} - { (exit 1); exit 1; }; } - fi -fi - - -echo "define(,$BITS_PER_MP_LIMB)" >> $gmp_tmpconfigm4 - - -echo "define(,$GMP_NAIL_BITS)" >> $gmp_tmpconfigm4 - - -echo "define(,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))" >> $gmp_tmpconfigm4 - - - -# Exclude the mpn random functions from mpbsd since that would drag in the -# top-level rand things, all of which are unnecessary for libmp. There's -# other unnecessary objects too actually, if we could be bothered figuring -# out exactly which they are. -# -mpn_objs_in_libmp= -for i in $mpn_objs_in_libgmp; do - case $i in - *random*) ;; - *) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;; - esac -done - - - - - - - -# A recompiled sqr_basecase for use in the tune program, if necessary. -TUNE_SQR_OBJ= -test -d tune || mkdir tune -case $sqr_basecase_source in - *.asm) - sqr_max=`sed -n 's/^def...(SQR_KARATSUBA_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source` - if test -n "$sqr_max"; then - TUNE_SQR_OBJ=sqr_asm.o - -cat >>confdefs.h <<_ACEOF -#define TUNE_SQR_KARATSUBA_MAX $sqr_max -_ACEOF - - fi - cat >tune/sqr_basecase.c <>confdefs.h <<\_ACEOF -#define TUNE_SQR_KARATSUBA_MAX SQR_KARATSUBA_MAX_GENERIC -_ACEOF - - cat >tune/sqr_basecase.c <&5 -echo $ECHO_N "checking for stack_t... $ECHO_C" >&6; } -if test "${ac_cv_type_stack_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -typedef stack_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_stack_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_stack_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_stack_t" >&5 -echo "${ECHO_T}$ac_cv_type_stack_t" >&6; } -if test $ac_cv_type_stack_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STACK_T 1 -_ACEOF - -HAVE_STACK_T_01=1 -else - HAVE_STACK_T_01=0 -fi - - - -# Configs for demos/calc directory -# -# AC_SUBST+AC_CONFIG_FILES is used for calc-config.h, rather than AC_DEFINE+ -# AC_CONFIG_HEADERS, since with the latter automake (1.8) will then put the -# directory (ie. demos/calc) into $(DEFAULT_INCLUDES) for every Makefile.in, -# which would look very strange. -# -# -lcurses is required by libreadline. On a typical SVR4 style system this -# normally doesn't have to be given explicitly, since libreadline.so will -# have a NEEDED record for it. But if someone for some reason is using only -# a static libreadline.a then we must give -lcurses. Readline (as of -# version 4.3) doesn't use libtool, so we can't rely on a .la to cover -# necessary dependencies. -# -# On a couple of systems we've seen libreadline available, but the headers -# not in the default include path, so check for readline/readline.h. We've -# also seen readline/history.h missing, not sure if that's just a broken -# install or a very old version, but check that too. -# -ac_config_files="$ac_config_files demos/calc/calc-config.h:demos/calc/calc-config-h.in" - -LIBCURSES= -if test $with_readline != no; then - { echo "$as_me:$LINENO: checking for tputs in -lncurses" >&5 -echo $ECHO_N "checking for tputs in -lncurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_ncurses_tputs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tputs (); -int -main () -{ -return tputs (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_ncurses_tputs=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ncurses_tputs=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tputs" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_tputs" >&6; } -if test $ac_cv_lib_ncurses_tputs = yes; then - LIBCURSES=-lncurses -else - { echo "$as_me:$LINENO: checking for tputs in -lcurses" >&5 -echo $ECHO_N "checking for tputs in -lcurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_curses_tputs+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tputs (); -int -main () -{ -return tputs (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_curses_tputs=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_curses_tputs=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tputs" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_tputs" >&6; } -if test $ac_cv_lib_curses_tputs = yes; then - LIBCURSES=-lcurses -fi - -fi - -fi - -use_readline=$with_readline -if test $with_readline = detect; then - use_readline=no - { echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 -echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; } -if test "${ac_cv_lib_readline_readline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lreadline $LIBCURSES $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char readline (); -int -main () -{ -return readline (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_readline_readline=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_readline_readline=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 -echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; } -if test $ac_cv_lib_readline_readline = yes; then - if test "${ac_cv_header_readline_readline_h+set}" = set; then - { echo "$as_me:$LINENO: checking for readline/readline.h" >&5 -echo $ECHO_N "checking for readline/readline.h... $ECHO_C" >&6; } -if test "${ac_cv_header_readline_readline_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_readline_h" >&5 -echo "${ECHO_T}$ac_cv_header_readline_readline_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking readline/readline.h usability" >&5 -echo $ECHO_N "checking readline/readline.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking readline/readline.h presence" >&5 -echo $ECHO_N "checking readline/readline.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: readline/readline.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: readline/readline.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: readline/readline.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: readline/readline.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: readline/readline.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: readline/readline.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: readline/readline.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: readline/readline.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: readline/readline.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/readline.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: readline/readline.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for readline/readline.h" >&5 -echo $ECHO_N "checking for readline/readline.h... $ECHO_C" >&6; } -if test "${ac_cv_header_readline_readline_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_readline_readline_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_readline_h" >&5 -echo "${ECHO_T}$ac_cv_header_readline_readline_h" >&6; } - -fi -if test $ac_cv_header_readline_readline_h = yes; then - if test "${ac_cv_header_readline_history_h+set}" = set; then - { echo "$as_me:$LINENO: checking for readline/history.h" >&5 -echo $ECHO_N "checking for readline/history.h... $ECHO_C" >&6; } -if test "${ac_cv_header_readline_history_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_history_h" >&5 -echo "${ECHO_T}$ac_cv_header_readline_history_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking readline/history.h usability" >&5 -echo $ECHO_N "checking readline/history.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking readline/history.h presence" >&5 -echo $ECHO_N "checking readline/history.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: readline/history.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: readline/history.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: readline/history.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: readline/history.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: readline/history.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: readline/history.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: readline/history.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: readline/history.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: readline/history.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: readline/history.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: readline/history.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to gmp-bugs@gmplib.org ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for readline/history.h" >&5 -echo $ECHO_N "checking for readline/history.h... $ECHO_C" >&6; } -if test "${ac_cv_header_readline_history_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_readline_history_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_history_h" >&5 -echo "${ECHO_T}$ac_cv_header_readline_history_h" >&6; } - -fi -if test $ac_cv_header_readline_history_h = yes; then - use_readline=yes -fi - - -fi - - -fi - - { echo "$as_me:$LINENO: checking readline detected" >&5 -echo $ECHO_N "checking readline detected... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: $use_readline" >&5 -echo "${ECHO_T}$use_readline" >&6; } -fi -if test $use_readline = yes; then - WITH_READLINE_01=1 - - LIBREADLINE=-lreadline - -else - WITH_READLINE_01=0 -fi -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - { echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - { echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test "x$LEX" != "x:"; then - cat >conftest.l <<_ACEOF -%% -a { ECHO; } -b { REJECT; } -c { yymore (); } -d { yyless (1); } -e { yyless (input () != 0); } -f { unput (yytext[0]); } -. { BEGIN INITIAL; } -%% -#ifdef YYTEXT_POINTER -extern char *yytext; -#endif -int -main (void) -{ - return ! yylex () + ! yywrap (); -} -_ACEOF -{ (ac_try="$LEX conftest.l" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$LEX conftest.l") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; } -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; } -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -if test -z "${LEXLIB+set}"; then - { echo "$as_me:$LINENO: checking lex library" >&5 -echo $ECHO_N "checking lex library... $ECHO_C" >&6; } -if test "${ac_cv_lib_lex+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_save_LIBS=$LIBS - ac_cv_lib_lex='none needed' - for ac_lib in '' -lfl -ll; do - LIBS="$ac_lib $ac_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_lex=$ac_lib -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - test "$ac_cv_lib_lex" != 'none needed' && break - done - LIBS=$ac_save_LIBS - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5 -echo "${ECHO_T}$ac_cv_lib_lex" >&6; } - test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex -fi - - -{ echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; } -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -ac_save_LIBS=$LIBS -LIBS="$LEXLIB $ac_save_LIBS" -cat >conftest.$ac_ext <<_ACEOF -#define YYTEXT_POINTER 1 -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; } -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -cat >>confdefs.h <<\_ACEOF -#define YYTEXT_POINTER 1 -_ACEOF - -fi -rm -f conftest.l $LEX_OUTPUT_ROOT.c - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi - -# Configs for demos/expr directory -# -# Libtool already runs an AC_CHECK_TOOL for ranlib, but we give -# AC_PROG_RANLIB anyway since automake is supposed to complain if it's not -# called. (Automake 1.8.4 doesn't, at least not when the only library is in -# an EXTRA_LIBRARIES.) -# -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - - - -# Create config.m4. - -echo "creating $gmp_configm4" -echo "d""nl $gmp_configm4. Generated automatically by configure." > $gmp_configm4 -if test -f $gmp_tmpconfigm4; then - echo "changequote(<,>)" >> $gmp_configm4 - echo "ifdef(<__CONFIG_M4_INCLUDED__>,,<" >> $gmp_configm4 - cat $gmp_tmpconfigm4 >> $gmp_configm4 - echo ">)" >> $gmp_configm4 - echo "changequote(\`,')" >> $gmp_configm4 - rm $gmp_tmpconfigm4 -fi -echo "ifdef(\`__CONFIG_M4_INCLUDED__',,\`" >> $gmp_configm4 -if test -f $gmp_tmpconfigm4i; then - cat $gmp_tmpconfigm4i >> $gmp_configm4 - rm $gmp_tmpconfigm4i -fi -if test -f $gmp_tmpconfigm4p; then - cat $gmp_tmpconfigm4p >> $gmp_configm4 - rm $gmp_tmpconfigm4p -fi -echo "')" >> $gmp_configm4 -echo "define(\`__CONFIG_M4_INCLUDED__')" >> $gmp_configm4 - - -# Create Makefiles -# FIXME: Upcoming version of autoconf/automake may not like broken lines. -# Right now automake isn't accepting the new AC_CONFIG_FILES scheme. - -ac_config_files="$ac_config_files Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in mp.h:mp-h.in" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${WANT_MPBSD_TRUE}" && test -z "${WANT_MPBSD_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"WANT_MPBSD\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"WANT_MPBSD\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${WANT_CXX_TRUE}" && test -z "${WANT_CXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"WANT_CXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"WANT_CXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${ENABLE_STATIC_TRUE}" && test -z "${ENABLE_STATIC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"ENABLE_STATIC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"ENABLE_STATIC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by GNU MP $as_me 4.3.2, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_links="$ac_config_links" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration links: -$config_links - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -GNU MP config.status 4.3.2 -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - { echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; - "mpn/$tmp_fn.$tmp_ext") CONFIG_LINKS="$CONFIG_LINKS mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext" ;; - "gmp-mparam.h") CONFIG_LINKS="$CONFIG_LINKS gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h" ;; - "demos/pexpr-config.h") CONFIG_FILES="$CONFIG_FILES demos/pexpr-config.h:demos/pexpr-config-h.in" ;; - "demos/calc/calc-config.h") CONFIG_FILES="$CONFIG_FILES demos/calc/calc-config.h:demos/calc/calc-config-h.in" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "mpbsd/Makefile") CONFIG_FILES="$CONFIG_FILES mpbsd/Makefile" ;; - "mpf/Makefile") CONFIG_FILES="$CONFIG_FILES mpf/Makefile" ;; - "mpn/Makefile") CONFIG_FILES="$CONFIG_FILES mpn/Makefile" ;; - "mpq/Makefile") CONFIG_FILES="$CONFIG_FILES mpq/Makefile" ;; - "mpz/Makefile") CONFIG_FILES="$CONFIG_FILES mpz/Makefile" ;; - "printf/Makefile") CONFIG_FILES="$CONFIG_FILES printf/Makefile" ;; - "scanf/Makefile") CONFIG_FILES="$CONFIG_FILES scanf/Makefile" ;; - "cxx/Makefile") CONFIG_FILES="$CONFIG_FILES cxx/Makefile" ;; - "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "tests/devel/Makefile") CONFIG_FILES="$CONFIG_FILES tests/devel/Makefile" ;; - "tests/mpbsd/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpbsd/Makefile" ;; - "tests/mpf/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpf/Makefile" ;; - "tests/mpn/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpn/Makefile" ;; - "tests/mpq/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpq/Makefile" ;; - "tests/mpz/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpz/Makefile" ;; - "tests/rand/Makefile") CONFIG_FILES="$CONFIG_FILES tests/rand/Makefile" ;; - "tests/misc/Makefile") CONFIG_FILES="$CONFIG_FILES tests/misc/Makefile" ;; - "tests/cxx/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cxx/Makefile" ;; - "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;; - "demos/Makefile") CONFIG_FILES="$CONFIG_FILES demos/Makefile" ;; - "demos/calc/Makefile") CONFIG_FILES="$CONFIG_FILES demos/calc/Makefile" ;; - "demos/expr/Makefile") CONFIG_FILES="$CONFIG_FILES demos/expr/Makefile" ;; - "gmp.h") CONFIG_FILES="$CONFIG_FILES gmp.h:gmp-h.in" ;; - "mp.h") CONFIG_FILES="$CONFIG_FILES mp.h:mp-h.in" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CYGPATH_W!$CYGPATH_W$ac_delim -PACKAGE!$PACKAGE$ac_delim -VERSION!$VERSION$ac_delim -ACLOCAL!$ACLOCAL$ac_delim -AUTOCONF!$AUTOCONF$ac_delim -AUTOMAKE!$AUTOMAKE$ac_delim -AUTOHEADER!$AUTOHEADER$ac_delim -MAKEINFO!$MAKEINFO$ac_delim -AMTAR!$AMTAR$ac_delim -install_sh!$install_sh$ac_delim -STRIP!$STRIP$ac_delim -INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim -mkdir_p!$mkdir_p$ac_delim -AWK!$AWK$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -am__leading_dot!$am__leading_dot$ac_delim -MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim -MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim -MAINT!$MAINT$ac_delim -WANT_MPBSD_TRUE!$WANT_MPBSD_TRUE$ac_delim -WANT_MPBSD_FALSE!$WANT_MPBSD_FALSE$ac_delim -GMP_NAIL_BITS!$GMP_NAIL_BITS$ac_delim -ABI!$ABI$ac_delim -HAVE_HOST_CPU_FAMILY_power!$HAVE_HOST_CPU_FAMILY_power$ac_delim -HAVE_HOST_CPU_FAMILY_powerpc!$HAVE_HOST_CPU_FAMILY_powerpc$ac_delim -GMP_LDFLAGS!$GMP_LDFLAGS$ac_delim -LIBGMP_LDFLAGS!$LIBGMP_LDFLAGS$ac_delim -LIBGMPXX_LDFLAGS!$LIBGMPXX_LDFLAGS$ac_delim -SPEED_CYCLECOUNTER_OBJ!$SPEED_CYCLECOUNTER_OBJ$ac_delim -CALLING_CONVENTIONS_OBJS!$CALLING_CONVENTIONS_OBJS$ac_delim -DEFN_LONG_LONG_LIMB!$DEFN_LONG_LONG_LIMB$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CPP!$CPP$ac_delim -CC_FOR_BUILD!$CC_FOR_BUILD$ac_delim -CPP_FOR_BUILD!$CPP_FOR_BUILD$ac_delim -EXEEXT_FOR_BUILD!$EXEEXT_FOR_BUILD$ac_delim -U_FOR_BUILD!$U_FOR_BUILD$ac_delim -LIBM_FOR_BUILD!$LIBM_FOR_BUILD$ac_delim -CCAS!$CCAS$ac_delim -CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim -WANT_CXX_TRUE!$WANT_CXX_TRUE$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -CEOF$ac_eof -_ACEOF - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -WANT_CXX_FALSE!$WANT_CXX_FALSE$ac_delim -CXXCPP!$CXXCPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -U!$U$ac_delim -ANSI2KNR!$ANSI2KNR$ac_delim -ASMFLAGS!$ASMFLAGS$ac_delim -AR!$AR$ac_delim -LIBGMP_DLL!$LIBGMP_DLL$ac_delim -SED!$SED$ac_delim -LN_S!$LN_S$ac_delim -ECHO!$ECHO$ac_delim -RANLIB!$RANLIB$ac_delim -DLLTOOL!$DLLTOOL$ac_delim -AS!$AS$ac_delim -OBJDUMP!$OBJDUMP$ac_delim -LIBTOOL!$LIBTOOL$ac_delim -ENABLE_STATIC_TRUE!$ENABLE_STATIC_TRUE$ac_delim -ENABLE_STATIC_FALSE!$ENABLE_STATIC_FALSE$ac_delim -LIBM!$LIBM$ac_delim -TAL_OBJECT!$TAL_OBJECT$ac_delim -M4!$M4$ac_delim -BITS_PER_MP_LIMB!$BITS_PER_MP_LIMB$ac_delim -mpn_objs_in_libmp!$mpn_objs_in_libmp$ac_delim -mpn_objects!$mpn_objects$ac_delim -mpn_objs_in_libgmp!$mpn_objs_in_libgmp$ac_delim -gmp_srclinks!$gmp_srclinks$ac_delim -TUNE_SQR_OBJ!$TUNE_SQR_OBJ$ac_delim -HAVE_CLOCK_01!$HAVE_CLOCK_01$ac_delim -HAVE_CPUTIME_01!$HAVE_CPUTIME_01$ac_delim -HAVE_GETRUSAGE_01!$HAVE_GETRUSAGE_01$ac_delim -HAVE_GETTIMEOFDAY_01!$HAVE_GETTIMEOFDAY_01$ac_delim -HAVE_SIGACTION_01!$HAVE_SIGACTION_01$ac_delim -HAVE_SIGALTSTACK_01!$HAVE_SIGALTSTACK_01$ac_delim -HAVE_SIGSTACK_01!$HAVE_SIGSTACK_01$ac_delim -HAVE_SYS_RESOURCE_H_01!$HAVE_SYS_RESOURCE_H_01$ac_delim -HAVE_STACK_T_01!$HAVE_STACK_T_01$ac_delim -LIBCURSES!$LIBCURSES$ac_delim -WITH_READLINE_01!$WITH_READLINE_01$ac_delim -LIBREADLINE!$LIBREADLINE$ac_delim -YACC!$YACC$ac_delim -YFLAGS!$YFLAGS$ac_delim -LEX!$LEX$ac_delim -LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim -LEXLIB!$LEXLIB$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - :H) - # - # CONFIG_HEADER - # -_ACEOF - -# Transform confdefs.h into a sed script `conftest.defines', that -# substitutes the proper values into config.h.in to produce config.h. -rm -f conftest.defines conftest.tail -# First, append a space to every undef/define line, to ease matching. -echo 's/$/ /' >conftest.defines -# Then, protect against being on the right side of a sed subst, or in -# an unquoted here document, in config.status. If some macros were -# called several times there might be several #defines for the same -# symbol, which is useless. But do not sort them, since the last -# AC_DEFINE must be honored. -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where -# NAME is the cpp macro being defined, VALUE is the value it is being given. -# PARAMS is the parameter list in the macro definition--in most cases, it's -# just an empty string. -ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' -ac_dB='\\)[ (].*,\\1define\\2' -ac_dC=' ' -ac_dD=' ,' - -uniq confdefs.h | - sed -n ' - t rset - :rset - s/^[ ]*#[ ]*define[ ][ ]*// - t ok - d - :ok - s/[\\&,]/\\&/g - s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p - s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p - ' >>conftest.defines - -# Remove the space that was appended to ease matching. -# Then replace #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -# (The regexp can be short, since the line contains either #define or #undef.) -echo 's/ $// -s,^[ #]*u.*,/* & */,' >>conftest.defines - -# Break up conftest.defines: -ac_max_sed_lines=50 - -# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" -# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" -# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" -# et cetera. -ac_in='$ac_file_inputs' -ac_out='"$tmp/out1"' -ac_nxt='"$tmp/out2"' - -while : -do - # Write a here document: - cat >>$CONFIG_STATUS <<_ACEOF - # First, check the format of the line: - cat >"\$tmp/defines.sed" <<\\CEOF -/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def -/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def -b -:def -_ACEOF - sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS - ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in - sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail - grep . conftest.tail >/dev/null || break - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines conftest.tail - -echo "ac_result=$ac_in" >>$CONFIG_STATUS -cat >>$CONFIG_STATUS <<\_ACEOF - if test x"$ac_file" != x-; then - echo "/* $configure_input */" >"$tmp/config.h" - cat "$ac_result" >>"$tmp/config.h" - if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f $ac_file - mv "$tmp/config.h" $ac_file - fi - else - echo "/* $configure_input */" - cat "$ac_result" - fi - rm -f "$tmp/out12" -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| . 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - :L) - # - # CONFIG_LINK - # - - { echo "$as_me:$LINENO: linking $srcdir/$ac_source to $ac_file" >&5 -echo "$as_me: linking $srcdir/$ac_source to $ac_file" >&6;} - - if test ! -r "$srcdir/$ac_source"; then - { { echo "$as_me:$LINENO: error: $srcdir/$ac_source: file not found" >&5 -echo "$as_me: error: $srcdir/$ac_source: file not found" >&2;} - { (exit 1); exit 1; }; } - fi - rm -f "$ac_file" - - # Try a relative symlink, then a hard link, then a copy. - case $srcdir in - [\\/$]* | ?:[\\/]* ) ac_rel_source=$srcdir/$ac_source ;; - *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;; - esac - ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || - ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null || - cp -p "$srcdir/$ac_source" "$ac_file" || - { { echo "$as_me:$LINENO: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&5 -echo "$as_me: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&2;} - { (exit 1); exit 1; }; } - ;; - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/contrib/gmp/dumbmp.c b/contrib/gmp/dumbmp.c index cd8c67d369..c87aae451c 100644 --- a/contrib/gmp/dumbmp.c +++ b/contrib/gmp/dumbmp.c @@ -101,16 +101,41 @@ mem_copyi (char *dst, char *src, int size) dst[i] = src[i]; } -int -isprime (int n) +static int +isprime (unsigned long int t) { - int i; - if (n < 2) + unsigned long int q, r, d; + + if (t < 32) + return (0xa08a28acUL >> t) & 1; + if ((t & 1) == 0) + return 0; + + if (t % 3 == 0) return 0; - for (i = 2; i < n; i++) - if ((n % i) == 0) - return 0; - return 1; + if (t % 5 == 0) + return 0; + if (t % 7 == 0) + return 0; + + for (d = 11;;) + { + q = t / d; + r = t - q * d; + if (q < d) + return 1; + if (r == 0) + break; + d += 2; + q = t / d; + r = t - q * d; + if (q < d) + return 1; + if (r == 0) + break; + d += 4; + } + return 0; } int @@ -678,6 +703,16 @@ mpz_tdiv_q (mpz_t q, mpz_t a, mpz_t b) mpz_clear (r); } +void +mpz_tdiv_r (mpz_t r, mpz_t a, mpz_t b) +{ + mpz_t q; + + mpz_init (q); + mpz_tdiv_qr (q, r, a, b); + mpz_clear (q); +} + void mpz_tdiv_q_ui (mpz_t q, mpz_t n, unsigned long d) { diff --git a/contrib/gmp/gen-trialdivtab.c b/contrib/gmp/gen-trialdivtab.c new file mode 100644 index 0000000000..708253926f --- /dev/null +++ b/contrib/gmp/gen-trialdivtab.c @@ -0,0 +1,298 @@ +/* gen-trialdivtab.c + + Contributed to the GNU project by Torbjorn Granlund. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +/* + Generate tables for fast, division-free trial division for GMP. + + There is one main table, ptab. It contains primes, multiplied together, and + several types of pre-computed inverses. It refers to tables of the type + dtab, via the last two indices. That table contains the individual primes in + the range, except that the primes are not actually included in the table (see + the P macro; it sneakingly excludes the primes themselves). Instead, the + dtab tables contains tuples for each prime (modular-inverse, limit) used for + divisibility checks. + + This interface is not intended for division of very many primes, since then + other algorithms apply. +*/ + +#include +#include +#include "dumbmp.c" + +int sumspills (mpz_t, mpz_t *, int); +void mpn_mod_1s_4p_cps (mpz_t [7], mpz_t); + +int limb_bits; + +mpz_t B; + +int +main (int argc, char *argv[]) +{ + unsigned long t, p; + mpz_t ppp, acc, inv, gmp_numb_max, tmp, Bhalf; + mpz_t pre[7]; + int i; + int start_p, end_p, interval_start, interval_end, omitted_p; + char *endtok; + int stop; + int np, start_idx; + + if (argc < 2) + { + fprintf (stderr, "usage: %s bits endprime\n", argv[0]); + exit (1); + } + + limb_bits = atoi (argv[1]); + + end_p = 1290; /* default end prime */ + if (argc == 3) + end_p = atoi (argv[2]); + + printf ("#if GMP_LIMB_BITS != %d\n", limb_bits); + printf ("#error This table is for GMP_LIMB_BITS = %d\n", limb_bits); + printf ("#endif\n\n"); + + printf ("#if GMP_NAIL_BITS != 0\n"); + printf ("#error This table does not support nails\n"); + printf ("#endif\n\n"); + + for (i = 0; i < 7; i++) + mpz_init (pre[i]); + + mpz_init_set_ui (gmp_numb_max, 1); + mpz_mul_2exp (gmp_numb_max, gmp_numb_max, limb_bits); + mpz_sub_ui (gmp_numb_max, gmp_numb_max, 1); + + mpz_init (tmp); + mpz_init (inv); + + mpz_init_set_ui (B, 1); mpz_mul_2exp (B, B, limb_bits); + mpz_init_set_ui (Bhalf, 1); mpz_mul_2exp (Bhalf, Bhalf, limb_bits - 1); + + start_p = 3; + + mpz_init_set_ui (ppp, 1); + mpz_init (acc); + interval_start = start_p; + omitted_p = 3; + interval_end = 0; + + printf ("static struct gmp_primes_dtab gmp_primes_dtab[] = {\n"); + + for (t = start_p; t <= end_p; t += 2) + { + if (! isprime (t)) + continue; + + mpz_mul_ui (acc, ppp, t); + stop = mpz_cmp (acc, Bhalf) >= 0; + if (!stop) + { + mpn_mod_1s_4p_cps (pre, acc); + stop = sumspills (acc, pre + 2, 5); + } + + if (stop) + { + for (p = interval_start; p <= interval_end; p += 2) + { + if (! isprime (p)) + continue; + + printf (" P(%d,", (int) p); + mpz_invert_ui_2exp (inv, p, limb_bits); + printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, inv); printf ("),"); + + mpz_tdiv_q_ui (tmp, gmp_numb_max, p); + printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, tmp); + printf (")),\n"); + } + mpz_set_ui (ppp, t); + interval_start = t; + omitted_p = t; + } + else + { + mpz_set (ppp, acc); + } + interval_end = t; + } + printf (" P(0,0,0)\n};\n"); + + + printf ("static struct gmp_primes_ptab gmp_primes_ptab[] = {\n"); + + endtok = ""; + + mpz_set_ui (ppp, 1); + interval_start = start_p; + interval_end = 0; + np = 0; + start_idx = 0; + for (t = start_p; t <= end_p; t += 2) + { + if (! isprime (t)) + continue; + + mpz_mul_ui (acc, ppp, t); + + stop = mpz_cmp (acc, Bhalf) >= 0; + if (!stop) + { + mpn_mod_1s_4p_cps (pre, acc); + stop = sumspills (acc, pre + 2, 5); + } + + if (stop) + { + mpn_mod_1s_4p_cps (pre, ppp); + printf ("%s", endtok); + printf (" {CNST_LIMB(0x"); mpz_out_str (stdout, 16, ppp); + printf ("),{CNST_LIMB(0x"); mpz_out_str (stdout, 16, pre[0]); + printf ("),%d", (int) PTR(pre[1])[0]); + for (i = 0; i < 5; i++) + { + printf (","); + printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, pre[2 + i]); + printf (")"); + } + printf ("},"); + printf ("%d,", start_idx); + printf ("%d}", np - start_idx); + + endtok = ",\n"; + mpz_set_ui (ppp, t); + interval_start = t; + start_idx = np; + } + else + { + mpz_set (ppp, acc); + } + interval_end = t; + np++; + } + printf ("\n};\n"); + + printf ("#define SMALLEST_OMITTED_PRIME %d\n", (int) omitted_p); + + return 0; +} + +unsigned long +mpz_log2 (mpz_t x) +{ + mpz_t y; + unsigned long cnt; + + mpz_init (y); + mpz_set (y, x); + cnt = 0; + while (mpz_sgn (y) != 0) + { + mpz_tdiv_q_2exp (y, y, 1); + cnt++; + } + mpz_clear (y); + + return cnt; +} + +void +mpn_mod_1s_4p_cps (mpz_t cps[7], mpz_t bparm) +{ + mpz_t b, bi; + mpz_t B1modb, B2modb, B3modb, B4modb, B5modb; + mpz_t t; + int cnt; + + mpz_init_set (b, bparm); + + cnt = limb_bits - mpz_log2 (b); + + mpz_init (bi); + mpz_init (t); + mpz_init (B1modb); + mpz_init (B2modb); + mpz_init (B3modb); + mpz_init (B4modb); + mpz_init (B5modb); + + mpz_set_ui (t, 1); + mpz_mul_2exp (t, t, limb_bits - cnt); + mpz_sub (t, t, b); + mpz_mul_2exp (t, t, limb_bits); + mpz_tdiv_q (bi, t, b); /* bi = B^2/b, except msb */ + + mpz_set_ui (t, 1); + mpz_mul_2exp (t, t, limb_bits); /* t = B */ + mpz_tdiv_r (B1modb, t, b); + + mpz_mul_2exp (t, B1modb, limb_bits); + mpz_tdiv_r (B2modb, t, b); + + mpz_mul_2exp (t, B2modb, limb_bits); + mpz_tdiv_r (B3modb, t, b); + + mpz_mul_2exp (t, B3modb, limb_bits); + mpz_tdiv_r (B4modb, t, b); + + mpz_mul_2exp (t, B4modb, limb_bits); + mpz_tdiv_r (B5modb, t, b); + + mpz_set (cps[0], bi); + mpz_set_ui (cps[1], cnt); + mpz_tdiv_q_2exp (cps[2], B1modb, 0); + mpz_tdiv_q_2exp (cps[3], B2modb, 0); + mpz_tdiv_q_2exp (cps[4], B3modb, 0); + mpz_tdiv_q_2exp (cps[5], B4modb, 0); + mpz_tdiv_q_2exp (cps[6], B5modb, 0); + + mpz_clear (b); + mpz_clear (bi); + mpz_clear (t); + mpz_clear (B1modb); + mpz_clear (B2modb); + mpz_clear (B3modb); + mpz_clear (B4modb); + mpz_clear (B5modb); +} + +int +sumspills (mpz_t ppp, mpz_t *a, int n) +{ + mpz_t s; + int i, ret; + + mpz_init_set (s, a[0]); + + for (i = 1; i < n; i++) + { + mpz_add (s, s, a[i]); + } + ret = mpz_cmp (s, B) >= 0; + mpz_clear (s); + + return ret; +} diff --git a/contrib/gmp/gmp-h.in b/contrib/gmp/gmp-h.in deleted file mode 100644 index d7fbc347cb..0000000000 --- a/contrib/gmp/gmp-h.in +++ /dev/null @@ -1,2230 +0,0 @@ -/* Definitions for GNU multiple precision functions. -*- mode: c -*- - -Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, -2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#ifndef __GMP_H__ - -#if defined (__cplusplus) -#include /* for std::istream, std::ostream, std::string */ -#include -#endif - - -/* Instantiated by configure. */ -#if ! defined (__GMP_WITHIN_CONFIGURE) -#define __GMP_BITS_PER_MP_LIMB @BITS_PER_MP_LIMB@ -#define __GMP_HAVE_HOST_CPU_FAMILY_power @HAVE_HOST_CPU_FAMILY_power@ -#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc @HAVE_HOST_CPU_FAMILY_powerpc@ -#define GMP_LIMB_BITS @BITS_PER_MP_LIMB@ -#define GMP_NAIL_BITS @GMP_NAIL_BITS@ -#endif -#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS) -#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS) -#define GMP_NUMB_MAX GMP_NUMB_MASK -#define GMP_NAIL_MASK (~ GMP_NUMB_MASK) - - -/* The following (everything under ifndef __GNU_MP__) must be identical in - gmp.h and mp.h to allow both to be included in an application or during - the library build. */ -#ifndef __GNU_MP__ -#define __GNU_MP__ 4 - -#define __need_size_t /* tell gcc stddef.h we only want size_t */ -#if defined (__cplusplus) -#include /* for size_t */ -#else -#include /* for size_t */ -#endif -#undef __need_size_t - -/* Instantiated by configure. */ -#if ! defined (__GMP_WITHIN_CONFIGURE) -@DEFN_LONG_LONG_LIMB@ -#define __GMP_LIBGMP_DLL @LIBGMP_DLL@ -#endif - - -/* __STDC__ - some ANSI compilers define this only to 0, hence the use of - "defined" and not "__STDC__-0". In particular Sun workshop C 5.0 - sets __STDC__ to 0, but requires "##" for token pasting. - - _AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but - don't always define __STDC__. - - __DECC - current versions of DEC C (5.9 for instance) for alpha are ANSI, - but don't define __STDC__ in their default mode. Don't know if old - versions might have been K&R, but let's not worry about that unless - someone is still using one. - - _mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4 - mode, but doesn't define __STDC__. - - _MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za - option is given (in which case it's 1). - - _WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that - all w32 compilers are ansi. - - Note: This same set of tests is used by gen-psqr.c and - demos/expr/expr-impl.h, so if anything needs adding, then be sure to - update those too. */ - -#if defined (__STDC__) \ - || defined (__cplusplus) \ - || defined (_AIX) \ - || defined (__DECC) \ - || (defined (__mips) && defined (_SYSTYPE_SVR4)) \ - || defined (_MSC_VER) \ - || defined (_WIN32) -#define __GMP_HAVE_CONST 1 -#define __GMP_HAVE_PROTOTYPES 1 -#define __GMP_HAVE_TOKEN_PASTE 1 -#else -#define __GMP_HAVE_CONST 0 -#define __GMP_HAVE_PROTOTYPES 0 -#define __GMP_HAVE_TOKEN_PASTE 0 -#endif - - -#if __GMP_HAVE_CONST -#define __gmp_const const -#define __gmp_signed signed -#else -#define __gmp_const -#define __gmp_signed -#endif - - -/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in - all other circumstances. - - When compiling objects for libgmp, __GMP_DECLSPEC is an export directive, - or when compiling for an application it's an import directive. The two - cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles - (and not defined from an application). - - __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX - indicates when building libgmpxx, and in that case libgmpxx functions are - exports, but libgmp functions which might get called are imports. - - libmp.la uses __GMP_DECLSPEC, just as if it were libgmp.la. libgmp and - libmp don't call each other, so there's no conflict or confusion. - - Libtool DLL_EXPORT define is not used. - - There's no attempt to support GMP built both static and DLL. Doing so - would mean applications would have to tell us which of the two is going - to be used when linking, and that seems very tedious and error prone if - using GMP by hand, and equally tedious from a package since autoconf and - automake don't give much help. - - __GMP_DECLSPEC is required on all documented global functions and - variables, the various internals in gmp-impl.h etc can be left unadorned. - But internals used by the test programs or speed measuring programs - should have __GMP_DECLSPEC, and certainly constants or variables must - have it or the wrong address will be resolved. - - In gcc __declspec can go at either the start or end of a prototype. - - In Microsoft C __declspec must go at the start, or after the type like - void __declspec(...) *foo()". There's no __dllexport or anything to - guard against someone foolish #defining dllexport. _export used to be - available, but no longer. - - In Borland C _export still exists, but needs to go after the type, like - "void _export foo();". Would have to change the __GMP_DECLSPEC syntax to - make use of that. Probably more trouble than it's worth. */ - -#if defined (__GNUC__) -#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__) -#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__) -#endif -#if defined (_MSC_VER) || defined (__BORLANDC__) -#define __GMP_DECLSPEC_EXPORT __declspec(dllexport) -#define __GMP_DECLSPEC_IMPORT __declspec(dllimport) -#endif -#ifdef __WATCOMC__ -#define __GMP_DECLSPEC_EXPORT __export -#define __GMP_DECLSPEC_IMPORT __import -#endif -#ifdef __IBMC__ -#define __GMP_DECLSPEC_EXPORT _Export -#define __GMP_DECLSPEC_IMPORT _Import -#endif - -#if __GMP_LIBGMP_DLL -#if __GMP_WITHIN_GMP -/* compiling to go into a DLL libgmp */ -#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT -#else -/* compiling to go into an application which will link to a DLL libgmp */ -#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT -#endif -#else -/* all other cases */ -#define __GMP_DECLSPEC -#endif - - -#ifdef __GMP_SHORT_LIMB -typedef unsigned int mp_limb_t; -typedef int mp_limb_signed_t; -#else -#ifdef _LONG_LONG_LIMB -typedef unsigned long long int mp_limb_t; -typedef long long int mp_limb_signed_t; -#else -typedef unsigned long int mp_limb_t; -typedef long int mp_limb_signed_t; -#endif -#endif - -/* For reference, note that the name __mpz_struct gets into C++ mangled - function names, which means although the "__" suggests an internal, we - must leave this name for binary compatibility. */ -typedef struct -{ - int _mp_alloc; /* Number of *limbs* allocated and pointed - to by the _mp_d field. */ - int _mp_size; /* abs(_mp_size) is the number of limbs the - last field points to. If _mp_size is - negative this is a negative number. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpz_struct; - -#endif /* __GNU_MP__ */ - - -typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */ -typedef __mpz_struct mpz_t[1]; - -typedef mp_limb_t * mp_ptr; -typedef __gmp_const mp_limb_t * mp_srcptr; -#if defined (_CRAY) && ! defined (_CRAYMPP) -/* plain `int' is much faster (48 bits) */ -#define __GMP_MP_SIZE_T_INT 1 -typedef int mp_size_t; -typedef int mp_exp_t; -#else -#define __GMP_MP_SIZE_T_INT 0 -typedef long int mp_size_t; -typedef long int mp_exp_t; -#endif - -typedef struct -{ - __mpz_struct _mp_num; - __mpz_struct _mp_den; -} __mpq_struct; - -typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */ -typedef __mpq_struct mpq_t[1]; - -typedef struct -{ - int _mp_prec; /* Max precision, in number of `mp_limb_t's. - Set by mpf_init and modified by - mpf_set_prec. The area pointed to by the - _mp_d field contains `prec' + 1 limbs. */ - int _mp_size; /* abs(_mp_size) is the number of limbs the - last field points to. If _mp_size is - negative this is a negative number. */ - mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpf_struct; - -/* typedef __mpf_struct MP_FLOAT; */ -typedef __mpf_struct mpf_t[1]; - -/* Available random number generation algorithms. */ -typedef enum -{ - GMP_RAND_ALG_DEFAULT = 0, - GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */ -} gmp_randalg_t; - -/* Random state struct. */ -typedef struct -{ - mpz_t _mp_seed; /* _mp_d member points to state of the generator. */ - gmp_randalg_t _mp_alg; /* Currently unused. */ - union { - void *_mp_lc; /* Pointer to function pointers structure. */ - } _mp_algdata; -} __gmp_randstate_struct; -typedef __gmp_randstate_struct gmp_randstate_t[1]; - -/* Types for function declarations in gmp files. */ -/* ??? Should not pollute user name space with these ??? */ -typedef __gmp_const __mpz_struct *mpz_srcptr; -typedef __mpz_struct *mpz_ptr; -typedef __gmp_const __mpf_struct *mpf_srcptr; -typedef __mpf_struct *mpf_ptr; -typedef __gmp_const __mpq_struct *mpq_srcptr; -typedef __mpq_struct *mpq_ptr; - - -/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common - section. */ -#if __GMP_LIBGMP_DLL -#if __GMP_WITHIN_GMPXX -/* compiling to go into a DLL libgmpxx */ -#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT -#else -/* compiling to go into a application which will link to a DLL libgmpxx */ -#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT -#endif -#else -/* all other cases */ -#define __GMP_DECLSPEC_XX -#endif - - -#if __GMP_HAVE_PROTOTYPES -#define __GMP_PROTO(x) x -#else -#define __GMP_PROTO(x) () -#endif - -#ifndef __MPN -#if __GMP_HAVE_TOKEN_PASTE -#define __MPN(x) __gmpn_##x -#else -#define __MPN(x) __gmpn_/**/x -#endif -#endif - -/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4, - defines EOF but not FILE. */ -#if defined (FILE) \ - || defined (H_STDIO) \ - || defined (_H_STDIO) /* AIX */ \ - || defined (_STDIO_H) /* glibc, Sun, SCO */ \ - || defined (_STDIO_H_) /* BSD, OSF */ \ - || defined (__STDIO_H) /* Borland */ \ - || defined (__STDIO_H__) /* IRIX */ \ - || defined (_STDIO_INCLUDED) /* HPUX */ \ - || defined (__dj_include_stdio_h_) /* DJGPP */ \ - || defined (_FILE_DEFINED) /* Microsoft */ \ - || defined (__STDIO__) /* Apple MPW MrC */ \ - || defined (_MSL_STDIO_H) /* Metrowerks */ \ - || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ - || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ -#define _GMP_H_HAVE_FILE 1 -#endif - -/* In ISO C, if a prototype involving "struct obstack *" is given without - that structure defined, then the struct is scoped down to just the - prototype, causing a conflict if it's subsequently defined for real. So - only give prototypes if we've got obstack.h. */ -#if defined (_OBSTACK_H) /* glibc */ -#define _GMP_H_HAVE_OBSTACK 1 -#endif - -/* The prototypes for gmp_vprintf etc are provided only if va_list is - available, via an application having included or . - Usually va_list is a typedef so can't be tested directly, but C99 - specifies that va_start is a macro (and it was normally a macro on past - systems too), so look for that. - - will define some sort of va_list for vprintf and vfprintf, but - let's not bother trying to use that since it's not standard and since - application uses for gmp_vprintf etc will almost certainly require the - whole or anyway. */ - -#ifdef va_start -#define _GMP_H_HAVE_VA_LIST 1 -#endif - -/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */ -#if defined (__GNUC__) && defined (__GNUC_MINOR__) -#define __GMP_GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -#else -#define __GMP_GNUC_PREREQ(maj, min) 0 -#endif - -/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically - it means a function does nothing but examine its arguments and memory - (global or via arguments) to generate a return value, but changes nothing - and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets - tune/common.c etc turn this off when trying to write timing loops. */ -#if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE) -#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__)) -#else -#define __GMP_ATTRIBUTE_PURE -#endif - - -/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean - to "g++ -Wold-style-cast". - - Casts in "extern inline" code within an extern "C" block don't induce - these warnings, so __GMP_CAST only needs to be used on documented - macros. */ - -#ifdef __cplusplus -#define __GMP_CAST(type, expr) (static_cast (expr)) -#else -#define __GMP_CAST(type, expr) ((type) (expr)) -#endif - - -/* An empty "throw ()" means the function doesn't throw any C++ exceptions, - this can save some stack frame info in applications. - - Currently it's given only on functions which never divide-by-zero etc, - don't allocate memory, and are expected to never need to allocate memory. - This leaves open the possibility of a C++ throw from a future GMP - exceptions scheme. - - mpz_set_ui etc are omitted to leave open the lazy allocation scheme - described in doc/tasks.html. mpz_get_d etc are omitted to leave open - exceptions for float overflows. - - Note that __GMP_NOTHROW must be given on any inlines the same as on their - prototypes (for g++ at least, where they're used together). Note also - that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like - __GMP_ATTRIBUTE_PURE. */ - -#if defined (__cplusplus) -#define __GMP_NOTHROW throw () -#else -#define __GMP_NOTHROW -#endif - - -/* PORTME: What other compilers have a useful "extern inline"? "static - inline" would be an acceptable substitute if the compiler (or linker) - discards unused statics. */ - - /* gcc has __inline__ in all modes, including strict ansi. Give a prototype - for an inline too, so as to correctly specify "dllimport" on windows, in - case the function is called rather than inlined. - GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 - inline semantics, unless -fgnu89-inline is used. */ -#ifdef __GNUC__ -#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) -#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) -#else -#define __GMP_EXTERN_INLINE extern __inline__ -#endif -#define __GMP_INLINE_PROTOTYPES 1 -#endif - -/* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 - strict ANSI mode. Inlining is done even when not optimizing (ie. -O0 - mode, which is the default), but an unnecessary local copy of foo is - emitted unless -O is used. "extern __inline" is accepted, but the - "extern" appears to be ignored, ie. it becomes a plain global function - but which is inlined within its file. Don't know if all old versions of - DEC C supported __inline, but as a start let's do the right thing for - current versions. */ -#ifdef __DECC -#define __GMP_EXTERN_INLINE static __inline -#endif - -/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict - ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes - place under -O. Without -O "foo" seems to be emitted whether it's used - or not, which is wasteful. "extern inline foo()" isn't useful, the - "extern" is apparently ignored, so foo is inlined if possible but also - emitted as a global, which causes multiple definition errors when - building a shared libgmp. */ -#ifdef __SCO_VERSION__ -#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \ - && ! defined (__GMP_EXTERN_INLINE) -#define __GMP_EXTERN_INLINE static inline -#endif -#endif - -/* Microsoft's C compiler accepts __inline */ -#ifdef _MSC_VER -#define __GMP_EXTERN_INLINE __inline -#endif - -/* Recent enough Sun C compilers accept "extern inline" */ -#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \ - && ! defined (__GMP_EXTERN_INLINE) -#define __GMP_EXTERN_INLINE extern inline -#endif - -/* Somewhat older Sun C compilers accept "static inline" */ -#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \ - && ! defined (__GMP_EXTERN_INLINE) -#define __GMP_EXTERN_INLINE static inline -#endif - - -/* C++ always has "inline" and since it's a normal feature the linker should - discard duplicate non-inlined copies, or if it doesn't then that's a - problem for everyone, not just GMP. */ -#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE) -#define __GMP_EXTERN_INLINE inline -#endif - -/* Don't do any inlining within a configure run, since if the compiler ends - up emitting copies of the code into the object file it can end up - demanding the various support routines (like mpn_popcount) for linking, - making the "alloca" test and perhaps others fail. And on hppa ia64 a - pre-release gcc 3.2 was seen not respecting the "extern" in "extern - __inline__", triggering this problem too. */ -#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE -#undef __GMP_EXTERN_INLINE -#endif - -/* By default, don't give a prototype when there's going to be an inline - version. Note in particular that Cray C++ objects to the combination of - prototype and inline. */ -#ifdef __GMP_EXTERN_INLINE -#ifndef __GMP_INLINE_PROTOTYPES -#define __GMP_INLINE_PROTOTYPES 0 -#endif -#else -#define __GMP_INLINE_PROTOTYPES 1 -#endif - - -#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x)) -#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i)) - -/* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted - to int by "~". */ -#define __GMP_UINT_MAX (~ (unsigned) 0) -#define __GMP_ULONG_MAX (~ (unsigned long) 0) -#define __GMP_USHRT_MAX ((unsigned short) ~0) - - -/* __builtin_expect is in gcc 3.0, and not in 2.95. */ -#if __GMP_GNUC_PREREQ (3,0) -#define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1) -#define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0) -#else -#define __GMP_LIKELY(cond) (cond) -#define __GMP_UNLIKELY(cond) (cond) -#endif - -#ifdef _CRAY -#define __GMP_CRAY_Pragma(str) _Pragma (str) -#else -#define __GMP_CRAY_Pragma(str) -#endif - - -/* Allow direct user access to numerator and denominator of a mpq_t object. */ -#define mpq_numref(Q) (&((Q)->_mp_num)) -#define mpq_denref(Q) (&((Q)->_mp_den)) - - -#if defined (__cplusplus) -extern "C" { -using std::FILE; -#endif - -#define mp_set_memory_functions __gmp_set_memory_functions -__GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t), - void *(*) (void *, size_t, size_t), - void (*) (void *, size_t))) __GMP_NOTHROW; - -#define mp_get_memory_functions __gmp_get_memory_functions -__GMP_DECLSPEC void mp_get_memory_functions __GMP_PROTO ((void *(**) (size_t), - void *(**) (void *, size_t, size_t), - void (**) (void *, size_t))) __GMP_NOTHROW; - -#define mp_bits_per_limb __gmp_bits_per_limb -__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb; - -#define gmp_errno __gmp_errno -__GMP_DECLSPEC extern int gmp_errno; - -#define gmp_version __gmp_version -__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version; - - -/**************** Random number routines. ****************/ - -/* obsolete */ -#define gmp_randinit __gmp_randinit -__GMP_DECLSPEC void gmp_randinit __GMP_PROTO ((gmp_randstate_t, gmp_randalg_t, ...)); - -#define gmp_randinit_default __gmp_randinit_default -__GMP_DECLSPEC void gmp_randinit_default __GMP_PROTO ((gmp_randstate_t)); - -#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp -__GMP_DECLSPEC void gmp_randinit_lc_2exp __GMP_PROTO ((gmp_randstate_t, - mpz_srcptr, unsigned long int, - unsigned long int)); - -#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size -__GMP_DECLSPEC int gmp_randinit_lc_2exp_size __GMP_PROTO ((gmp_randstate_t, unsigned long)); - -#define gmp_randinit_mt __gmp_randinit_mt -__GMP_DECLSPEC void gmp_randinit_mt __GMP_PROTO ((gmp_randstate_t)); - -#define gmp_randinit_set __gmp_randinit_set -__GMP_DECLSPEC void gmp_randinit_set __GMP_PROTO ((gmp_randstate_t, __gmp_const __gmp_randstate_struct *)); - -#define gmp_randseed __gmp_randseed -__GMP_DECLSPEC void gmp_randseed __GMP_PROTO ((gmp_randstate_t, mpz_srcptr)); - -#define gmp_randseed_ui __gmp_randseed_ui -__GMP_DECLSPEC void gmp_randseed_ui __GMP_PROTO ((gmp_randstate_t, unsigned long int)); - -#define gmp_randclear __gmp_randclear -__GMP_DECLSPEC void gmp_randclear __GMP_PROTO ((gmp_randstate_t)); - -#define gmp_urandomb_ui __gmp_urandomb_ui -__GMP_DECLSPEC unsigned long gmp_urandomb_ui __GMP_PROTO ((gmp_randstate_t, unsigned long)); - -#define gmp_urandomm_ui __gmp_urandomm_ui -__GMP_DECLSPEC unsigned long gmp_urandomm_ui __GMP_PROTO ((gmp_randstate_t, unsigned long)); - - -/**************** Formatted output routines. ****************/ - -#define gmp_asprintf __gmp_asprintf -__GMP_DECLSPEC int gmp_asprintf __GMP_PROTO ((char **, __gmp_const char *, ...)); - -#define gmp_fprintf __gmp_fprintf -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC int gmp_fprintf __GMP_PROTO ((FILE *, __gmp_const char *, ...)); -#endif - -#define gmp_obstack_printf __gmp_obstack_printf -#if defined (_GMP_H_HAVE_OBSTACK) -__GMP_DECLSPEC int gmp_obstack_printf __GMP_PROTO ((struct obstack *, __gmp_const char *, ...)); -#endif - -#define gmp_obstack_vprintf __gmp_obstack_vprintf -#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_obstack_vprintf __GMP_PROTO ((struct obstack *, __gmp_const char *, va_list)); -#endif - -#define gmp_printf __gmp_printf -__GMP_DECLSPEC int gmp_printf __GMP_PROTO ((__gmp_const char *, ...)); - -#define gmp_snprintf __gmp_snprintf -__GMP_DECLSPEC int gmp_snprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, ...)); - -#define gmp_sprintf __gmp_sprintf -__GMP_DECLSPEC int gmp_sprintf __GMP_PROTO ((char *, __gmp_const char *, ...)); - -#define gmp_vasprintf __gmp_vasprintf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vasprintf __GMP_PROTO ((char **, __gmp_const char *, va_list)); -#endif - -#define gmp_vfprintf __gmp_vfprintf -#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vfprintf __GMP_PROTO ((FILE *, __gmp_const char *, va_list)); -#endif - -#define gmp_vprintf __gmp_vprintf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vprintf __GMP_PROTO ((__gmp_const char *, va_list)); -#endif - -#define gmp_vsnprintf __gmp_vsnprintf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vsnprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, va_list)); -#endif - -#define gmp_vsprintf __gmp_vsprintf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vsprintf __GMP_PROTO ((char *, __gmp_const char *, va_list)); -#endif - - -/**************** Formatted input routines. ****************/ - -#define gmp_fscanf __gmp_fscanf -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC int gmp_fscanf __GMP_PROTO ((FILE *, __gmp_const char *, ...)); -#endif - -#define gmp_scanf __gmp_scanf -__GMP_DECLSPEC int gmp_scanf __GMP_PROTO ((__gmp_const char *, ...)); - -#define gmp_sscanf __gmp_sscanf -__GMP_DECLSPEC int gmp_sscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, ...)); - -#define gmp_vfscanf __gmp_vfscanf -#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vfscanf __GMP_PROTO ((FILE *, __gmp_const char *, va_list)); -#endif - -#define gmp_vscanf __gmp_vscanf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vscanf __GMP_PROTO ((__gmp_const char *, va_list)); -#endif - -#define gmp_vsscanf __gmp_vsscanf -#if defined (_GMP_H_HAVE_VA_LIST) -__GMP_DECLSPEC int gmp_vsscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, va_list)); -#endif - - -/**************** Integer (i.e. Z) routines. ****************/ - -#define _mpz_realloc __gmpz_realloc -#define mpz_realloc __gmpz_realloc -__GMP_DECLSPEC void *_mpz_realloc __GMP_PROTO ((mpz_ptr, mp_size_t)); - -#define mpz_abs __gmpz_abs -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs) -__GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr)); -#endif - -#define mpz_add __gmpz_add -__GMP_DECLSPEC void mpz_add __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_add_ui __gmpz_add_ui -__GMP_DECLSPEC void mpz_add_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_addmul __gmpz_addmul -__GMP_DECLSPEC void mpz_addmul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_addmul_ui __gmpz_addmul_ui -__GMP_DECLSPEC void mpz_addmul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_and __gmpz_and -__GMP_DECLSPEC void mpz_and __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_array_init __gmpz_array_init -__GMP_DECLSPEC void mpz_array_init __GMP_PROTO ((mpz_ptr, mp_size_t, mp_size_t)); - -#define mpz_bin_ui __gmpz_bin_ui -__GMP_DECLSPEC void mpz_bin_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_bin_uiui __gmpz_bin_uiui -__GMP_DECLSPEC void mpz_bin_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int)); - -#define mpz_cdiv_q __gmpz_cdiv_q -__GMP_DECLSPEC void mpz_cdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp -__GMP_DECLSPEC void mpz_cdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long)); - -#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui -__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_cdiv_qr __gmpz_cdiv_qr -__GMP_DECLSPEC void mpz_cdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui -__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_cdiv_r __gmpz_cdiv_r -__GMP_DECLSPEC void mpz_cdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp -__GMP_DECLSPEC void mpz_cdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long)); - -#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui -__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_cdiv_ui __gmpz_cdiv_ui -__GMP_DECLSPEC unsigned long int mpz_cdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpz_clear __gmpz_clear -__GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr)); - -#define mpz_clrbit __gmpz_clrbit -__GMP_DECLSPEC void mpz_clrbit __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_cmp __gmpz_cmp -__GMP_DECLSPEC int mpz_cmp __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_cmp_d __gmpz_cmp_d -__GMP_DECLSPEC int mpz_cmp_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE; - -#define _mpz_cmp_si __gmpz_cmp_si -__GMP_DECLSPEC int _mpz_cmp_si __GMP_PROTO ((mpz_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define _mpz_cmp_ui __gmpz_cmp_ui -__GMP_DECLSPEC int _mpz_cmp_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_cmpabs __gmpz_cmpabs -__GMP_DECLSPEC int mpz_cmpabs __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_cmpabs_d __gmpz_cmpabs_d -__GMP_DECLSPEC int mpz_cmpabs_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE; - -#define mpz_cmpabs_ui __gmpz_cmpabs_ui -__GMP_DECLSPEC int mpz_cmpabs_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_com __gmpz_com -__GMP_DECLSPEC void mpz_com __GMP_PROTO ((mpz_ptr, mpz_srcptr)); - -#define mpz_combit __gmpz_combit -__GMP_DECLSPEC void mpz_combit __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_congruent_p __gmpz_congruent_p -__GMP_DECLSPEC int mpz_congruent_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p -__GMP_DECLSPEC int mpz_congruent_2exp_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_congruent_ui_p __gmpz_congruent_ui_p -__GMP_DECLSPEC int mpz_congruent_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE; - -#define mpz_divexact __gmpz_divexact -__GMP_DECLSPEC void mpz_divexact __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_divexact_ui __gmpz_divexact_ui -__GMP_DECLSPEC void mpz_divexact_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long)); - -#define mpz_divisible_p __gmpz_divisible_p -__GMP_DECLSPEC int mpz_divisible_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_divisible_ui_p __gmpz_divisible_ui_p -__GMP_DECLSPEC int mpz_divisible_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE; - -#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p -__GMP_DECLSPEC int mpz_divisible_2exp_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_dump __gmpz_dump -__GMP_DECLSPEC void mpz_dump __GMP_PROTO ((mpz_srcptr)); - -#define mpz_export __gmpz_export -__GMP_DECLSPEC void *mpz_export __GMP_PROTO ((void *, size_t *, int, size_t, int, size_t, mpz_srcptr)); - -#define mpz_fac_ui __gmpz_fac_ui -__GMP_DECLSPEC void mpz_fac_ui __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_fdiv_q __gmpz_fdiv_q -__GMP_DECLSPEC void mpz_fdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp -__GMP_DECLSPEC void mpz_fdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui -__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_fdiv_qr __gmpz_fdiv_qr -__GMP_DECLSPEC void mpz_fdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui -__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_fdiv_r __gmpz_fdiv_r -__GMP_DECLSPEC void mpz_fdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp -__GMP_DECLSPEC void mpz_fdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui -__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_fdiv_ui __gmpz_fdiv_ui -__GMP_DECLSPEC unsigned long int mpz_fdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpz_fib_ui __gmpz_fib_ui -__GMP_DECLSPEC void mpz_fib_ui __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_fib2_ui __gmpz_fib2_ui -__GMP_DECLSPEC void mpz_fib2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int)); - -#define mpz_fits_sint_p __gmpz_fits_sint_p -__GMP_DECLSPEC int mpz_fits_sint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_fits_slong_p __gmpz_fits_slong_p -__GMP_DECLSPEC int mpz_fits_slong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_fits_sshort_p __gmpz_fits_sshort_p -__GMP_DECLSPEC int mpz_fits_sshort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_fits_uint_p __gmpz_fits_uint_p -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p) -__GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_fits_ulong_p __gmpz_fits_ulong_p -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p) -__GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_fits_ushort_p __gmpz_fits_ushort_p -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p) -__GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_gcd __gmpz_gcd -__GMP_DECLSPEC void mpz_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_gcd_ui __gmpz_gcd_ui -__GMP_DECLSPEC unsigned long int mpz_gcd_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_gcdext __gmpz_gcdext -__GMP_DECLSPEC void mpz_gcdext __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_get_d __gmpz_get_d -__GMP_DECLSPEC double mpz_get_d __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_get_d_2exp __gmpz_get_d_2exp -__GMP_DECLSPEC double mpz_get_d_2exp __GMP_PROTO ((signed long int *, mpz_srcptr)); - -#define mpz_get_si __gmpz_get_si -__GMP_DECLSPEC /* signed */ long int mpz_get_si __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_get_str __gmpz_get_str -__GMP_DECLSPEC char *mpz_get_str __GMP_PROTO ((char *, int, mpz_srcptr)); - -#define mpz_get_ui __gmpz_get_ui -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui) -__GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_getlimbn __gmpz_getlimbn -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn) -__GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_hamdist __gmpz_hamdist -__GMP_DECLSPEC unsigned long int mpz_hamdist __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_import __gmpz_import -__GMP_DECLSPEC void mpz_import __GMP_PROTO ((mpz_ptr, size_t, int, size_t, int, size_t, __gmp_const void *)); - -#define mpz_init __gmpz_init -__GMP_DECLSPEC void mpz_init __GMP_PROTO ((mpz_ptr)); - -#define mpz_init2 __gmpz_init2 -__GMP_DECLSPEC void mpz_init2 __GMP_PROTO ((mpz_ptr, unsigned long)); - -#define mpz_init_set __gmpz_init_set -__GMP_DECLSPEC void mpz_init_set __GMP_PROTO ((mpz_ptr, mpz_srcptr)); - -#define mpz_init_set_d __gmpz_init_set_d -__GMP_DECLSPEC void mpz_init_set_d __GMP_PROTO ((mpz_ptr, double)); - -#define mpz_init_set_si __gmpz_init_set_si -__GMP_DECLSPEC void mpz_init_set_si __GMP_PROTO ((mpz_ptr, signed long int)); - -#define mpz_init_set_str __gmpz_init_set_str -__GMP_DECLSPEC int mpz_init_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int)); - -#define mpz_init_set_ui __gmpz_init_set_ui -__GMP_DECLSPEC void mpz_init_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_inp_raw __gmpz_inp_raw -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpz_inp_raw __GMP_PROTO ((mpz_ptr, FILE *)); -#endif - -#define mpz_inp_str __gmpz_inp_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpz_inp_str __GMP_PROTO ((mpz_ptr, FILE *, int)); -#endif - -#define mpz_invert __gmpz_invert -__GMP_DECLSPEC int mpz_invert __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_ior __gmpz_ior -__GMP_DECLSPEC void mpz_ior __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_jacobi __gmpz_jacobi -__GMP_DECLSPEC int mpz_jacobi __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_kronecker mpz_jacobi /* alias */ - -#define mpz_kronecker_si __gmpz_kronecker_si -__GMP_DECLSPEC int mpz_kronecker_si __GMP_PROTO ((mpz_srcptr, long)) __GMP_ATTRIBUTE_PURE; - -#define mpz_kronecker_ui __gmpz_kronecker_ui -__GMP_DECLSPEC int mpz_kronecker_ui __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE; - -#define mpz_si_kronecker __gmpz_si_kronecker -__GMP_DECLSPEC int mpz_si_kronecker __GMP_PROTO ((long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_ui_kronecker __gmpz_ui_kronecker -__GMP_DECLSPEC int mpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_lcm __gmpz_lcm -__GMP_DECLSPEC void mpz_lcm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_lcm_ui __gmpz_lcm_ui -__GMP_DECLSPEC void mpz_lcm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long)); - -#define mpz_legendre mpz_jacobi /* alias */ - -#define mpz_lucnum_ui __gmpz_lucnum_ui -__GMP_DECLSPEC void mpz_lucnum_ui __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_lucnum2_ui __gmpz_lucnum2_ui -__GMP_DECLSPEC void mpz_lucnum2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int)); - -#define mpz_millerrabin __gmpz_millerrabin -__GMP_DECLSPEC int mpz_millerrabin __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE; - -#define mpz_mod __gmpz_mod -__GMP_DECLSPEC void mpz_mod __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */ - -#define mpz_mul __gmpz_mul -__GMP_DECLSPEC void mpz_mul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_mul_2exp __gmpz_mul_2exp -__GMP_DECLSPEC void mpz_mul_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_mul_si __gmpz_mul_si -__GMP_DECLSPEC void mpz_mul_si __GMP_PROTO ((mpz_ptr, mpz_srcptr, long int)); - -#define mpz_mul_ui __gmpz_mul_ui -__GMP_DECLSPEC void mpz_mul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_neg __gmpz_neg -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg) -__GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr)); -#endif - -#define mpz_nextprime __gmpz_nextprime -__GMP_DECLSPEC void mpz_nextprime __GMP_PROTO ((mpz_ptr, mpz_srcptr)); - -#define mpz_out_raw __gmpz_out_raw -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpz_out_raw __GMP_PROTO ((FILE *, mpz_srcptr)); -#endif - -#define mpz_out_str __gmpz_out_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpz_out_str __GMP_PROTO ((FILE *, int, mpz_srcptr)); -#endif - -#define mpz_perfect_power_p __gmpz_perfect_power_p -__GMP_DECLSPEC int mpz_perfect_power_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpz_perfect_square_p __gmpz_perfect_square_p -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p) -__GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_popcount __gmpz_popcount -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount) -__GMP_DECLSPEC unsigned long int mpz_popcount __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_pow_ui __gmpz_pow_ui -__GMP_DECLSPEC void mpz_pow_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_powm __gmpz_powm -__GMP_DECLSPEC void mpz_powm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_powm_ui __gmpz_powm_ui -__GMP_DECLSPEC void mpz_powm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr)); - -#define mpz_probab_prime_p __gmpz_probab_prime_p -__GMP_DECLSPEC int mpz_probab_prime_p __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE; - -#define mpz_random __gmpz_random -__GMP_DECLSPEC void mpz_random __GMP_PROTO ((mpz_ptr, mp_size_t)); - -#define mpz_random2 __gmpz_random2 -__GMP_DECLSPEC void mpz_random2 __GMP_PROTO ((mpz_ptr, mp_size_t)); - -#define mpz_realloc2 __gmpz_realloc2 -__GMP_DECLSPEC void mpz_realloc2 __GMP_PROTO ((mpz_ptr, unsigned long)); - -#define mpz_remove __gmpz_remove -__GMP_DECLSPEC unsigned long int mpz_remove __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_root __gmpz_root -__GMP_DECLSPEC int mpz_root __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_rootrem __gmpz_rootrem -__GMP_DECLSPEC void mpz_rootrem __GMP_PROTO ((mpz_ptr,mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_rrandomb __gmpz_rrandomb -__GMP_DECLSPEC void mpz_rrandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int)); - -#define mpz_scan0 __gmpz_scan0 -__GMP_DECLSPEC unsigned long int mpz_scan0 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_scan1 __gmpz_scan1 -__GMP_DECLSPEC unsigned long int mpz_scan1 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_set __gmpz_set -__GMP_DECLSPEC void mpz_set __GMP_PROTO ((mpz_ptr, mpz_srcptr)); - -#define mpz_set_d __gmpz_set_d -__GMP_DECLSPEC void mpz_set_d __GMP_PROTO ((mpz_ptr, double)); - -#define mpz_set_f __gmpz_set_f -__GMP_DECLSPEC void mpz_set_f __GMP_PROTO ((mpz_ptr, mpf_srcptr)); - -#define mpz_set_q __gmpz_set_q -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q) -__GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr)); -#endif - -#define mpz_set_si __gmpz_set_si -__GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, signed long int)); - -#define mpz_set_str __gmpz_set_str -__GMP_DECLSPEC int mpz_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int)); - -#define mpz_set_ui __gmpz_set_ui -__GMP_DECLSPEC void mpz_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_setbit __gmpz_setbit -__GMP_DECLSPEC void mpz_setbit __GMP_PROTO ((mpz_ptr, unsigned long int)); - -#define mpz_size __gmpz_size -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size) -__GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpz_sizeinbase __gmpz_sizeinbase -__GMP_DECLSPEC size_t mpz_sizeinbase __GMP_PROTO ((mpz_srcptr, int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_sqrt __gmpz_sqrt -__GMP_DECLSPEC void mpz_sqrt __GMP_PROTO ((mpz_ptr, mpz_srcptr)); - -#define mpz_sqrtrem __gmpz_sqrtrem -__GMP_DECLSPEC void mpz_sqrtrem __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr)); - -#define mpz_sub __gmpz_sub -__GMP_DECLSPEC void mpz_sub __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_sub_ui __gmpz_sub_ui -__GMP_DECLSPEC void mpz_sub_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_ui_sub __gmpz_ui_sub -__GMP_DECLSPEC void mpz_ui_sub __GMP_PROTO ((mpz_ptr, unsigned long int, mpz_srcptr)); - -#define mpz_submul __gmpz_submul -__GMP_DECLSPEC void mpz_submul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_submul_ui __gmpz_submul_ui -__GMP_DECLSPEC void mpz_submul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_swap __gmpz_swap -__GMP_DECLSPEC void mpz_swap __GMP_PROTO ((mpz_ptr, mpz_ptr)) __GMP_NOTHROW; - -#define mpz_tdiv_ui __gmpz_tdiv_ui -__GMP_DECLSPEC unsigned long int mpz_tdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpz_tdiv_q __gmpz_tdiv_q -__GMP_DECLSPEC void mpz_tdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp -__GMP_DECLSPEC void mpz_tdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui -__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_tdiv_qr __gmpz_tdiv_qr -__GMP_DECLSPEC void mpz_tdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui -__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_tdiv_r __gmpz_tdiv_r -__GMP_DECLSPEC void mpz_tdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - -#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp -__GMP_DECLSPEC void mpz_tdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui -__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); - -#define mpz_tstbit __gmpz_tstbit -__GMP_DECLSPEC int mpz_tstbit __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpz_ui_pow_ui __gmpz_ui_pow_ui -__GMP_DECLSPEC void mpz_ui_pow_ui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int)); - -#define mpz_urandomb __gmpz_urandomb -__GMP_DECLSPEC void mpz_urandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int)); - -#define mpz_urandomm __gmpz_urandomm -__GMP_DECLSPEC void mpz_urandomm __GMP_PROTO ((mpz_ptr, gmp_randstate_t, mpz_srcptr)); - -#define mpz_xor __gmpz_xor -#define mpz_eor __gmpz_xor -__GMP_DECLSPEC void mpz_xor __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); - - -/**************** Rational (i.e. Q) routines. ****************/ - -#define mpq_abs __gmpq_abs -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs) -__GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr)); -#endif - -#define mpq_add __gmpq_add -__GMP_DECLSPEC void mpq_add __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); - -#define mpq_canonicalize __gmpq_canonicalize -__GMP_DECLSPEC void mpq_canonicalize __GMP_PROTO ((mpq_ptr)); - -#define mpq_clear __gmpq_clear -__GMP_DECLSPEC void mpq_clear __GMP_PROTO ((mpq_ptr)); - -#define mpq_cmp __gmpq_cmp -__GMP_DECLSPEC int mpq_cmp __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define _mpq_cmp_si __gmpq_cmp_si -__GMP_DECLSPEC int _mpq_cmp_si __GMP_PROTO ((mpq_srcptr, long, unsigned long)) __GMP_ATTRIBUTE_PURE; - -#define _mpq_cmp_ui __gmpq_cmp_ui -__GMP_DECLSPEC int _mpq_cmp_ui __GMP_PROTO ((mpq_srcptr, unsigned long int, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpq_div __gmpq_div -__GMP_DECLSPEC void mpq_div __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); - -#define mpq_div_2exp __gmpq_div_2exp -__GMP_DECLSPEC void mpq_div_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long)); - -#define mpq_equal __gmpq_equal -__GMP_DECLSPEC int mpq_equal __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpq_get_num __gmpq_get_num -__GMP_DECLSPEC void mpq_get_num __GMP_PROTO ((mpz_ptr, mpq_srcptr)); - -#define mpq_get_den __gmpq_get_den -__GMP_DECLSPEC void mpq_get_den __GMP_PROTO ((mpz_ptr, mpq_srcptr)); - -#define mpq_get_d __gmpq_get_d -__GMP_DECLSPEC double mpq_get_d __GMP_PROTO ((mpq_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpq_get_str __gmpq_get_str -__GMP_DECLSPEC char *mpq_get_str __GMP_PROTO ((char *, int, mpq_srcptr)); - -#define mpq_init __gmpq_init -__GMP_DECLSPEC void mpq_init __GMP_PROTO ((mpq_ptr)); - -#define mpq_inp_str __gmpq_inp_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpq_inp_str __GMP_PROTO ((mpq_ptr, FILE *, int)); -#endif - -#define mpq_inv __gmpq_inv -__GMP_DECLSPEC void mpq_inv __GMP_PROTO ((mpq_ptr, mpq_srcptr)); - -#define mpq_mul __gmpq_mul -__GMP_DECLSPEC void mpq_mul __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); - -#define mpq_mul_2exp __gmpq_mul_2exp -__GMP_DECLSPEC void mpq_mul_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long)); - -#define mpq_neg __gmpq_neg -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg) -__GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr)); -#endif - -#define mpq_out_str __gmpq_out_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpq_out_str __GMP_PROTO ((FILE *, int, mpq_srcptr)); -#endif - -#define mpq_set __gmpq_set -__GMP_DECLSPEC void mpq_set __GMP_PROTO ((mpq_ptr, mpq_srcptr)); - -#define mpq_set_d __gmpq_set_d -__GMP_DECLSPEC void mpq_set_d __GMP_PROTO ((mpq_ptr, double)); - -#define mpq_set_den __gmpq_set_den -__GMP_DECLSPEC void mpq_set_den __GMP_PROTO ((mpq_ptr, mpz_srcptr)); - -#define mpq_set_f __gmpq_set_f -__GMP_DECLSPEC void mpq_set_f __GMP_PROTO ((mpq_ptr, mpf_srcptr)); - -#define mpq_set_num __gmpq_set_num -__GMP_DECLSPEC void mpq_set_num __GMP_PROTO ((mpq_ptr, mpz_srcptr)); - -#define mpq_set_si __gmpq_set_si -__GMP_DECLSPEC void mpq_set_si __GMP_PROTO ((mpq_ptr, signed long int, unsigned long int)); - -#define mpq_set_str __gmpq_set_str -__GMP_DECLSPEC int mpq_set_str __GMP_PROTO ((mpq_ptr, __gmp_const char *, int)); - -#define mpq_set_ui __gmpq_set_ui -__GMP_DECLSPEC void mpq_set_ui __GMP_PROTO ((mpq_ptr, unsigned long int, unsigned long int)); - -#define mpq_set_z __gmpq_set_z -__GMP_DECLSPEC void mpq_set_z __GMP_PROTO ((mpq_ptr, mpz_srcptr)); - -#define mpq_sub __gmpq_sub -__GMP_DECLSPEC void mpq_sub __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr)); - -#define mpq_swap __gmpq_swap -__GMP_DECLSPEC void mpq_swap __GMP_PROTO ((mpq_ptr, mpq_ptr)) __GMP_NOTHROW; - - -/**************** Float (i.e. F) routines. ****************/ - -#define mpf_abs __gmpf_abs -__GMP_DECLSPEC void mpf_abs __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_add __gmpf_add -__GMP_DECLSPEC void mpf_add __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); - -#define mpf_add_ui __gmpf_add_ui -__GMP_DECLSPEC void mpf_add_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); -#define mpf_ceil __gmpf_ceil -__GMP_DECLSPEC void mpf_ceil __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_clear __gmpf_clear -__GMP_DECLSPEC void mpf_clear __GMP_PROTO ((mpf_ptr)); - -#define mpf_cmp __gmpf_cmp -__GMP_DECLSPEC int mpf_cmp __GMP_PROTO ((mpf_srcptr, mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_cmp_d __gmpf_cmp_d -__GMP_DECLSPEC int mpf_cmp_d __GMP_PROTO ((mpf_srcptr, double)) __GMP_ATTRIBUTE_PURE; - -#define mpf_cmp_si __gmpf_cmp_si -__GMP_DECLSPEC int mpf_cmp_si __GMP_PROTO ((mpf_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_cmp_ui __gmpf_cmp_ui -__GMP_DECLSPEC int mpf_cmp_ui __GMP_PROTO ((mpf_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_div __gmpf_div -__GMP_DECLSPEC void mpf_div __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); - -#define mpf_div_2exp __gmpf_div_2exp -__GMP_DECLSPEC void mpf_div_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_div_ui __gmpf_div_ui -__GMP_DECLSPEC void mpf_div_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_dump __gmpf_dump -__GMP_DECLSPEC void mpf_dump __GMP_PROTO ((mpf_srcptr)); - -#define mpf_eq __gmpf_eq -__GMP_DECLSPEC int mpf_eq __GMP_PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_sint_p __gmpf_fits_sint_p -__GMP_DECLSPEC int mpf_fits_sint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_slong_p __gmpf_fits_slong_p -__GMP_DECLSPEC int mpf_fits_slong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_sshort_p __gmpf_fits_sshort_p -__GMP_DECLSPEC int mpf_fits_sshort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_uint_p __gmpf_fits_uint_p -__GMP_DECLSPEC int mpf_fits_uint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_ulong_p __gmpf_fits_ulong_p -__GMP_DECLSPEC int mpf_fits_ulong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_fits_ushort_p __gmpf_fits_ushort_p -__GMP_DECLSPEC int mpf_fits_ushort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_floor __gmpf_floor -__GMP_DECLSPEC void mpf_floor __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_get_d __gmpf_get_d -__GMP_DECLSPEC double mpf_get_d __GMP_PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE; - -#define mpf_get_d_2exp __gmpf_get_d_2exp -__GMP_DECLSPEC double mpf_get_d_2exp __GMP_PROTO ((signed long int *, mpf_srcptr)); - -#define mpf_get_default_prec __gmpf_get_default_prec -__GMP_DECLSPEC unsigned long int mpf_get_default_prec __GMP_PROTO ((void)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_get_prec __gmpf_get_prec -__GMP_DECLSPEC unsigned long int mpf_get_prec __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_get_si __gmpf_get_si -__GMP_DECLSPEC long mpf_get_si __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_get_str __gmpf_get_str -__GMP_DECLSPEC char *mpf_get_str __GMP_PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr)); - -#define mpf_get_ui __gmpf_get_ui -__GMP_DECLSPEC unsigned long mpf_get_ui __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_init __gmpf_init -__GMP_DECLSPEC void mpf_init __GMP_PROTO ((mpf_ptr)); - -#define mpf_init2 __gmpf_init2 -__GMP_DECLSPEC void mpf_init2 __GMP_PROTO ((mpf_ptr, unsigned long int)); - -#define mpf_init_set __gmpf_init_set -__GMP_DECLSPEC void mpf_init_set __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_init_set_d __gmpf_init_set_d -__GMP_DECLSPEC void mpf_init_set_d __GMP_PROTO ((mpf_ptr, double)); - -#define mpf_init_set_si __gmpf_init_set_si -__GMP_DECLSPEC void mpf_init_set_si __GMP_PROTO ((mpf_ptr, signed long int)); - -#define mpf_init_set_str __gmpf_init_set_str -__GMP_DECLSPEC int mpf_init_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int)); - -#define mpf_init_set_ui __gmpf_init_set_ui -__GMP_DECLSPEC void mpf_init_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int)); - -#define mpf_inp_str __gmpf_inp_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpf_inp_str __GMP_PROTO ((mpf_ptr, FILE *, int)); -#endif - -#define mpf_integer_p __gmpf_integer_p -__GMP_DECLSPEC int mpf_integer_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_mul __gmpf_mul -__GMP_DECLSPEC void mpf_mul __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); - -#define mpf_mul_2exp __gmpf_mul_2exp -__GMP_DECLSPEC void mpf_mul_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_mul_ui __gmpf_mul_ui -__GMP_DECLSPEC void mpf_mul_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_neg __gmpf_neg -__GMP_DECLSPEC void mpf_neg __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_out_str __gmpf_out_str -#ifdef _GMP_H_HAVE_FILE -__GMP_DECLSPEC size_t mpf_out_str __GMP_PROTO ((FILE *, int, size_t, mpf_srcptr)); -#endif - -#define mpf_pow_ui __gmpf_pow_ui -__GMP_DECLSPEC void mpf_pow_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_random2 __gmpf_random2 -__GMP_DECLSPEC void mpf_random2 __GMP_PROTO ((mpf_ptr, mp_size_t, mp_exp_t)); - -#define mpf_reldiff __gmpf_reldiff -__GMP_DECLSPEC void mpf_reldiff __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); - -#define mpf_set __gmpf_set -__GMP_DECLSPEC void mpf_set __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_set_d __gmpf_set_d -__GMP_DECLSPEC void mpf_set_d __GMP_PROTO ((mpf_ptr, double)); - -#define mpf_set_default_prec __gmpf_set_default_prec -__GMP_DECLSPEC void mpf_set_default_prec __GMP_PROTO ((unsigned long int)) __GMP_NOTHROW; - -#define mpf_set_prec __gmpf_set_prec -__GMP_DECLSPEC void mpf_set_prec __GMP_PROTO ((mpf_ptr, unsigned long int)); - -#define mpf_set_prec_raw __gmpf_set_prec_raw -__GMP_DECLSPEC void mpf_set_prec_raw __GMP_PROTO ((mpf_ptr, unsigned long int)) __GMP_NOTHROW; - -#define mpf_set_q __gmpf_set_q -__GMP_DECLSPEC void mpf_set_q __GMP_PROTO ((mpf_ptr, mpq_srcptr)); - -#define mpf_set_si __gmpf_set_si -__GMP_DECLSPEC void mpf_set_si __GMP_PROTO ((mpf_ptr, signed long int)); - -#define mpf_set_str __gmpf_set_str -__GMP_DECLSPEC int mpf_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int)); - -#define mpf_set_ui __gmpf_set_ui -__GMP_DECLSPEC void mpf_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int)); - -#define mpf_set_z __gmpf_set_z -__GMP_DECLSPEC void mpf_set_z __GMP_PROTO ((mpf_ptr, mpz_srcptr)); - -#define mpf_size __gmpf_size -__GMP_DECLSPEC size_t mpf_size __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpf_sqrt __gmpf_sqrt -__GMP_DECLSPEC void mpf_sqrt __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_sqrt_ui __gmpf_sqrt_ui -__GMP_DECLSPEC void mpf_sqrt_ui __GMP_PROTO ((mpf_ptr, unsigned long int)); - -#define mpf_sub __gmpf_sub -__GMP_DECLSPEC void mpf_sub __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr)); - -#define mpf_sub_ui __gmpf_sub_ui -__GMP_DECLSPEC void mpf_sub_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int)); - -#define mpf_swap __gmpf_swap -__GMP_DECLSPEC void mpf_swap __GMP_PROTO ((mpf_ptr, mpf_ptr)) __GMP_NOTHROW; - -#define mpf_trunc __gmpf_trunc -__GMP_DECLSPEC void mpf_trunc __GMP_PROTO ((mpf_ptr, mpf_srcptr)); - -#define mpf_ui_div __gmpf_ui_div -__GMP_DECLSPEC void mpf_ui_div __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr)); - -#define mpf_ui_sub __gmpf_ui_sub -__GMP_DECLSPEC void mpf_ui_sub __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr)); - -#define mpf_urandomb __gmpf_urandomb -__GMP_DECLSPEC void mpf_urandomb __GMP_PROTO ((mpf_t, gmp_randstate_t, unsigned long int)); - - -/************ Low level positive-integer (i.e. N) routines. ************/ - -/* This is ugly, but we need to make user calls reach the prefixed function. */ - -#define mpn_add __MPN(add) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add) -__GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t)); -#endif - -#define mpn_add_1 __MPN(add_1) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1) -__GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW; -#endif - -#define mpn_add_n __MPN(add_n) -__GMP_DECLSPEC mp_limb_t mpn_add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); - -#define mpn_addmul_1 __MPN(addmul_1) -__GMP_DECLSPEC mp_limb_t mpn_addmul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); - -#define mpn_bdivmod __MPN(bdivmod) -__GMP_DECLSPEC mp_limb_t mpn_bdivmod __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int)); - -#define mpn_cmp __MPN(cmp) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp) -__GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; -#endif - -#define mpn_divexact_by3(dst,src,size) \ - mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0)) - -#define mpn_divexact_by3c __MPN(divexact_by3c) -__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); - -#define mpn_divmod_1(qp,np,nsize,dlimb) \ - mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb) - -#define mpn_divrem __MPN(divrem) -__GMP_DECLSPEC mp_limb_t mpn_divrem __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); - -#define mpn_divrem_1 __MPN(divrem_1) -__GMP_DECLSPEC mp_limb_t mpn_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); - -#define mpn_divrem_2 __MPN(divrem_2) -__GMP_DECLSPEC mp_limb_t mpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr)); - -#define mpn_gcd __MPN(gcd) -__GMP_DECLSPEC mp_size_t mpn_gcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t)); - -#define mpn_gcd_1 __MPN(gcd_1) -__GMP_DECLSPEC mp_limb_t mpn_gcd_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; - -#define mpn_gcdext_1 __MPN(gcdext_1) -__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 __GMP_PROTO ((mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t)); - -#define mpn_gcdext __MPN(gcdext) -__GMP_DECLSPEC mp_size_t mpn_gcdext __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t)); - -#define mpn_get_str __MPN(get_str) -__GMP_DECLSPEC size_t mpn_get_str __GMP_PROTO ((unsigned char *, int, mp_ptr, mp_size_t)); - -#define mpn_hamdist __MPN(hamdist) -__GMP_DECLSPEC unsigned long int mpn_hamdist __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpn_lshift __MPN(lshift) -__GMP_DECLSPEC mp_limb_t mpn_lshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int)); - -#define mpn_mod_1 __MPN(mod_1) -__GMP_DECLSPEC mp_limb_t mpn_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; - -#define mpn_mul __MPN(mul) -__GMP_DECLSPEC mp_limb_t mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); - -#define mpn_mul_1 __MPN(mul_1) -__GMP_DECLSPEC mp_limb_t mpn_mul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); - -#define mpn_mul_n __MPN(mul_n) -__GMP_DECLSPEC void mpn_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); - -#define mpn_sqr __MPN(sqr) -__GMP_DECLSPEC void mpn_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); - -#define mpn_neg_n __MPN(neg_n) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg_n) -__GMP_DECLSPEC mp_limb_t mpn_neg_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); -#endif - -#define mpn_perfect_square_p __MPN(perfect_square_p) -__GMP_DECLSPEC int mpn_perfect_square_p __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE; - -#define mpn_popcount __MPN(popcount) -__GMP_DECLSPEC unsigned long int mpn_popcount __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; - -#define mpn_pow_1 __MPN(pow_1) -__GMP_DECLSPEC mp_size_t mpn_pow_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr)); - -/* undocumented now, but retained here for upward compatibility */ -#define mpn_preinv_mod_1 __MPN(preinv_mod_1) -__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; - -#define mpn_random __MPN(random) -__GMP_DECLSPEC void mpn_random __GMP_PROTO ((mp_ptr, mp_size_t)); - -#define mpn_random2 __MPN(random2) -__GMP_DECLSPEC void mpn_random2 __GMP_PROTO ((mp_ptr, mp_size_t)); - -#define mpn_rshift __MPN(rshift) -__GMP_DECLSPEC mp_limb_t mpn_rshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int)); - -#define mpn_scan0 __MPN(scan0) -__GMP_DECLSPEC unsigned long int mpn_scan0 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpn_scan1 __MPN(scan1) -__GMP_DECLSPEC unsigned long int mpn_scan1 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE; - -#define mpn_set_str __MPN(set_str) -__GMP_DECLSPEC mp_size_t mpn_set_str __GMP_PROTO ((mp_ptr, __gmp_const unsigned char *, size_t, int)); - -#define mpn_sqrtrem __MPN(sqrtrem) -__GMP_DECLSPEC mp_size_t mpn_sqrtrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t)); - -#define mpn_sub __MPN(sub) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub) -__GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t)); -#endif - -#define mpn_sub_1 __MPN(sub_1) -#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1) -__GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW; -#endif - -#define mpn_sub_n __MPN(sub_n) -__GMP_DECLSPEC mp_limb_t mpn_sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); - -#define mpn_submul_1 __MPN(submul_1) -__GMP_DECLSPEC mp_limb_t mpn_submul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); - -#define mpn_tdiv_qr __MPN(tdiv_qr) -__GMP_DECLSPEC void mpn_tdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); - - -/**************** mpz inlines ****************/ - -/* The following are provided as inlines where possible, but always exist as - library functions too, for binary compatibility. - - Within gmp itself this inlining generally isn't relied on, since it - doesn't get done for all compilers, whereas if something is worth - inlining then it's worth arranging always. - - There are two styles of inlining here. When the same bit of code is - wanted for the inline as for the library version, then __GMP_FORCE_foo - arranges for that code to be emitted and the __GMP_EXTERN_INLINE - directive suppressed, eg. mpz_fits_uint_p. When a different bit of code - is wanted for the inline than for the library version, then - __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */ - -#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs) -__GMP_EXTERN_INLINE void -mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u) -{ - if (__gmp_w != __gmp_u) - mpz_set (__gmp_w, __gmp_u); - __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size); -} -#endif - -#if GMP_NAIL_BITS == 0 -#define __GMPZ_FITS_UTYPE_P(z,maxval) \ - mp_size_t __gmp_n = z->_mp_size; \ - mp_ptr __gmp_p = z->_mp_d; \ - return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval)); -#else -#define __GMPZ_FITS_UTYPE_P(z,maxval) \ - mp_size_t __gmp_n = z->_mp_size; \ - mp_ptr __gmp_p = z->_mp_d; \ - return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \ - || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS))); -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p) -#if ! defined (__GMP_FORCE_mpz_fits_uint_p) -__GMP_EXTERN_INLINE -#endif -int -mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW -{ - __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX); -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p) -#if ! defined (__GMP_FORCE_mpz_fits_ulong_p) -__GMP_EXTERN_INLINE -#endif -int -mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW -{ - __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX); -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p) -#if ! defined (__GMP_FORCE_mpz_fits_ushort_p) -__GMP_EXTERN_INLINE -#endif -int -mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW -{ - __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX); -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui) -#if ! defined (__GMP_FORCE_mpz_get_ui) -__GMP_EXTERN_INLINE -#endif -unsigned long -mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW -{ - mp_ptr __gmp_p = __gmp_z->_mp_d; - mp_size_t __gmp_n = __gmp_z->_mp_size; - mp_limb_t __gmp_l = __gmp_p[0]; - /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings - about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland - C++ 6.0 warnings about condition always true for something like - "__GMP_ULONG_MAX < GMP_NUMB_MASK". */ -#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB) - /* limb==long and no nails, or limb==longlong, one limb is enough */ - return (__gmp_n != 0 ? __gmp_l : 0); -#else - /* limb==long and nails, need two limbs when available */ - __gmp_n = __GMP_ABS (__gmp_n); - if (__gmp_n <= 1) - return (__gmp_n != 0 ? __gmp_l : 0); - else - return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS); -#endif -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn) -#if ! defined (__GMP_FORCE_mpz_getlimbn) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW -{ - mp_limb_t __gmp_result = 0; - if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size))) - __gmp_result = __gmp_z->_mp_d[__gmp_n]; - return __gmp_result; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg) -__GMP_EXTERN_INLINE void -mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u) -{ - if (__gmp_w != __gmp_u) - mpz_set (__gmp_w, __gmp_u); - __gmp_w->_mp_size = - __gmp_w->_mp_size; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p) -#if ! defined (__GMP_FORCE_mpz_perfect_square_p) -__GMP_EXTERN_INLINE -#endif -int -mpz_perfect_square_p (mpz_srcptr __gmp_a) -{ - mp_size_t __gmp_asize; - int __gmp_result; - - __gmp_asize = __gmp_a->_mp_size; - __gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */ - if (__GMP_LIKELY (__gmp_asize > 0)) - __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize); - return __gmp_result; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount) -#if ! defined (__GMP_FORCE_mpz_popcount) -__GMP_EXTERN_INLINE -#endif -unsigned long -mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW -{ - mp_size_t __gmp_usize; - unsigned long __gmp_result; - - __gmp_usize = __gmp_u->_mp_size; - __gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0); - if (__GMP_LIKELY (__gmp_usize > 0)) - __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize); - return __gmp_result; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q) -#if ! defined (__GMP_FORCE_mpz_set_q) -__GMP_EXTERN_INLINE -#endif -void -mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u) -{ - mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u)); -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size) -#if ! defined (__GMP_FORCE_mpz_size) -__GMP_EXTERN_INLINE -#endif -size_t -mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW -{ - return __GMP_ABS (__gmp_z->_mp_size); -} -#endif - - -/**************** mpq inlines ****************/ - -#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs) -__GMP_EXTERN_INLINE void -mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u) -{ - if (__gmp_w != __gmp_u) - mpq_set (__gmp_w, __gmp_u); - __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size); -} -#endif - -#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg) -__GMP_EXTERN_INLINE void -mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u) -{ - if (__gmp_w != __gmp_u) - mpq_set (__gmp_w, __gmp_u); - __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size; -} -#endif - - -/**************** mpn inlines ****************/ - -/* The comments with __GMPN_ADD_1 below apply here too. - - The test for FUNCTION returning 0 should predict well. If it's assumed - {yp,ysize} will usually have a random number of bits then the high limb - won't be full and a carry out will occur a good deal less than 50% of the - time. - - ysize==0 isn't a documented feature, but is used internally in a few - places. - - Producing cout last stops it using up a register during the main part of - the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))" - doesn't seem able to move the true and false legs of the conditional up - to the two places cout is generated. */ - -#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \ - do { \ - mp_size_t __gmp_i; \ - mp_limb_t __gmp_x; \ - \ - /* ASSERT ((ysize) >= 0); */ \ - /* ASSERT ((xsize) >= (ysize)); */ \ - /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \ - /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \ - \ - __gmp_i = (ysize); \ - if (__gmp_i != 0) \ - { \ - if (FUNCTION (wp, xp, yp, __gmp_i)) \ - { \ - do \ - { \ - if (__gmp_i >= (xsize)) \ - { \ - (cout) = 1; \ - goto __gmp_done; \ - } \ - __gmp_x = (xp)[__gmp_i]; \ - } \ - while (TEST); \ - } \ - } \ - if ((wp) != (xp)) \ - __GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \ - (cout) = 0; \ - __gmp_done: \ - ; \ - } while (0) - -#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \ - __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \ - (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0)) -#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \ - __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \ - (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0)) - - -/* The use of __gmp_i indexing is designed to ensure a compile time src==dst - remains nice and clear to the compiler, so that __GMPN_COPY_REST can - disappear, and the load/add/store gets a chance to become a - read-modify-write on CISC CPUs. - - Alternatives: - - Using a pair of pointers instead of indexing would be possible, but gcc - isn't able to recognise compile-time src==dst in that case, even when the - pointers are incremented more or less together. Other compilers would - very likely have similar difficulty. - - gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or - similar to detect a compile-time src==dst. This works nicely on gcc - 2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems - to be always false, for a pointer p. But the current code form seems - good enough for src==dst anyway. - - gcc on x86 as usual doesn't give particularly good flags handling for the - carry/borrow detection. It's tempting to want some multi instruction asm - blocks to help it, and this was tried, but in truth there's only a few - instructions to save and any gain is all too easily lost by register - juggling setting up for the asm. */ - -#if GMP_NAIL_BITS == 0 -#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \ - do { \ - mp_size_t __gmp_i; \ - mp_limb_t __gmp_x, __gmp_r; \ - \ - /* ASSERT ((n) >= 1); */ \ - /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \ - \ - __gmp_x = (src)[0]; \ - __gmp_r = __gmp_x OP (v); \ - (dst)[0] = __gmp_r; \ - if (CB (__gmp_r, __gmp_x, (v))) \ - { \ - (cout) = 1; \ - for (__gmp_i = 1; __gmp_i < (n);) \ - { \ - __gmp_x = (src)[__gmp_i]; \ - __gmp_r = __gmp_x OP 1; \ - (dst)[__gmp_i] = __gmp_r; \ - ++__gmp_i; \ - if (!CB (__gmp_r, __gmp_x, 1)) \ - { \ - if ((src) != (dst)) \ - __GMPN_COPY_REST (dst, src, n, __gmp_i); \ - (cout) = 0; \ - break; \ - } \ - } \ - } \ - else \ - { \ - if ((src) != (dst)) \ - __GMPN_COPY_REST (dst, src, n, 1); \ - (cout) = 0; \ - } \ - } while (0) -#endif - -#if GMP_NAIL_BITS >= 1 -#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \ - do { \ - mp_size_t __gmp_i; \ - mp_limb_t __gmp_x, __gmp_r; \ - \ - /* ASSERT ((n) >= 1); */ \ - /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \ - \ - __gmp_x = (src)[0]; \ - __gmp_r = __gmp_x OP (v); \ - (dst)[0] = __gmp_r & GMP_NUMB_MASK; \ - if (__gmp_r >> GMP_NUMB_BITS != 0) \ - { \ - (cout) = 1; \ - for (__gmp_i = 1; __gmp_i < (n);) \ - { \ - __gmp_x = (src)[__gmp_i]; \ - __gmp_r = __gmp_x OP 1; \ - (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \ - ++__gmp_i; \ - if (__gmp_r >> GMP_NUMB_BITS == 0) \ - { \ - if ((src) != (dst)) \ - __GMPN_COPY_REST (dst, src, n, __gmp_i); \ - (cout) = 0; \ - break; \ - } \ - } \ - } \ - else \ - { \ - if ((src) != (dst)) \ - __GMPN_COPY_REST (dst, src, n, 1); \ - (cout) = 0; \ - } \ - } while (0) -#endif - -#define __GMPN_ADDCB(r,x,y) ((r) < (y)) -#define __GMPN_SUBCB(r,x,y) ((x) < (y)) - -#define __GMPN_ADD_1(cout, dst, src, n, v) \ - __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB) -#define __GMPN_SUB_1(cout, dst, src, n, v) \ - __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB) - - -/* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or - negative. size==0 is allowed. On random data usually only one limb will - need to be examined to get a result, so it's worth having it inline. */ -#define __GMPN_CMP(result, xp, yp, size) \ - do { \ - mp_size_t __gmp_i; \ - mp_limb_t __gmp_x, __gmp_y; \ - \ - /* ASSERT ((size) >= 0); */ \ - \ - (result) = 0; \ - __gmp_i = (size); \ - while (--__gmp_i >= 0) \ - { \ - __gmp_x = (xp)[__gmp_i]; \ - __gmp_y = (yp)[__gmp_i]; \ - if (__gmp_x != __gmp_y) \ - { \ - /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \ - (result) = (__gmp_x > __gmp_y ? 1 : -1); \ - break; \ - } \ - } \ - } while (0) - - -#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST) -#define __GMPN_COPY_REST(dst, src, size, start) \ - do { \ - /* ASSERT ((start) >= 0); */ \ - /* ASSERT ((start) <= (size)); */ \ - __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \ - } while (0) -#endif - -/* Copy {src,size} to {dst,size}, starting at "start". This is designed to - keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1, - __GMPN_ADD, etc. */ -#if ! defined (__GMPN_COPY_REST) -#define __GMPN_COPY_REST(dst, src, size, start) \ - do { \ - mp_size_t __gmp_j; \ - /* ASSERT ((size) >= 0); */ \ - /* ASSERT ((start) >= 0); */ \ - /* ASSERT ((start) <= (size)); */ \ - /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \ - __GMP_CRAY_Pragma ("_CRI ivdep"); \ - for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \ - (dst)[__gmp_j] = (src)[__gmp_j]; \ - } while (0) -#endif - -/* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use - mpn_copyi if there's a native version, and if we don't mind demanding - binary compatibility for it (on targets which use it). */ - -#if ! defined (__GMPN_COPY) -#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0) -#endif - - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add) -#if ! defined (__GMP_FORCE_mpn_add) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize) -{ - mp_limb_t __gmp_c; - __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize); - return __gmp_c; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1) -#if ! defined (__GMP_FORCE_mpn_add_1) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW -{ - mp_limb_t __gmp_c; - __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n); - return __gmp_c; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp) -#if ! defined (__GMP_FORCE_mpn_cmp) -__GMP_EXTERN_INLINE -#endif -int -mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW -{ - int __gmp_result; - __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size); - return __gmp_result; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub) -#if ! defined (__GMP_FORCE_mpn_sub) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize) -{ - mp_limb_t __gmp_c; - __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize); - return __gmp_c; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1) -#if ! defined (__GMP_FORCE_mpn_sub_1) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW -{ - mp_limb_t __gmp_c; - __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n); - return __gmp_c; -} -#endif - -#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg_n) -#if ! defined (__GMP_FORCE_mpn_neg_n) -__GMP_EXTERN_INLINE -#endif -mp_limb_t -mpn_neg_n (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n) -{ - mp_limb_t __gmp_ul, __gmp_cy; - __gmp_cy = 0; - do { - __gmp_ul = *__gmp_up++; - *__gmp_rp++ = -__gmp_ul - __gmp_cy; - __gmp_cy |= __gmp_ul != 0; - } while (--__gmp_n != 0); - return __gmp_cy; -} -#endif - -#if defined (__cplusplus) -} -#endif - - -/* Allow faster testing for negative, zero, and positive. */ -#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0) -#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0) -#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0) - -/* When using GCC, optimize certain common comparisons. */ -#if defined (__GNUC__) && __GNUC__ >= 2 -#define mpz_cmp_ui(Z,UI) \ - (__builtin_constant_p (UI) && (UI) == 0 \ - ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI)) -#define mpz_cmp_si(Z,SI) \ - (__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z) \ - : __builtin_constant_p (SI) && (SI) > 0 \ - ? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI)) \ - : _mpz_cmp_si (Z,SI)) -#define mpq_cmp_ui(Q,NUI,DUI) \ - (__builtin_constant_p (NUI) && (NUI) == 0 \ - ? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI)) -#define mpq_cmp_si(q,n,d) \ - (__builtin_constant_p ((n) >= 0) && (n) >= 0 \ - ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \ - : _mpq_cmp_si (q, n, d)) -#else -#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI) -#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI) -#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI) -#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d) -#endif - - -/* Using "&" rather than "&&" means these can come out branch-free. Every - mpz_t has at least one limb allocated, so fetching the low limb is always - allowed. */ -#define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0])) -#define mpz_even_p(z) (! mpz_odd_p (z)) - - -/**************** C++ routines ****************/ - -#ifdef __cplusplus -__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr); -__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr); -__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr); -__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr); -__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr); -__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr); -#endif - - -/* Source-level compatibility with GMP 2 and earlier. */ -#define mpn_divmod(qp,np,nsize,dp,dsize) \ - mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize) - -/* Source-level compatibility with GMP 1. */ -#define mpz_mdiv mpz_fdiv_q -#define mpz_mdivmod mpz_fdiv_qr -#define mpz_mmod mpz_fdiv_r -#define mpz_mdiv_ui mpz_fdiv_q_ui -#define mpz_mdivmod_ui(q,r,n,d) \ - (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d)) -#define mpz_mmod_ui(r,n,d) \ - (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d)) - -/* Useful synonyms, but not quite compatible with GMP 1. */ -#define mpz_div mpz_fdiv_q -#define mpz_divmod mpz_fdiv_qr -#define mpz_div_ui mpz_fdiv_q_ui -#define mpz_divmod_ui mpz_fdiv_qr_ui -#define mpz_div_2exp mpz_fdiv_q_2exp -#define mpz_mod_2exp mpz_fdiv_r_2exp - -enum -{ - GMP_ERROR_NONE = 0, - GMP_ERROR_UNSUPPORTED_ARGUMENT = 1, - GMP_ERROR_DIVISION_BY_ZERO = 2, - GMP_ERROR_SQRT_OF_NEGATIVE = 4, - GMP_ERROR_INVALID_ARGUMENT = 8 -}; - -/* Define CC and CFLAGS which were used to build this version of GMP */ -#define __GMP_CC "@CC@" -#define __GMP_CFLAGS "@CFLAGS@" - -/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */ -#define __GNU_MP_VERSION 4 -#define __GNU_MP_VERSION_MINOR 3 -#define __GNU_MP_VERSION_PATCHLEVEL 2 - -#define __GMP_H__ -#endif /* __GMP_H__ */ diff --git a/contrib/gmp/gmp-impl.h b/contrib/gmp/gmp-impl.h index 215fccf3c9..d6336569c2 100644 --- a/contrib/gmp/gmp-impl.h +++ b/contrib/gmp/gmp-impl.h @@ -4,7 +4,7 @@ BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES. Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, -2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -56,41 +56,41 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ declared this way are only used to set function pointers in __gmp_cpuvec, they're not called directly. */ #define DECL_add_n(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)) #define DECL_addmul_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_copyd(name) \ - void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)) + __GMP_DECLSPEC void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)) #define DECL_copyi(name) \ DECL_copyd (name) #define DECL_divexact_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_divexact_by3c(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_divrem_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_gcd_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_lshift(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned)) #define DECL_mod_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) #define DECL_mod_34lsub1(name) \ - mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t)) #define DECL_modexact_1c_odd(name) \ - mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) #define DECL_mul_1(name) \ DECL_addmul_1 (name) #define DECL_mul_basecase(name) \ - void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)) + __GMP_DECLSPEC void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)) #define DECL_preinv_divrem_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)) #define DECL_preinv_mod_1(name) \ - mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) + __GMP_DECLSPEC mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) #define DECL_rshift(name) \ DECL_lshift (name) #define DECL_sqr_basecase(name) \ - void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)) + __GMP_DECLSPEC void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)) #define DECL_sub_n(name) \ DECL_add_n (name) #define DECL_submul_1(name) \ @@ -175,8 +175,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #ifndef BYTES_PER_MP_LIMB #define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T #endif -#ifndef BITS_PER_MP_LIMB -#define BITS_PER_MP_LIMB (8 * SIZEOF_MP_LIMB_T) +#define GMP_LIMB_BYTES BYTES_PER_MP_LIMB +#ifndef GMP_LIMB_BITS +#define GMP_LIMB_BITS (8 * SIZEOF_MP_LIMB_T) #endif #define BITS_PER_ULONG (8 * SIZEOF_UNSIGNED_LONG) @@ -198,6 +199,19 @@ typedef unsigned long gmp_uint_least32_t; #endif +/* gmp_intptr_t, for pointer to integer casts */ +#if HAVE_INTPTR_T +typedef intptr_t gmp_intptr_t; +#else /* fallback */ +typedef size_t gmp_intptr_t; +#endif + + +/* pre-inverse types for truncating division and modulo */ +typedef struct {mp_limb_t inv32;} gmp_pi1_t; +typedef struct {mp_limb_t inv21, inv32, inv53;} gmp_pi2_t; + + /* const and signed must match __gmp_const and __gmp_signed, so follow the decision made for those in gmp.h. */ #if ! __GMP_HAVE_CONST @@ -312,8 +326,8 @@ struct tmp_reentrant_t { struct tmp_reentrant_t *next; size_t size; /* bytes, including header */ }; -void *__gmp_tmp_reentrant_alloc __GMP_PROTO ((struct tmp_reentrant_t **, size_t)) ATTRIBUTE_MALLOC; -void __gmp_tmp_reentrant_free __GMP_PROTO ((struct tmp_reentrant_t *)); +__GMP_DECLSPEC void *__gmp_tmp_reentrant_alloc __GMP_PROTO ((struct tmp_reentrant_t **, size_t)) ATTRIBUTE_MALLOC; +__GMP_DECLSPEC void __gmp_tmp_reentrant_free __GMP_PROTO ((struct tmp_reentrant_t *)); #endif #if WANT_TMP_ALLOCA @@ -350,9 +364,9 @@ struct tmp_marker struct tmp_stack *which_chunk; void *alloc_point; }; -void *__gmp_tmp_alloc __GMP_PROTO ((unsigned long)) ATTRIBUTE_MALLOC; -void __gmp_tmp_mark __GMP_PROTO ((struct tmp_marker *)); -void __gmp_tmp_free __GMP_PROTO ((struct tmp_marker *)); +__GMP_DECLSPEC void *__gmp_tmp_alloc __GMP_PROTO ((unsigned long)) ATTRIBUTE_MALLOC; +__GMP_DECLSPEC void __gmp_tmp_mark __GMP_PROTO ((struct tmp_marker *)); +__GMP_DECLSPEC void __gmp_tmp_free __GMP_PROTO ((struct tmp_marker *)); #define TMP_SDECL TMP_DECL #define TMP_DECL struct tmp_marker __tmp_marker #define TMP_SMARK TMP_MARK @@ -377,15 +391,15 @@ struct tmp_debug_entry_t { char *block; size_t size; }; -void __gmp_tmp_debug_mark __GMP_PROTO ((const char *, int, struct tmp_debug_t **, - struct tmp_debug_t *, - const char *, const char *)); -void *__gmp_tmp_debug_alloc __GMP_PROTO ((const char *, int, int, - struct tmp_debug_t **, const char *, - size_t)) ATTRIBUTE_MALLOC; -void __gmp_tmp_debug_free __GMP_PROTO ((const char *, int, int, - struct tmp_debug_t **, - const char *, const char *)); +__GMP_DECLSPEC void __gmp_tmp_debug_mark __GMP_PROTO ((const char *, int, struct tmp_debug_t **, + struct tmp_debug_t *, + const char *, const char *)); +__GMP_DECLSPEC void *__gmp_tmp_debug_alloc __GMP_PROTO ((const char *, int, int, + struct tmp_debug_t **, const char *, + size_t)) ATTRIBUTE_MALLOC; +__GMP_DECLSPEC void __gmp_tmp_debug_free __GMP_PROTO ((const char *, int, int, + struct tmp_debug_t **, + const char *, const char *)); #define TMP_SDECL TMP_DECL_NAME(__tmp_xmarker, "__tmp_marker") #define TMP_DECL TMP_DECL_NAME(__tmp_xmarker, "__tmp_marker") #define TMP_SMARK TMP_MARK_NAME(__tmp_xmarker, "__tmp_marker") @@ -561,31 +575,21 @@ void __gmp_tmp_debug_free __GMP_PROTO ((const char *, int, int, /* Set various *_THRESHOLD values to be used for nails. Thus we avoid using code that has not yet been qualified. */ -#undef DIV_SB_PREINV_THRESHOLD -#undef DIV_DC_THRESHOLD -#undef POWM_THRESHOLD -#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX -#define DIV_DC_THRESHOLD 50 -#define POWM_THRESHOLD 0 - -#undef GCD_ACCEL_THRESHOLD -#define GCD_ACCEL_THRESHOLD 3 +#undef DC_DIV_QR_THRESHOLD +#define DC_DIV_QR_THRESHOLD 50 #undef DIVREM_1_NORM_THRESHOLD #undef DIVREM_1_UNNORM_THRESHOLD #undef MOD_1_NORM_THRESHOLD #undef MOD_1_UNNORM_THRESHOLD #undef USE_PREINV_DIVREM_1 -#undef USE_PREINV_MOD_1 #undef DIVREM_2_THRESHOLD #undef DIVEXACT_1_THRESHOLD -#undef MODEXACT_1_ODD_THRESHOLD #define DIVREM_1_NORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */ #define DIVREM_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */ #define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */ #define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */ #define USE_PREINV_DIVREM_1 0 /* no preinv */ -#define USE_PREINV_MOD_1 0 /* no preinv */ #define DIVREM_2_THRESHOLD MP_SIZE_T_MAX /* no preinv */ /* mpn/generic/mul_fft.c is not nails-capable. */ @@ -654,9 +658,9 @@ __GMP_DECLSPEC extern void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)); __GMP_DECLSPEC extern void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t)); __GMP_DECLSPEC extern void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)); -void *__gmp_default_allocate __GMP_PROTO ((size_t)); -void *__gmp_default_reallocate __GMP_PROTO ((void *, size_t, size_t)); -void __gmp_default_free __GMP_PROTO ((void *, size_t)); +__GMP_DECLSPEC void *__gmp_default_allocate __GMP_PROTO ((size_t)); +__GMP_DECLSPEC void *__gmp_default_reallocate __GMP_PROTO ((void *, size_t, size_t)); +__GMP_DECLSPEC void __gmp_default_free __GMP_PROTO ((void *, size_t)); #define __GMP_ALLOCATE_FUNC_TYPE(n,type) \ ((type *) (*__gmp_allocate_func) ((n) * sizeof (type))) @@ -757,11 +761,11 @@ void __gmp_default_free __GMP_PROTO ((void *, size_t)); #endif -void __gmpz_aorsmul_1 __GMP_PROTO ((REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_limb_t, mp_size_t))) REGPARM_ATTR(1); +__GMP_DECLSPEC void __gmpz_aorsmul_1 __GMP_PROTO ((REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_limb_t, mp_size_t))) REGPARM_ATTR(1); #define mpz_aorsmul_1(w,u,v,sub) __gmpz_aorsmul_1 (REGPARM_3_1 (w, u, v, sub)) #define mpz_n_pow_ui __gmpz_n_pow_ui -void mpz_n_pow_ui __GMP_PROTO ((mpz_ptr, mp_srcptr, mp_size_t, unsigned long)); +__GMP_DECLSPEC void mpz_n_pow_ui __GMP_PROTO ((mpz_ptr, mp_srcptr, mp_size_t, unsigned long)); #define mpn_addmul_1c __MPN(addmul_1c) @@ -793,15 +797,47 @@ __GMP_DECLSPEC mp_limb_t mpn_addmul_8 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t #define mpn_addlsh1_n __MPN(addlsh1_n) __GMP_DECLSPEC mp_limb_t mpn_addlsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +/* mpn_addlsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+4*{b,n}, and + returns the carry out (0, ..., 4). */ +#define mpn_addlsh2_n __MPN(addlsh2_n) +__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); + +/* mpn_addlsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}+2^k*{b,n}, and + returns the carry out (0, ..., 2^k). */ +#define mpn_addlsh_n __MPN(addlsh_n) + __GMP_DECLSPEC mp_limb_t mpn_addlsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int)); + /* mpn_sublsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-2*{b,n}, and returns the borrow out (0, 1 or 2). */ #define mpn_sublsh1_n __MPN(sublsh1_n) __GMP_DECLSPEC mp_limb_t mpn_sublsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +/* mpn_rsblsh1_n(c,a,b,n), when it exists, sets {c,n} to 2*{b,n}-{a,n}, and + returns the carry out (-1, 0, 1). */ +#define mpn_rsblsh1_n __MPN(rsblsh1_n) +__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); + +/* mpn_sublsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-4*{b,n}, and + returns the borrow out (FIXME 0, 1, 2 or 3). */ +#define mpn_sublsh2_n __MPN(sublsh2_n) +__GMP_DECLSPEC mp_limb_t mpn_sublsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); + +/* mpn_rsblsh2_n(c,a,b,n), when it exists, sets {c,n} to 4*{b,n}-{a,n}, and + returns the carry out (-1, ..., 3). */ +#define mpn_rsblsh2_n __MPN(rsblsh2_n) +__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); + +/* mpn_rsblsh_n(c,a,b,n,k), when it exists, sets {c,n} to 2^k*{b,n}-{a,n}, and + returns the carry out (-1, 0, ..., 2^k-1). */ +#define mpn_rsblsh_n __MPN(rsblsh_n) +__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int)); + /* mpn_rsh1add_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} + {b,n}) >> 1, and returns the bit rshifted out (0 or 1). */ #define mpn_rsh1add_n __MPN(rsh1add_n) __GMP_DECLSPEC mp_limb_t mpn_rsh1add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +#define mpn_rsh1add_nc __MPN(rsh1add_nc) +__GMP_DECLSPEC mp_limb_t mpn_rsh1add_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); /* mpn_rsh1sub_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} - {b,n}) >> 1, and returns the bit rshifted out (0 or 1). If there's a borrow from the @@ -809,15 +845,17 @@ __GMP_DECLSPEC mp_limb_t mpn_rsh1add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcpt complement negative. */ #define mpn_rsh1sub_n __MPN(rsh1sub_n) __GMP_DECLSPEC mp_limb_t mpn_rsh1sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +#define mpn_rsh1sub_nc __MPN(rsh1sub_nc) +__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); #define mpn_lshiftc __MPN(lshiftc) __GMP_DECLSPEC mp_limb_t mpn_lshiftc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int)); -#define mpn_addsub_n __MPN(addsub_n) -__GMP_DECLSPEC mp_limb_t mpn_addsub_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +#define mpn_add_n_sub_n __MPN(add_n_sub_n) +__GMP_DECLSPEC mp_limb_t mpn_add_n_sub_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#define mpn_addsub_nc __MPN(addsub_nc) -__GMP_DECLSPEC mp_limb_t mpn_addsub_nc __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); +#define mpn_add_n_sub_nc __MPN(add_n_sub_nc) +__GMP_DECLSPEC mp_limb_t mpn_add_n_sub_nc __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); #define mpn_addaddmul_1msb0 __MPN(addaddmul_1msb0) __GMP_DECLSPEC mp_limb_t mpn_addaddmul_1msb0 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); @@ -829,14 +867,14 @@ __GMP_DECLSPEC mp_limb_t mpn_divrem_1c __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcpt __GMP_DECLSPEC void mpn_dump __GMP_PROTO ((mp_srcptr, mp_size_t)); #define mpn_fib2_ui __MPN(fib2_ui) -mp_size_t mpn_fib2_ui __GMP_PROTO ((mp_ptr, mp_ptr, unsigned long)); +__GMP_DECLSPEC mp_size_t mpn_fib2_ui __GMP_PROTO ((mp_ptr, mp_ptr, unsigned long)); /* Remap names of internal mpn functions. */ #define __clz_tab __MPN(clz_tab) #define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv) #define mpn_jacobi_base __MPN(jacobi_base) -int mpn_jacobi_base __GMP_PROTO ((mp_limb_t, mp_limb_t, int)) ATTRIBUTE_CONST; +__GMP_DECLSPEC int mpn_jacobi_base __GMP_PROTO ((mp_limb_t, mp_limb_t, int)) ATTRIBUTE_CONST; #define mpn_mod_1c __MPN(mod_1c) __GMP_DECLSPEC mp_limb_t mpn_mod_1c __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; @@ -845,7 +883,7 @@ __GMP_DECLSPEC mp_limb_t mpn_mod_1c __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_ __GMP_DECLSPEC mp_limb_t mpn_mul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); #define mpn_mul_2 __MPN(mul_2) -mp_limb_t mpn_mul_2 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)); +__GMP_DECLSPEC mp_limb_t mpn_mul_2 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)); #define mpn_mul_3 __MPN(mul_3) __GMP_DECLSPEC mp_limb_t mpn_mul_3 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)); @@ -858,13 +896,14 @@ __GMP_DECLSPEC mp_limb_t mpn_mul_4 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, m __GMP_DECLSPEC void mpn_mul_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); #endif -#define mpn_mullow_n __MPN(mullow_n) -__GMP_DECLSPEC void mpn_mullow_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +#define mpn_mullo_n __MPN(mullo_n) +__GMP_DECLSPEC void mpn_mullo_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#define mpn_mullow_basecase __MPN(mullow_basecase) -__GMP_DECLSPEC void mpn_mullow_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); +#define mpn_mullo_basecase __MPN(mullo_basecase) +__GMP_DECLSPEC void mpn_mullo_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#define mpn_sqr_n __MPN(sqr) /* compatibility */ +#define mpn_sqr __MPN(sqr) +__GMP_DECLSPEC void mpn_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); #ifndef mpn_sqr_basecase /* if not done with cpuvec in a fat binary */ #define mpn_sqr_basecase __MPN(sqr_basecase) @@ -874,36 +913,62 @@ __GMP_DECLSPEC void mpn_sqr_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t) #define mpn_submul_1c __MPN(submul_1c) __GMP_DECLSPEC mp_limb_t mpn_submul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); -#define mpn_invert_2exp __MPN(invert_2exp) -__GMP_DECLSPEC void mpn_invert_2exp __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); - #define mpn_redc_1 __MPN(redc_1) -__GMP_DECLSPEC void mpn_redc_1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);) +__GMP_DECLSPEC void mpn_redc_1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); #define mpn_redc_2 __MPN(redc_2) __GMP_DECLSPEC void mpn_redc_2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)); +#define mpn_redc_n __MPN(redc_n) +__GMP_DECLSPEC void mpn_redc_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)); -#define mpn_mod_1s_1p_cps __MPN(mod_1s_1p_cps) -__GMP_DECLSPEC void mpn_mod_1s_1p_cps __GMP_PROTO ((mp_limb_t [4], mp_limb_t)); -#define mpn_mod_1s_1p __MPN(mod_1s_1p) -__GMP_DECLSPEC mp_limb_t mpn_mod_1s_1p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4])); +#define mpn_mod_1_1p_cps __MPN(mod_1_1p_cps) +__GMP_DECLSPEC void mpn_mod_1_1p_cps __GMP_PROTO ((mp_limb_t [4], mp_limb_t)); +#define mpn_mod_1_1p __MPN(mod_1_1p) +__GMP_DECLSPEC mp_limb_t mpn_mod_1_1p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4])) __GMP_ATTRIBUTE_PURE; #define mpn_mod_1s_2p_cps __MPN(mod_1s_2p_cps) __GMP_DECLSPEC void mpn_mod_1s_2p_cps __GMP_PROTO ((mp_limb_t [5], mp_limb_t)); #define mpn_mod_1s_2p __MPN(mod_1s_2p) -__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [5])); +__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [5])) __GMP_ATTRIBUTE_PURE; #define mpn_mod_1s_3p_cps __MPN(mod_1s_3p_cps) __GMP_DECLSPEC void mpn_mod_1s_3p_cps __GMP_PROTO ((mp_limb_t [6], mp_limb_t)); #define mpn_mod_1s_3p __MPN(mod_1s_3p) -__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [6])); +__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [6])) __GMP_ATTRIBUTE_PURE; #define mpn_mod_1s_4p_cps __MPN(mod_1s_4p_cps) __GMP_DECLSPEC void mpn_mod_1s_4p_cps __GMP_PROTO ((mp_limb_t [7], mp_limb_t)); #define mpn_mod_1s_4p __MPN(mod_1s_4p) -__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [7])); +__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [7])) __GMP_ATTRIBUTE_PURE; + +#define mpn_bc_mulmod_bnm1 __MPN(bc_mulmod_bnm1) +__GMP_DECLSPEC void mpn_bc_mulmod_bnm1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_mulmod_bnm1 __MPN(mulmod_bnm1) +__GMP_DECLSPEC void mpn_mulmod_bnm1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_mulmod_bnm1_next_size __MPN(mulmod_bnm1_next_size) +__GMP_DECLSPEC mp_size_t mpn_mulmod_bnm1_next_size __GMP_PROTO ((mp_size_t)) ATTRIBUTE_CONST; +static inline mp_size_t +mpn_mulmod_bnm1_itch (mp_size_t rn, mp_size_t an, mp_size_t bn) { + mp_size_t n, itch; + n = rn >> 1; + itch = rn + 4 + + (an > n ? (bn > n ? rn : n) : 0); + return itch; +} +#define mpn_sqrmod_bnm1 __MPN(sqrmod_bnm1) +__GMP_DECLSPEC void mpn_sqrmod_bnm1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_sqrmod_bnm1_next_size __MPN(sqrmod_bnm1_next_size) +__GMP_DECLSPEC mp_size_t mpn_sqrmod_bnm1_next_size __GMP_PROTO ((mp_size_t)) ATTRIBUTE_CONST; +static inline mp_size_t +mpn_sqrmod_bnm1_itch (mp_size_t rn, mp_size_t an) { + mp_size_t n, itch; + n = rn >> 1; + itch = rn + 3 + + (an > n ? an : 0); + return itch; +} typedef __gmp_randstate_struct *gmp_randstate_ptr; typedef const __gmp_randstate_struct *gmp_randstate_srcptr; @@ -966,289 +1031,287 @@ __GMP_DECLSPEC extern gmp_randstate_t __gmp_rands; } while (0) -/* FIXME: Make these itch functions less conservative. Also consider making - them dependent on just 'an', and compute the allocation directly from 'an' - instead of via n. */ -static inline mp_size_t -mpn_toom22_mul_itch (mp_size_t an, mp_size_t bn) -{ - mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1); - return 4 * n + 2; -} +/* For a threshold between algorithms A and B, size>=thresh is where B + should be used. Special value MP_SIZE_T_MAX means only ever use A, or + value 0 means only ever use B. The tests for these special values will + be compile-time constants, so the compiler should be able to eliminate + the code for the unwanted algorithm. */ -static inline mp_size_t -mpn_toom33_mul_itch (mp_size_t an, mp_size_t bn) -{ - /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since - mpn_toom_interpolate_5pts only needs scratch otherwise. */ - mp_size_t n = (an + 2) / (size_t) 3; - return 6 * n + GMP_NUMB_BITS; -} +#define ABOVE_THRESHOLD(size,thresh) \ + ((thresh) == 0 \ + || ((thresh) != MP_SIZE_T_MAX \ + && (size) >= (thresh))) +#define BELOW_THRESHOLD(size,thresh) (! ABOVE_THRESHOLD (size, thresh)) -static inline mp_size_t -mpn_toom44_mul_itch (mp_size_t an, mp_size_t bn) -{ - mp_size_t n = (an + 3) >> 2; - return 12 * n + GMP_NUMB_BITS; -} +#define MPN_TOOM22_MUL_MINSIZE 4 +#define MPN_TOOM2_SQR_MINSIZE 4 -static inline mp_size_t -mpn_toom32_mul_itch (mp_size_t an, mp_size_t bn) -{ - mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1); - return 4 * n + 2; -} +#define MPN_TOOM33_MUL_MINSIZE 17 +#define MPN_TOOM3_SQR_MINSIZE 17 -static inline mp_size_t -mpn_toom42_mul_itch (mp_size_t an, mp_size_t bn) -{ - /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since - mpn_toom_interpolate_5pts only needs scratch otherwise. */ - mp_size_t n = an >= 2 * bn ? (an + 3) >> 2 : (bn + 1) >> 1; - return 6 * n + 3; -} +#define MPN_TOOM44_MUL_MINSIZE 30 +#define MPN_TOOM4_SQR_MINSIZE 30 -static inline mp_size_t -mpn_toom53_mul_itch (mp_size_t an, mp_size_t bn) -{ - mp_size_t n = 1 + (3 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 3); - return 10 * n + 10; -} +#define MPN_TOOM6H_MUL_MINSIZE 46 +#define MPN_TOOM6_SQR_MINSIZE 46 -static inline mp_size_t -mpn_toom2_sqr_itch (mp_size_t an) -{ - mp_size_t n = 1 + ((an - 1) >> 1); - return 4 * n + 2; -} +#define MPN_TOOM8H_MUL_MINSIZE 86 +#define MPN_TOOM8_SQR_MINSIZE 86 -static inline mp_size_t -mpn_toom3_sqr_itch (mp_size_t an) -{ - /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since - mpn_toom_interpolate_5pts only needs scratch otherwise. */ - mp_size_t n = (an + 2) / (size_t) 3; - return 6 * n + GMP_NUMB_BITS; -} +#define MPN_TOOM32_MUL_MINSIZE 10 +#define MPN_TOOM42_MUL_MINSIZE 10 +#define MPN_TOOM43_MUL_MINSIZE 49 /* ??? */ +#define MPN_TOOM53_MUL_MINSIZE 49 /* ??? */ +#define MPN_TOOM63_MUL_MINSIZE 49 -static inline mp_size_t -mpn_toom4_sqr_itch (mp_size_t an) -{ - mp_size_t n = (an + 3) >> 2; - return 12 * n + GMP_NUMB_BITS; -} +#define mpn_sqr_diagonal __MPN(sqr_diagonal) +__GMP_DECLSPEC void mpn_sqr_diagonal __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); +#define mpn_toom_interpolate_5pts __MPN(toom_interpolate_5pts) +__GMP_DECLSPEC void mpn_toom_interpolate_5pts __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_limb_t)); -/* kara uses n+1 limbs of temporary space and then recurses with the balance, - so need (n+1) + (ceil(n/2)+1) + (ceil(n/4)+1) + ... This can be solved to - 2n + o(n). Since n is very limited, o(n) in practice could be around 15. - For now, assume n is arbitrarily large. */ -#define MPN_KARA_MUL_N_TSIZE(n) (2*(n) + 2*GMP_LIMB_BITS) -#define MPN_KARA_SQR_N_TSIZE(n) (2*(n) + 2*GMP_LIMB_BITS) - -/* toom3 uses 2n + 2n/3 + o(n) limbs of temporary space if mpn_sublsh1_n is - unavailable, but just 2n + o(n) if mpn_sublsh1_n is available. It is hard - to pin down the value of o(n), since it is a complex function of - MUL_TOOM3_THRESHOLD and n. Normally toom3 is used between kara and fft; in - that case o(n) will be really limited. If toom3 is used for arbitrarily - large operands, o(n) will be larger. These definitions handle operands of - up to 8956264246117233 limbs. A single multiplication using toom3 on the - fastest hardware currently (2008) would need 10 million years, which - suggests that these limits are acceptable. */ -#if WANT_FFT -#if HAVE_NATIVE_mpn_sublsh1_n -#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 63) -#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 63) -#else -#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 2*(n/3) + 63) -#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 2*(n/3) + 63) -#endif -#else /* WANT_FFT */ -#if HAVE_NATIVE_mpn_sublsh1_n -#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 255) -#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 255) -#else -#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 2*(n/3) + 255) -#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 2*(n/3) + 255) -#endif -#define MPN_TOOM44_MAX_N 285405 -#endif /* WANT_FFT */ +enum toom6_flags {toom6_all_pos = 0, toom6_vm1_neg = 1, toom6_vm2_neg = 2}; +#define mpn_toom_interpolate_6pts __MPN(toom_interpolate_6pts) +__GMP_DECLSPEC void mpn_toom_interpolate_6pts __GMP_PROTO ((mp_ptr, mp_size_t, enum toom6_flags, mp_ptr, mp_ptr, mp_ptr, mp_size_t)); -/* need 2 so that n2>=1 */ -#define MPN_KARA_MUL_N_MINSIZE 2 -#define MPN_KARA_SQR_N_MINSIZE 2 +enum toom7_flags { toom7_w1_neg = 1, toom7_w3_neg = 2 }; +#define mpn_toom_interpolate_7pts __MPN(toom_interpolate_7pts) +__GMP_DECLSPEC void mpn_toom_interpolate_7pts __GMP_PROTO ((mp_ptr, mp_size_t, enum toom7_flags, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); -/* Need l>=1, ls>=1, and 2*ls > l (the latter for the tD MPN_INCR_U) */ -#define MPN_TOOM3_MUL_N_MINSIZE 17 -#define MPN_TOOM3_SQR_N_MINSIZE 17 +#define mpn_toom_interpolate_8pts __MPN(toom_interpolate_8pts) +__GMP_DECLSPEC void mpn_toom_interpolate_8pts __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); -#define MPN_TOOM44_MUL_N_MINSIZE 30 /* ??? */ -#define MPN_TOOM4_SQR_N_MINSIZE 30 /* ??? */ +#define mpn_toom_interpolate_12pts __MPN(toom_interpolate_12pts) +__GMP_DECLSPEC void mpn_toom_interpolate_12pts __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_ptr)); -#define mpn_sqr_diagonal __MPN(sqr_diagonal) -void mpn_sqr_diagonal __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); +#define mpn_toom_interpolate_16pts __MPN(toom_interpolate_16pts) +__GMP_DECLSPEC void mpn_toom_interpolate_16pts __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_ptr)); -#define mpn_kara_mul_n __MPN(kara_mul_n) -void mpn_kara_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom_couple_handling __MPN(toom_couple_handling) +__GMP_DECLSPEC void mpn_toom_couple_handling __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, int, mp_size_t, int, int)); -#define mpn_kara_sqr_n __MPN(kara_sqr_n) -void mpn_kara_sqr_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom_eval_dgr3_pm1 __MPN(toom_eval_dgr3_pm1) +__GMP_DECLSPEC int mpn_toom_eval_dgr3_pm1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); -#define mpn_toom_interpolate_5pts __MPN(toom_interpolate_5pts) -void mpn_toom_interpolate_5pts __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_limb_t, mp_ptr)); +#define mpn_toom_eval_dgr3_pm2 __MPN(toom_eval_dgr3_pm2) +__GMP_DECLSPEC int mpn_toom_eval_dgr3_pm2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); -enum toom4_flags { toom4_w1_neg = 1, toom4_w3_neg = 2 }; /* FIXME */ -#define mpn_toom_interpolate_7pts __MPN(toom_interpolate_7pts) -void mpn_toom_interpolate_7pts __GMP_PROTO ((mp_ptr, mp_size_t, enum toom4_flags, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); +#define mpn_toom_eval_pm1 __MPN(toom_eval_pm1) +__GMP_DECLSPEC int mpn_toom_eval_pm1 __GMP_PROTO ((mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); -#define mpn_toom3_mul_n __MPN(toom3_mul_n) -void mpn_toom3_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,mp_ptr)); +#define mpn_toom_eval_pm2 __MPN(toom_eval_pm2) +__GMP_DECLSPEC int mpn_toom_eval_pm2 __GMP_PROTO ((mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); -#define mpn_toom3_sqr_n __MPN(toom3_sqr_n) -void mpn_toom3_sqr_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom_eval_pm2exp __MPN(toom_eval_pm2exp) +__GMP_DECLSPEC int mpn_toom_eval_pm2exp __GMP_PROTO ((mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, unsigned, mp_ptr)); + +#define mpn_toom_eval_pm2rexp __MPN(toom_eval_pm2rexp) +__GMP_DECLSPEC int mpn_toom_eval_pm2rexp __GMP_PROTO ((mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, unsigned, mp_ptr)); #define mpn_toom22_mul __MPN(toom22_mul) -void mpn_toom22_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_toom22_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom32_mul __MPN(toom32_mul) +__GMP_DECLSPEC void mpn_toom32_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom42_mul __MPN(toom42_mul) +__GMP_DECLSPEC void mpn_toom42_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom52_mul __MPN(toom52_mul) +__GMP_DECLSPEC void mpn_toom52_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom62_mul __MPN(toom62_mul) +__GMP_DECLSPEC void mpn_toom62_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_toom2_sqr __MPN(toom2_sqr) -void mpn_toom2_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_toom2_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_toom33_mul __MPN(toom33_mul) -void mpn_toom33_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_toom33_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom43_mul __MPN(toom43_mul) +__GMP_DECLSPEC void mpn_toom43_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom53_mul __MPN(toom53_mul) +__GMP_DECLSPEC void mpn_toom53_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + +#define mpn_toom63_mul __MPN(toom63_mul) +__GMP_DECLSPEC void mpn_toom63_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_toom3_sqr __MPN(toom3_sqr) -void mpn_toom3_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_toom3_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_toom44_mul __MPN(toom44_mul) -void mpn_toom44_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_toom44_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_toom32_mul __MPN(toom32_mul) -void mpn_toom32_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom4_sqr __MPN(toom4_sqr) +__GMP_DECLSPEC void mpn_toom4_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_toom42_mul __MPN(toom42_mul) -void mpn_toom42_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom6h_mul __MPN(toom6h_mul) +__GMP_DECLSPEC void mpn_toom6h_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_toom53_mul __MPN(toom53_mul) -void mpn_toom53_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom6_sqr __MPN(toom6_sqr) +__GMP_DECLSPEC void mpn_toom6_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_toom62_mul __MPN(toom62_mul) -void mpn_toom62_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom8h_mul __MPN(toom8h_mul) +__GMP_DECLSPEC void mpn_toom8h_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_toom4_sqr __MPN(toom4_sqr) -void mpn_toom4_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_toom8_sqr __MPN(toom8_sqr) +__GMP_DECLSPEC void mpn_toom8_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_fft_best_k __MPN(fft_best_k) -int mpn_fft_best_k __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST; +__GMP_DECLSPEC int mpn_fft_best_k __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST; #define mpn_mul_fft __MPN(mul_fft) -mp_limb_t mpn_mul_fft __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, int)); +__GMP_DECLSPEC mp_limb_t mpn_mul_fft __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, int)); #define mpn_mul_fft_full __MPN(mul_fft_full) -void mpn_mul_fft_full __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); +__GMP_DECLSPEC void mpn_mul_fft_full __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); + +#define mpn_nussbaumer_mul __MPN(nussbaumer_mul) +__GMP_DECLSPEC void mpn_nussbaumer_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); #define mpn_fft_next_size __MPN(fft_next_size) -mp_size_t mpn_fft_next_size __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST; - -#define mpn_sb_divrem_mn __MPN(sb_divrem_mn) -mp_limb_t mpn_sb_divrem_mn __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); - -#define mpn_dc_divrem_n __MPN(dc_divrem_n) -mp_limb_t mpn_dc_divrem_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t)); - -#define mpn_sb_div_qr __MPN(sb_div_qr) -mp_limb_t mpn_sb_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr)); -#define mpn_sb_div_q __MPN(sb_div_q) -mp_limb_t mpn_sb_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr)); -#define mpn_sb_divappr_q __MPN(sb_divappr_q) -mp_limb_t mpn_sb_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr)); -#define mpn_dc_div_qr __MPN(dc_div_qr) -mp_limb_t mpn_dc_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); -#define mpn_dc_div_qr_n __MPN(dc_div_qr_n) -mp_limb_t mpn_dc_div_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_ptr)); -#define mpn_dc_div_q __MPN(dc_div_q) -mp_limb_t mpn_dc_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); -#define mpn_preinv_dc_div_qr __MPN(preinv_dc_div_qr) -mp_limb_t mpn_preinv_dc_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr)); -#define mpn_dc_divappr_q __MPN(dc_divappr_q) -mp_limb_t mpn_dc_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t)); -#define mpn_dc_divappr_q_n __MPN(dc_divappr_q_n) -mp_limb_t mpn_dc_divappr_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_ptr)); -#define mpn_preinv_dc_divappr_q __MPN(preinv_dc_divappr_q) -mp_limb_t mpn_preinv_dc_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr)); +__GMP_DECLSPEC mp_size_t mpn_fft_next_size __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST; + +#define mpn_sbpi1_div_qr __MPN(sbpi1_div_qr) +__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_sbpi1_div_q __MPN(sbpi1_div_q) +__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_sbpi1_divappr_q __MPN(sbpi1_divappr_q) +__GMP_DECLSPEC mp_limb_t mpn_sbpi1_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_dcpi1_div_qr __MPN(dcpi1_div_qr) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *)); +#define mpn_dcpi1_div_qr_n __MPN(dcpi1_div_qr_n) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, gmp_pi1_t *, mp_ptr)); + +#define mpn_dcpi1_div_q __MPN(dcpi1_div_q) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *)); + +#define mpn_dcpi1_divappr_q __MPN(dcpi1_divappr_q) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *)); +#define mpn_dcpi1_divappr_q_n __MPN(dcpi1_divappr_q_n) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, gmp_pi1_t *, mp_ptr)); + #define mpn_mu_div_qr __MPN(mu_div_qr) -mp_limb_t mpn_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_mu_div_qr_itch __MPN(mu_div_qr_itch) -mp_size_t mpn_mu_div_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t, int)); +__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t, int)); #define mpn_mu_div_qr_choose_in __MPN(mu_div_qr_choose_in) -mp_size_t mpn_mu_div_qr_choose_in __GMP_PROTO ((mp_size_t, mp_size_t, int)); +__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_choose_in __GMP_PROTO ((mp_size_t, mp_size_t, int)); + #define mpn_preinv_mu_div_qr __MPN(preinv_mu_div_qr) -void mpn_preinv_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_preinv_mu_div_qr_itch __MPN(preinv_mu_div_qr_itch) +__GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t, mp_size_t)); + #define mpn_mu_divappr_q __MPN(mu_divappr_q) -mp_limb_t mpn_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_mu_divappr_q_itch __MPN(mu_divappr_q_itch) -mp_size_t mpn_mu_divappr_q_itch __GMP_PROTO ((mp_size_t, mp_size_t, int)); +__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_itch __GMP_PROTO ((mp_size_t, mp_size_t, int)); #define mpn_mu_divappr_q_choose_in __MPN(mu_divappr_q_choose_in) -mp_size_t mpn_mu_divappr_q_choose_in __GMP_PROTO ((mp_size_t, mp_size_t, int)); +__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_choose_in __GMP_PROTO ((mp_size_t, mp_size_t, int)); + #define mpn_preinv_mu_divappr_q __MPN(preinv_mu_divappr_q) -void mpn_preinv_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + #define mpn_mu_div_q __MPN(mu_div_q) -mp_limb_t mpn_mu_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_mu_div_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_mu_div_q_itch __MPN(mu_div_q_itch) +__GMP_DECLSPEC mp_size_t mpn_mu_div_q_itch __GMP_PROTO ((mp_size_t, mp_size_t, int)); + +#define mpn_div_q __MPN(div_q) +__GMP_DECLSPEC void mpn_div_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); + #define mpn_invert __MPN(invert) -void mpn_invert __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); -#define mpn_invert_itch __MPN(invert_itch) -mp_size_t mpn_invert_itch __GMP_PROTO ((mp_size_t)); +__GMP_DECLSPEC void mpn_invert __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_invert_itch(n) mpn_invertappr_itch(n) + +#define mpn_ni_invertappr __MPN(ni_invertappr) +__GMP_DECLSPEC mp_limb_t mpn_ni_invertappr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_invertappr __MPN(invertappr) +__GMP_DECLSPEC mp_limb_t mpn_invertappr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_invertappr_itch(n) (3 * (n) + 2) #define mpn_binvert __MPN(binvert) -void mpn_binvert __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_binvert __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_binvert_itch __MPN(binvert_itch) -mp_size_t mpn_binvert_itch __GMP_PROTO ((mp_size_t)); -#define mpn_sb_bdiv_qr __MPN(sb_bdiv_qr) -mp_limb_t mpn_sb_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); -#define mpn_sb_bdiv_q __MPN(sb_bdiv_q) -void mpn_sb_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); -#define mpn_dc_bdiv_qr __MPN(dc_bdiv_qr) -mp_limb_t mpn_dc_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); -#define mpn_dc_bdiv_qr_n_itch __MPN(dc_bdiv_qr_n_itch) -mp_size_t mpn_dc_bdiv_qr_n_itch __GMP_PROTO ((mp_size_t)); -#define mpn_dc_bdiv_qr_n __MPN(dc_bdiv_qr_n) -mp_limb_t mpn_dc_bdiv_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr)); -#define mpn_dc_bdiv_q __MPN(dc_bdiv_q) -void mpn_dc_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); -#define mpn_dc_bdiv_q_n_itch __MPN(dc_bdiv_q_n_itch) -mp_size_t mpn_dc_bdiv_q_n_itch __GMP_PROTO ((mp_size_t)); -#define mpn_dc_bdiv_q_n __MPN(dc_bdiv_q_n) -void mpn_dc_bdiv_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_binvert_itch __GMP_PROTO ((mp_size_t)); + +#define mpn_bdiv_q_1 __MPN(bdiv_q_1) +__GMP_DECLSPEC mp_limb_t mpn_bdiv_q_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_pi1_bdiv_q_1 __MPN(pi1_bdiv_q_1) +__GMP_DECLSPEC mp_limb_t mpn_pi1_bdiv_q_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)); + +#define mpn_sbpi1_bdiv_qr __MPN(sbpi1_bdiv_qr) +__GMP_DECLSPEC mp_limb_t mpn_sbpi1_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_sbpi1_bdiv_q __MPN(sbpi1_bdiv_q) +__GMP_DECLSPEC void mpn_sbpi1_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_dcpi1_bdiv_qr __MPN(dcpi1_bdiv_qr) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); +#define mpn_dcpi1_bdiv_qr_n_itch __MPN(dcpi1_bdiv_qr_n_itch) +__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_qr_n_itch __GMP_PROTO ((mp_size_t)); + +#define mpn_dcpi1_bdiv_qr_n __MPN(dcpi1_bdiv_qr_n) +__GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr)); +#define mpn_dcpi1_bdiv_q __MPN(dcpi1_bdiv_q) +__GMP_DECLSPEC void mpn_dcpi1_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)); + +#define mpn_dcpi1_bdiv_q_n_itch __MPN(dcpi1_bdiv_q_n_itch) +__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_q_n_itch __GMP_PROTO ((mp_size_t)); +#define mpn_dcpi1_bdiv_q_n __MPN(dcpi1_bdiv_q_n) +__GMP_DECLSPEC void mpn_dcpi1_bdiv_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr)); + #define mpn_mu_bdiv_qr __MPN(mu_bdiv_qr) -void mpn_mu_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_limb_t mpn_mu_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_mu_bdiv_qr_itch __MPN(mu_bdiv_qr_itch) -mp_size_t mpn_mu_bdiv_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t)); + #define mpn_mu_bdiv_q __MPN(mu_bdiv_q) -void mpn_mu_bdiv_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_mu_bdiv_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_mu_bdiv_q_itch __MPN(mu_bdiv_q_itch) -mp_size_t mpn_mu_bdiv_q_itch __GMP_PROTO ((mp_size_t, mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_q_itch __GMP_PROTO ((mp_size_t, mp_size_t)); + +#define mpn_bdiv_qr __MPN(bdiv_qr) +__GMP_DECLSPEC mp_limb_t mpn_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_bdiv_qr_itch __MPN(bdiv_qr_itch) +__GMP_DECLSPEC mp_size_t mpn_bdiv_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t)); + +#define mpn_bdiv_q __MPN(bdiv_q) +__GMP_DECLSPEC void mpn_bdiv_q __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_bdiv_q_itch __MPN(bdiv_q_itch) +__GMP_DECLSPEC mp_size_t mpn_bdiv_q_itch __GMP_PROTO ((mp_size_t, mp_size_t)); #define mpn_divexact __MPN(divexact) -void mpn_divexact __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_divexact __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); #define mpn_divexact_itch __MPN(divexact_itch) -mp_size_t mpn_divexact_itch __GMP_PROTO ((mp_size_t, mp_size_t)); - +__GMP_DECLSPEC mp_size_t mpn_divexact_itch __GMP_PROTO ((mp_size_t, mp_size_t)); #define mpn_bdiv_dbm1c __MPN(bdiv_dbm1c) -mp_limb_t mpn_bdiv_dbm1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); +__GMP_DECLSPEC mp_limb_t mpn_bdiv_dbm1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)); #define mpn_bdiv_dbm1(dst, src, size, divisor) \ mpn_bdiv_dbm1c (dst, src, size, divisor, __GMP_CAST (mp_limb_t, 0)) #define mpn_powm __MPN(powm) -void mpn_powm __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_powm __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_powlo __MPN(powlo) -void mpn_powlo __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); - +__GMP_DECLSPEC void mpn_powlo __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr)); #define mpn_powm_sec __MPN(powm_sec) -void mpn_powm_sec __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_powm_sec __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr)); +#define mpn_powm_sec_itch __MPN(powm_sec_itch) +__GMP_DECLSPEC mp_size_t mpn_powm_sec_itch __GMP_PROTO ((mp_size_t, mp_size_t, mp_size_t)); #define mpn_subcnd_n __MPN(subcnd_n) -mp_limb_t mpn_subcnd_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); +__GMP_DECLSPEC mp_limb_t mpn_subcnd_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t)); #define mpn_tabselect __MPN(tabselect) -void mpn_tabselect __GMP_PROTO ((volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t, mp_size_t, mp_size_t)); +__GMP_DECLSPEC void mpn_tabselect __GMP_PROTO ((volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t, mp_size_t, mp_size_t)); +#define mpn_redc_1_sec __MPN(redc_1_sec) +__GMP_DECLSPEC void mpn_redc_1_sec __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); #ifndef DIVEXACT_BY3_METHOD #if GMP_NUMB_BITS % 2 == 0 && ! defined (HAVE_NATIVE_mpn_divexact_by3c) @@ -1301,18 +1364,18 @@ void mpn_tabselect __GMP_PROTO ((volatile mp_limb_t *, volatile mp_limb_t * #endif #define mpz_divexact_gcd __gmpz_divexact_gcd -void mpz_divexact_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); +__GMP_DECLSPEC void mpz_divexact_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); #define mpz_inp_str_nowhite __gmpz_inp_str_nowhite #ifdef _GMP_H_HAVE_FILE -size_t mpz_inp_str_nowhite __GMP_PROTO ((mpz_ptr, FILE *, int, int, size_t)); +__GMP_DECLSPEC size_t mpz_inp_str_nowhite __GMP_PROTO ((mpz_ptr, FILE *, int, int, size_t)); #endif #define mpn_divisible_p __MPN(divisible_p) -int mpn_divisible_p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE; +__GMP_DECLSPEC int mpn_divisible_p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE; #define mpn_rootrem __MPN(rootrem) -mp_size_t mpn_rootrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); +__GMP_DECLSPEC mp_size_t mpn_rootrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); #if defined (_CRAY) @@ -1562,7 +1625,7 @@ __GMP_DECLSPEC void mpn_copyd __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); mpz_ptr __x = (X); \ ASSERT ((NLIMBS) >= 1); \ __x->_mp_alloc = (NLIMBS); \ - __x->_mp_d = (mp_ptr) TMP_ALLOC ((NLIMBS) * BYTES_PER_MP_LIMB); \ + __x->_mp_d = TMP_ALLOC_LIMBS (NLIMBS); \ } while (0) /* Realloc for an mpz_t WHAT if it has less than NEEDED limbs. */ @@ -1606,149 +1669,197 @@ __GMP_DECLSPEC void mpn_copyd __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; #define FIB_TABLE(n) (__gmp_fib_table[(n)+1]) +#define SIEVESIZE 512 /* FIXME: Allow gmp_init_primesieve to choose */ +typedef struct +{ + unsigned long d; /* current index in s[] */ + unsigned long s0; /* number corresponding to s[0] */ + unsigned long sqrt_s0; /* misnomer for sqrt(s[SIEVESIZE-1]) */ + unsigned char s[SIEVESIZE + 1]; /* sieve table */ +} gmp_primesieve_t; -/* For a threshold between algorithms A and B, size>=thresh is where B - should be used. Special value MP_SIZE_T_MAX means only ever use A, or - value 0 means only ever use B. The tests for these special values will - be compile-time constants, so the compiler should be able to eliminate - the code for the unwanted algorithm. */ +#define gmp_init_primesieve __gmp_init_primesieve +__GMP_DECLSPEC void gmp_init_primesieve (gmp_primesieve_t *); -#define ABOVE_THRESHOLD(size,thresh) \ - ((thresh) == 0 \ - || ((thresh) != MP_SIZE_T_MAX \ - && (size) >= (thresh))) -#define BELOW_THRESHOLD(size,thresh) (! ABOVE_THRESHOLD (size, thresh)) +#define gmp_nextprime __gmp_nextprime +__GMP_DECLSPEC unsigned long int gmp_nextprime (gmp_primesieve_t *); -/* Usage: int use_foo = BELOW_THRESHOLD (size, FOO_THRESHOLD); - ... - if (CACHED_BELOW_THRESHOLD (use_foo, size, FOO_THRESHOLD)) - When "use_foo" is a constant (thresh is 0 or MP_SIZE_T), gcc prior to - version 3.3 doesn't optimize away a test "if (use_foo)" when within a - loop. CACHED_BELOW_THRESHOLD helps it do so. */ +#ifndef MUL_TOOM22_THRESHOLD +#define MUL_TOOM22_THRESHOLD 30 +#endif -#define CACHED_ABOVE_THRESHOLD(cache, thresh) \ - ((thresh) == 0 || (thresh) == MP_SIZE_T_MAX \ - ? ABOVE_THRESHOLD (0, thresh) \ - : (cache)) -#define CACHED_BELOW_THRESHOLD(cache, thresh) \ - ((thresh) == 0 || (thresh) == MP_SIZE_T_MAX \ - ? BELOW_THRESHOLD (0, thresh) \ - : (cache)) +#ifndef MUL_TOOM33_THRESHOLD +#define MUL_TOOM33_THRESHOLD 100 +#endif +#ifndef MUL_TOOM44_THRESHOLD +#define MUL_TOOM44_THRESHOLD 300 +#endif -/* If MUL_KARATSUBA_THRESHOLD is not already defined, define it to a - value which is good on most machines. */ -#ifndef MUL_KARATSUBA_THRESHOLD -#define MUL_KARATSUBA_THRESHOLD 32 +#ifndef MUL_TOOM6H_THRESHOLD +#define MUL_TOOM6H_THRESHOLD 350 #endif -/* If MUL_TOOM3_THRESHOLD is not already defined, define it to a - value which is good on most machines. */ -#ifndef MUL_TOOM3_THRESHOLD -#define MUL_TOOM3_THRESHOLD 128 +#ifndef SQR_TOOM6_THRESHOLD +#define SQR_TOOM6_THRESHOLD MUL_TOOM6H_THRESHOLD #endif -#ifndef MUL_TOOM44_THRESHOLD -#define MUL_TOOM44_THRESHOLD 500 +#ifndef MUL_TOOM8H_THRESHOLD +#define MUL_TOOM8H_THRESHOLD 450 #endif -/* Source compatibility while source is in flux. */ -#define MUL_TOOM22_THRESHOLD MUL_KARATSUBA_THRESHOLD -#define MUL_TOOM33_THRESHOLD MUL_TOOM3_THRESHOLD -#define SQR_TOOM2_THRESHOLD SQR_KARATSUBA_THRESHOLD +#ifndef SQR_TOOM8_THRESHOLD +#define SQR_TOOM8_THRESHOLD MUL_TOOM8H_THRESHOLD +#endif -/* MUL_KARATSUBA_THRESHOLD_LIMIT is the maximum for MUL_KARATSUBA_THRESHOLD. - In a normal build MUL_KARATSUBA_THRESHOLD is a constant and we use that. - In a fat binary or tune program build MUL_KARATSUBA_THRESHOLD is a - variable and a separate hard limit will have been defined. Similarly for - TOOM3. */ -#ifndef MUL_KARATSUBA_THRESHOLD_LIMIT -#define MUL_KARATSUBA_THRESHOLD_LIMIT MUL_KARATSUBA_THRESHOLD +#ifndef MUL_TOOM32_TO_TOOM43_THRESHOLD +#define MUL_TOOM32_TO_TOOM43_THRESHOLD 100 #endif -#ifndef MUL_TOOM3_THRESHOLD_LIMIT -#define MUL_TOOM3_THRESHOLD_LIMIT MUL_TOOM3_THRESHOLD + +#ifndef MUL_TOOM32_TO_TOOM53_THRESHOLD +#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110 #endif -#ifndef MULLOW_BASECASE_THRESHOLD_LIMIT -#define MULLOW_BASECASE_THRESHOLD_LIMIT MULLOW_BASECASE_THRESHOLD + +#ifndef MUL_TOOM42_TO_TOOM53_THRESHOLD +#define MUL_TOOM42_TO_TOOM53_THRESHOLD 100 +#endif + +#ifndef MUL_TOOM42_TO_TOOM63_THRESHOLD +#define MUL_TOOM42_TO_TOOM63_THRESHOLD 110 +#endif + +/* MUL_TOOM22_THRESHOLD_LIMIT is the maximum for MUL_TOOM22_THRESHOLD. In a + normal build MUL_TOOM22_THRESHOLD is a constant and we use that. In a fat + binary or tune program build MUL_TOOM22_THRESHOLD is a variable and a + separate hard limit will have been defined. Similarly for TOOM3. */ +#ifndef MUL_TOOM22_THRESHOLD_LIMIT +#define MUL_TOOM22_THRESHOLD_LIMIT MUL_TOOM22_THRESHOLD +#endif +#ifndef MUL_TOOM33_THRESHOLD_LIMIT +#define MUL_TOOM33_THRESHOLD_LIMIT MUL_TOOM33_THRESHOLD +#endif +#ifndef MULLO_BASECASE_THRESHOLD_LIMIT +#define MULLO_BASECASE_THRESHOLD_LIMIT MULLO_BASECASE_THRESHOLD #endif /* SQR_BASECASE_THRESHOLD is where mpn_sqr_basecase should take over from - mpn_mul_basecase in mpn_sqr_n. Default is to use mpn_sqr_basecase - always. (Note that we certainly always want it if there's a native - assembler mpn_sqr_basecase.) + mpn_mul_basecase. Default is to use mpn_sqr_basecase from 0. (Note that we + certainly always want it if there's a native assembler mpn_sqr_basecase.) - If it turns out that mpn_kara_sqr_n becomes faster than mpn_mul_basecase - before mpn_sqr_basecase does, then SQR_BASECASE_THRESHOLD is the - karatsuba threshold and SQR_KARATSUBA_THRESHOLD is 0. This oddity arises - more or less because SQR_KARATSUBA_THRESHOLD represents the size up to - which mpn_sqr_basecase should be used, and that may be never. */ + If it turns out that mpn_toom2_sqr becomes faster than mpn_mul_basecase + before mpn_sqr_basecase does, then SQR_BASECASE_THRESHOLD is the toom2 + threshold and SQR_TOOM2_THRESHOLD is 0. This oddity arises more or less + because SQR_TOOM2_THRESHOLD represents the size up to which mpn_sqr_basecase + should be used, and that may be never. */ #ifndef SQR_BASECASE_THRESHOLD -#define SQR_BASECASE_THRESHOLD 0 +#define SQR_BASECASE_THRESHOLD 0 #endif -#ifndef SQR_KARATSUBA_THRESHOLD -#define SQR_KARATSUBA_THRESHOLD (2*MUL_KARATSUBA_THRESHOLD) +#ifndef SQR_TOOM2_THRESHOLD +#define SQR_TOOM2_THRESHOLD 50 #endif #ifndef SQR_TOOM3_THRESHOLD -#define SQR_TOOM3_THRESHOLD 128 +#define SQR_TOOM3_THRESHOLD 120 #endif #ifndef SQR_TOOM4_THRESHOLD -#define SQR_TOOM4_THRESHOLD 500 +#define SQR_TOOM4_THRESHOLD 400 #endif -/* See comments above about MUL_TOOM3_THRESHOLD_LIMIT. */ +/* See comments above about MUL_TOOM33_THRESHOLD_LIMIT. */ #ifndef SQR_TOOM3_THRESHOLD_LIMIT #define SQR_TOOM3_THRESHOLD_LIMIT SQR_TOOM3_THRESHOLD #endif #ifndef DC_DIV_QR_THRESHOLD -#define DC_DIV_QR_THRESHOLD 43 +#define DC_DIV_QR_THRESHOLD 50 #endif #ifndef DC_DIVAPPR_Q_THRESHOLD -#define DC_DIVAPPR_Q_THRESHOLD 208 -#endif - -#ifndef DC_DIV_Q_THRESHOLD -#define DC_DIV_Q_THRESHOLD 228 +#define DC_DIVAPPR_Q_THRESHOLD 200 #endif #ifndef DC_BDIV_QR_THRESHOLD -#define DC_BDIV_QR_THRESHOLD 52 +#define DC_BDIV_QR_THRESHOLD 50 #endif #ifndef DC_BDIV_Q_THRESHOLD -#define DC_BDIV_Q_THRESHOLD 224 +#define DC_BDIV_Q_THRESHOLD 180 #endif #ifndef DIVEXACT_JEB_THRESHOLD -#define DIVEXACT_JEB_THRESHOLD 25 +#define DIVEXACT_JEB_THRESHOLD 25 +#endif + +#ifndef INV_MULMOD_BNM1_THRESHOLD +#define INV_MULMOD_BNM1_THRESHOLD (5*MULMOD_BNM1_THRESHOLD) +#endif + +#ifndef INV_APPR_THRESHOLD +#define INV_APPR_THRESHOLD INV_NEWTON_THRESHOLD #endif #ifndef INV_NEWTON_THRESHOLD -#define INV_NEWTON_THRESHOLD 654 +#define INV_NEWTON_THRESHOLD 200 #endif #ifndef BINV_NEWTON_THRESHOLD -#define BINV_NEWTON_THRESHOLD 807 +#define BINV_NEWTON_THRESHOLD 300 #endif #ifndef MU_DIVAPPR_Q_THRESHOLD -#define MU_DIVAPPR_Q_THRESHOLD 4000 +#define MU_DIVAPPR_Q_THRESHOLD 2000 +#endif + +#ifndef MU_DIV_QR_THRESHOLD +#define MU_DIV_QR_THRESHOLD 2000 #endif -#ifndef MU_DIV_Q_THRESHOLD -#define MU_DIV_Q_THRESHOLD 4000 +#ifndef MUPI_DIV_QR_THRESHOLD +#define MUPI_DIV_QR_THRESHOLD 200 #endif #ifndef MU_BDIV_Q_THRESHOLD -#define MU_BDIV_Q_THRESHOLD 2000 +#define MU_BDIV_Q_THRESHOLD 2000 +#endif + +#ifndef MU_BDIV_QR_THRESHOLD +#define MU_BDIV_QR_THRESHOLD 2000 +#endif + +#ifndef MULMOD_BNM1_THRESHOLD +#define MULMOD_BNM1_THRESHOLD 16 +#endif + +#ifndef SQRMOD_BNM1_THRESHOLD +#define SQRMOD_BNM1_THRESHOLD 16 +#endif + +#ifndef MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD +#define MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD (INV_MULMOD_BNM1_THRESHOLD/2) +#endif + +#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2 + +#ifndef REDC_1_TO_REDC_2_THRESHOLD +#define REDC_1_TO_REDC_2_THRESHOLD 15 +#endif +#ifndef REDC_2_TO_REDC_N_THRESHOLD +#define REDC_2_TO_REDC_N_THRESHOLD 100 +#endif + +#else + +#ifndef REDC_1_TO_REDC_N_THRESHOLD +#define REDC_1_TO_REDC_N_THRESHOLD 100 #endif +#endif /* HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2 */ + + /* First k to use for an FFT modF multiply. A modF FFT is an order log(2^k)/log(2^(k-1)) algorithm, so k=3 is merely 1.5 like karatsuba, whereas k=4 is 1.33 which is faster than toom3 at 1.485. */ @@ -1756,7 +1867,7 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; /* Threshold at which FFT should be used to do a modF NxN -> N multiply. */ #ifndef MUL_FFT_MODF_THRESHOLD -#define MUL_FFT_MODF_THRESHOLD (MUL_TOOM3_THRESHOLD * 3) +#define MUL_FFT_MODF_THRESHOLD (MUL_TOOM33_THRESHOLD * 3) #endif #ifndef SQR_FFT_MODF_THRESHOLD #define SQR_FFT_MODF_THRESHOLD (SQR_TOOM3_THRESHOLD * 3) @@ -1779,12 +1890,12 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; etc. See mpn_fft_best_k(). */ #ifndef MUL_FFT_TABLE #define MUL_FFT_TABLE \ - { MUL_TOOM3_THRESHOLD * 4, /* k=5 */ \ - MUL_TOOM3_THRESHOLD * 8, /* k=6 */ \ - MUL_TOOM3_THRESHOLD * 16, /* k=7 */ \ - MUL_TOOM3_THRESHOLD * 32, /* k=8 */ \ - MUL_TOOM3_THRESHOLD * 96, /* k=9 */ \ - MUL_TOOM3_THRESHOLD * 288, /* k=10 */ \ + { MUL_TOOM33_THRESHOLD * 4, /* k=5 */ \ + MUL_TOOM33_THRESHOLD * 8, /* k=6 */ \ + MUL_TOOM33_THRESHOLD * 16, /* k=7 */ \ + MUL_TOOM33_THRESHOLD * 32, /* k=8 */ \ + MUL_TOOM33_THRESHOLD * 96, /* k=9 */ \ + MUL_TOOM33_THRESHOLD * 288, /* k=10 */ \ 0 } #endif #ifndef SQR_FFT_TABLE @@ -1798,6 +1909,12 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; 0 } #endif +struct fft_table_nk +{ + unsigned int n:27; + unsigned int k:5; +}; + #ifndef FFT_TABLE_ATTRS #define FFT_TABLE_ATTRS static const #endif @@ -1805,15 +1922,8 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; #define MPN_FFT_TABLE_SIZE 16 -/* mpn_dc_divrem_n(n) calls 2*mul(n/2)+2*div(n/2), thus to be faster than - div(n) = 4*div(n/2), we need mul(n/2) to be faster than the classic way, - i.e. n/2 >= MUL_KARATSUBA_THRESHOLD - - Measured values are between 2 and 4 times MUL_KARATSUBA_THRESHOLD, so go - for 3 as an average. */ - -#ifndef DIV_DC_THRESHOLD -#define DIV_DC_THRESHOLD (3 * MUL_KARATSUBA_THRESHOLD) +#ifndef DC_DIV_QR_THRESHOLD +#define DC_DIV_QR_THRESHOLD (3 * MUL_TOOM22_THRESHOLD) #endif #ifndef GET_STR_DC_THRESHOLD @@ -1882,7 +1992,7 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[]; #define ASSERT_FILE "" #endif -void __gmp_assert_header __GMP_PROTO ((const char *, int)); +__GMP_DECLSPEC void __gmp_assert_header __GMP_PROTO ((const char *, int)); __GMP_DECLSPEC void __gmp_assert_fail __GMP_PROTO ((const char *, int, const char *)) ATTRIBUTE_NORETURN; #if HAVE_STRINGIZE @@ -2008,11 +2118,9 @@ __GMP_DECLSPEC void __gmp_assert_fail __GMP_PROTO ((const char *, int, const cha #endif -#if HAVE_NATIVE_mpn_com_n -#define mpn_com_n __MPN(com_n) -void mpn_com_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); -#else -#define mpn_com_n(d,s,n) \ +#if ! HAVE_NATIVE_mpn_com +#undef mpn_com +#define mpn_com(d,s,n) \ do { \ mp_ptr __d = (d); \ mp_srcptr __s = (s); \ @@ -2025,84 +2133,82 @@ void mpn_com_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t)); } while (0) #endif -#define MPN_LOGOPS_N_INLINE(d, s1, s2, n, operation) \ - do { \ - mp_ptr __d = (d); \ - mp_srcptr __s1 = (s1); \ - mp_srcptr __s2 = (s2); \ - mp_size_t __n = (n); \ - ASSERT (__n >= 1); \ - ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s1, __n)); \ - ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s2, __n)); \ - do \ - operation; \ - while (--__n); \ +#define MPN_LOGOPS_N_INLINE(rp, up, vp, n, operation) \ + do { \ + mp_srcptr __up = (up); \ + mp_srcptr __vp = (vp); \ + mp_ptr __rp = (rp); \ + mp_size_t __n = (n); \ + mp_limb_t __a, __b; \ + ASSERT (__n > 0); \ + ASSERT (MPN_SAME_OR_SEPARATE_P (__rp, __up, __n)); \ + ASSERT (MPN_SAME_OR_SEPARATE_P (__rp, __vp, __n)); \ + __up += __n; \ + __vp += __n; \ + __rp += __n; \ + __n = -__n; \ + do { \ + __a = __up[__n]; \ + __b = __vp[__n]; \ + __rp[__n] = operation; \ + } while (++__n); \ } while (0) -#if HAVE_NATIVE_mpn_and_n -#define mpn_and_n __MPN(and_n) -void mpn_and_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_and_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ & *__s2++) + +#if ! HAVE_NATIVE_mpn_and_n +#undef mpn_and_n +#define mpn_and_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a & __b) #endif -#if HAVE_NATIVE_mpn_andn_n -#define mpn_andn_n __MPN(andn_n) -void mpn_andn_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_andn_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ & ~*__s2++) +#if ! HAVE_NATIVE_mpn_andn_n +#undef mpn_andn_n +#define mpn_andn_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a & ~__b) #endif -#if HAVE_NATIVE_mpn_nand_n -#define mpn_nand_n __MPN(nand_n) -void mpn_nand_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_nand_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ & *__s2++) & GMP_NUMB_MASK) +#if ! HAVE_NATIVE_mpn_nand_n +#undef mpn_nand_n +#define mpn_nand_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a & __b) & GMP_NUMB_MASK) #endif -#if HAVE_NATIVE_mpn_ior_n -#define mpn_ior_n __MPN(ior_n) -void mpn_ior_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_ior_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ | *__s2++) +#if ! HAVE_NATIVE_mpn_ior_n +#undef mpn_ior_n +#define mpn_ior_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a | __b) #endif -#if HAVE_NATIVE_mpn_iorn_n -#define mpn_iorn_n __MPN(iorn_n) -void mpn_iorn_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_iorn_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = (*__s1++ | ~*__s2++) & GMP_NUMB_MASK) +#if ! HAVE_NATIVE_mpn_iorn_n +#undef mpn_iorn_n +#define mpn_iorn_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, (__a | ~__b) & GMP_NUMB_MASK) #endif -#if HAVE_NATIVE_mpn_nior_n -#define mpn_nior_n __MPN(nior_n) -void mpn_nior_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_nior_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ | *__s2++) & GMP_NUMB_MASK) +#if ! HAVE_NATIVE_mpn_nior_n +#undef mpn_nior_n +#define mpn_nior_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a | __b) & GMP_NUMB_MASK) #endif -#if HAVE_NATIVE_mpn_xor_n -#define mpn_xor_n __MPN(xor_n) -void mpn_xor_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_xor_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ ^ *__s2++) +#if ! HAVE_NATIVE_mpn_xor_n +#undef mpn_xor_n +#define mpn_xor_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a ^ __b) #endif -#if HAVE_NATIVE_mpn_xnor_n -#define mpn_xnor_n __MPN(xnor_n) -void mpn_xnor_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); -#else -#define mpn_xnor_n(d, s1, s2, n) \ - MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ ^ *__s2++) & GMP_NUMB_MASK) +#if ! HAVE_NATIVE_mpn_xnor_n +#undef mpn_xnor_n +#define mpn_xnor_n(rp, up, vp, n) \ + MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a ^ __b) & GMP_NUMB_MASK) #endif +#define mpn_trialdiv __MPN(trialdiv) +__GMP_DECLSPEC mp_limb_t mpn_trialdiv __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, int *)); + +#define mpn_remove __MPN(remove) +__GMP_DECLSPEC mp_bitcnt_t mpn_remove __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_bitcnt_t)); + /* ADDC_LIMB sets w=x+y and cout to 0 or 1 for a carry from that addition. */ #if GMP_NAIL_BITS == 0 @@ -2163,7 +2269,7 @@ void mpn_xnor_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)); for the benefit of assertion checking. */ #if defined (__GNUC__) && HAVE_HOST_CPU_FAMILY_x86 && GMP_NAIL_BITS == 0 \ - && BITS_PER_MP_LIMB == 32 && ! defined (NO_ASM) && ! WANT_ASSERT + && GMP_LIMB_BITS == 32 && ! defined (NO_ASM) && ! WANT_ASSERT /* Better flags handling than the generic C gives on i386, saving a few bytes of code and maybe a cycle or two. */ @@ -2352,14 +2458,13 @@ struct bases i.e. the number of bits used to represent each digit in the base. */ mp_limb_t big_base; - /* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a + /* A GMP_LIMB_BITS bit approximation to 1/big_base, represented as a fixed-point number. Instead of dividing by big_base an application can choose to multiply by big_base_inverted. */ mp_limb_t big_base_inverted; }; #define mp_bases __MPN(bases) -#define __mp_bases __MPN(bases) __GMP_DECLSPEC extern const struct bases mp_bases[257]; @@ -2484,7 +2589,7 @@ __GMP_DECLSPEC extern const struct bases mp_bases[257]; /* Use a library function for invert_limb, if available. */ #define mpn_invert_limb __MPN(invert_limb) -mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST; +__GMP_DECLSPEC mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST; #if ! defined (invert_limb) && HAVE_NATIVE_mpn_invert_limb #define invert_limb(invxl,xl) \ do { \ @@ -2501,12 +2606,41 @@ mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST; } while (0) #endif +#define invert_pi1(dinv, d1, d0) \ + do { \ + mp_limb_t v, p, t1, t0, mask; \ + invert_limb (v, d1); \ + p = d1 * v; \ + p += d0; \ + if (p < d0) \ + { \ + v--; \ + mask = -(p >= d1); \ + p -= d1; \ + v += mask; \ + p -= mask & d1; \ + } \ + umul_ppmm (t1, t0, d0, v); \ + p += t1; \ + if (p < t1) \ + { \ + v--; \ + if (UNLIKELY (p >= d1)) \ + { \ + if (p > d1 || t0 >= d0) \ + v--; \ + } \ + } \ + (dinv).inv32 = v; \ + } while (0) + + #ifndef udiv_qrnnd_preinv #define udiv_qrnnd_preinv udiv_qrnnd_preinv3 #endif /* Divide the two-limb number in (NH,,NL) by D, with DI being the largest - limb not larger than (2**(2*BITS_PER_MP_LIMB))/D - (2**BITS_PER_MP_LIMB). + limb not larger than (2**(2*GMP_LIMB_BITS))/D - (2**GMP_LIMB_BITS). If this would yield overflow, DI should be the largest possible number (i.e., only ones). For correct operation, the most significant bit of D has to be set. Put the quotient in Q and the remainder in R. */ @@ -2563,8 +2697,8 @@ mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST; do { \ mp_limb_t _n2, _n10, _nmask, _nadj, _q1; \ mp_limb_t _xh, _xl; \ - _n2 = ((nh) << (BITS_PER_MP_LIMB - (lgup))) + ((nl) >> 1 >> (l - 1));\ - _n10 = (nl) << (BITS_PER_MP_LIMB - (lgup)); \ + _n2 = ((nh) << (GMP_LIMB_BITS - (lgup))) + ((nl) >> 1 >> (l - 1)); \ + _n10 = (nl) << (GMP_LIMB_BITS - (lgup)); \ _nmask = LIMB_HIGHBIT_TO_MASK (_n10); \ _nadj = _n10 + (_nmask & (dnorm)); \ umul_ppmm (_xh, _xl, di, _n2 - _nmask); \ @@ -2637,22 +2771,54 @@ mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST; (r) = _r; \ } while (0) +/* Compute quotient the quotient and remainder for n / d. Requires d + >= B^2 / 2 and n < d B. di is the inverse + + floor ((B^3 - 1) / (d0 + d1 B)) - B. + + NOTE: Output variables are updated multiple times. Only some inputs + and outputs may overlap. +*/ +#define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \ + do { \ + mp_limb_t _q0, _t1, _t0, _mask; \ + umul_ppmm ((q), _q0, (n2), (dinv)); \ + add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \ + \ + /* Compute the two most significant limbs of n - q'd */ \ + (r1) = (n1) - (d1) * (q); \ + (r0) = (n0); \ + sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \ + umul_ppmm (_t1, _t0, (d0), (q)); \ + sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \ + (q)++; \ + \ + /* Conditionally adjust q and the remainders */ \ + _mask = - (mp_limb_t) ((r1) >= _q0); \ + (q) += _mask; \ + add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \ + if (UNLIKELY ((r1) >= (d1))) \ + { \ + if ((r1) > (d1) || (r0) >= (d0)) \ + { \ + (q)++; \ + sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \ + } \ + } \ + } while (0) + #ifndef mpn_preinv_divrem_1 /* if not done with cpuvec in a fat binary */ #define mpn_preinv_divrem_1 __MPN(preinv_divrem_1) -mp_limb_t mpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)); +__GMP_DECLSPEC mp_limb_t mpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)); #endif -/* USE_PREINV_DIVREM_1 is whether to use mpn_preinv_divrem_1, as opposed to - the plain mpn_divrem_1. Likewise USE_PREINV_MOD_1 chooses between - mpn_preinv_mod_1 and plain mpn_mod_1. The default for both is yes, since - the few CISC chips where preinv is not good have defines saying so. */ +/* USE_PREINV_DIVREM_1 is whether to use mpn_preinv_divrem_1, as opposed to the + plain mpn_divrem_1. The default is yes, since the few CISC chips where + preinv is not good have defines saying so. */ #ifndef USE_PREINV_DIVREM_1 #define USE_PREINV_DIVREM_1 1 #endif -#ifndef USE_PREINV_MOD_1 -#define USE_PREINV_MOD_1 1 -#endif #if USE_PREINV_DIVREM_1 #define MPN_DIVREM_OR_PREINV_DIVREM_1(qp,xsize,ap,size,d,dinv,shift) \ @@ -2662,36 +2828,39 @@ mp_limb_t mpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_siz mpn_divrem_1 (qp, xsize, ap, size, d) #endif -#if USE_PREINV_MOD_1 -#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \ - mpn_preinv_mod_1 (src, size, divisor, inverse) -#else -#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \ - mpn_mod_1 (src, size, divisor) +#ifndef PREINV_MOD_1_TO_MOD_1_THRESHOLD +#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10 #endif +/* This selection may seem backwards. The reason mpn_mod_1 typically takes + over for larger sizes is that it uses the mod_1_1 function. */ +#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \ + (BELOW_THRESHOLD (size, PREINV_MOD_1_TO_MOD_1_THRESHOLD) \ + ? mpn_preinv_mod_1 (src, size, divisor, inverse) \ + : mpn_mod_1 (src, size, divisor)) + #ifndef mpn_mod_34lsub1 /* if not done with cpuvec in a fat binary */ #define mpn_mod_34lsub1 __MPN(mod_34lsub1) -mp_limb_t mpn_mod_34lsub1 __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE; +__GMP_DECLSPEC mp_limb_t mpn_mod_34lsub1 __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE; #endif /* DIVEXACT_1_THRESHOLD is at what size to use mpn_divexact_1, as opposed to - plain mpn_divrem_1. Likewise MODEXACT_1_ODD_THRESHOLD for + plain mpn_divrem_1. Likewise BMOD_1_TO_MOD_1_THRESHOLD for mpn_modexact_1_odd against plain mpn_mod_1. On most CPUs divexact and modexact are faster at all sizes, so the defaults are 0. Those CPUs where this is not right have a tuned threshold. */ #ifndef DIVEXACT_1_THRESHOLD #define DIVEXACT_1_THRESHOLD 0 #endif -#ifndef MODEXACT_1_ODD_THRESHOLD -#define MODEXACT_1_ODD_THRESHOLD 0 +#ifndef BMOD_1_TO_MOD_1_THRESHOLD +#define BMOD_1_TO_MOD_1_THRESHOLD 10 #endif #ifndef mpn_divexact_1 /* if not done with cpuvec in a fat binary */ #define mpn_divexact_1 __MPN(divexact_1) -void mpn_divexact_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); +__GMP_DECLSPEC void mpn_divexact_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); #endif #define MPN_DIVREM_OR_DIVEXACT_1(dst, src, size, divisor) \ @@ -2707,23 +2876,22 @@ void mpn_divexact_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); #ifndef mpn_modexact_1c_odd /* if not done with cpuvec in a fat binary */ #define mpn_modexact_1c_odd __MPN(modexact_1c_odd) -mp_limb_t mpn_modexact_1c_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; +__GMP_DECLSPEC mp_limb_t mpn_modexact_1c_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; #endif #if HAVE_NATIVE_mpn_modexact_1_odd #define mpn_modexact_1_odd __MPN(modexact_1_odd) -mp_limb_t mpn_modexact_1_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; +__GMP_DECLSPEC mp_limb_t mpn_modexact_1_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE; #else #define mpn_modexact_1_odd(src,size,divisor) \ mpn_modexact_1c_odd (src, size, divisor, CNST_LIMB(0)) #endif #define MPN_MOD_OR_MODEXACT_1_ODD(src,size,divisor) \ - (ABOVE_THRESHOLD (size, MODEXACT_1_ODD_THRESHOLD) \ + (BELOW_THRESHOLD (size, BMOD_1_TO_MOD_1_THRESHOLD) \ ? mpn_modexact_1_odd (src, size, divisor) \ : mpn_mod_1 (src, size, divisor)) - /* binvert_limb() sets inv to the multiplicative inverse of n modulo 2^GMP_NUMB_BITS, ie. satisfying inv*n == 1 mod 2^GMP_NUMB_BITS. n must be odd (otherwise such an inverse doesn't exist). @@ -2895,7 +3063,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; version 3.1 at least) doesn't seem to know how to generate rlwimi for anything other than bit-fields, so use "asm". */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && HAVE_HOST_CPU_FAMILY_powerpc && BITS_PER_MP_LIMB == 32 + && HAVE_HOST_CPU_FAMILY_powerpc && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ mp_limb_t __bswapl_src = (src); \ @@ -2916,7 +3084,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; partial register stalls on P6 chips. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ && HAVE_HOST_CPU_FAMILY_x86 && ! HAVE_HOST_CPU_i386 \ - && BITS_PER_MP_LIMB == 32 + && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ __asm__ ("bswap %0" : "=r" (dst) : "0" (src)); \ @@ -2924,7 +3092,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; #endif #if defined (__GNUC__) && ! defined (NO_ASM) \ - && defined (__amd64__) && BITS_PER_MP_LIMB == 64 + && defined (__amd64__) && GMP_LIMB_BITS == 64 #define BSWAP_LIMB(dst, src) \ do { \ __asm__ ("bswap %q0" : "=r" (dst) : "0" (src)); \ @@ -2941,7 +3109,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* As per glibc. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && HAVE_HOST_CPU_FAMILY_m68k && BITS_PER_MP_LIMB == 32 + && HAVE_HOST_CPU_FAMILY_m68k && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ mp_limb_t __bswapl_src = (src); \ @@ -2954,17 +3122,17 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; #endif #if ! defined (BSWAP_LIMB) -#if BITS_PER_MP_LIMB == 8 +#if GMP_LIMB_BITS == 8 #define BSWAP_LIMB(dst, src) \ do { (dst) = (src); } while (0) #endif -#if BITS_PER_MP_LIMB == 16 +#if GMP_LIMB_BITS == 16 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = ((src) << 8) + ((src) >> 8); \ } while (0) #endif -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = \ @@ -2974,7 +3142,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; + ((src) >> 24); \ } while (0) #endif -#if BITS_PER_MP_LIMB == 64 +#if GMP_LIMB_BITS == 64 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = \ @@ -3009,7 +3177,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* Apparently lwbrx might be slow on some PowerPC chips, so restrict it to those we know are fast. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \ + && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \ && (HAVE_HOST_CPU_powerpc604 \ || HAVE_HOST_CPU_powerpc604e \ || HAVE_HOST_CPU_powerpc750 \ @@ -3034,7 +3202,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* On the same basis that lwbrx might be slow, restrict stwbrx to those we know are fast. FIXME: Is this necessary? */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \ + && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \ && (HAVE_HOST_CPU_powerpc604 \ || HAVE_HOST_CPU_powerpc604e \ || HAVE_HOST_CPU_powerpc750 \ @@ -3095,7 +3263,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* No processor claiming to be SPARC v9 compliant seems to implement the POPC instruction. Disable pattern for now. */ #if 0 -#if defined __GNUC__ && defined __sparc_v9__ && BITS_PER_MP_LIMB == 64 +#if defined __GNUC__ && defined __sparc_v9__ && GMP_LIMB_BITS == 64 #define popc_limb(result, input) \ do { \ DItype __res; \ @@ -3209,7 +3377,7 @@ typedef unsigned long int UDItype; typedef mp_limb_t UWtype; typedef unsigned int UHWtype; -#define W_TYPE_SIZE BITS_PER_MP_LIMB +#define W_TYPE_SIZE GMP_LIMB_BITS /* Define ieee_double_extract and _GMP_IEEE_FLOATS. @@ -3276,10 +3444,10 @@ union ieee_double_extract We assume doubles have 53 mantissa bits. */ #define LIMBS_PER_DOUBLE ((53 + GMP_NUMB_BITS - 2) / GMP_NUMB_BITS + 1) -int __gmp_extract_double __GMP_PROTO ((mp_ptr, double)); +__GMP_DECLSPEC int __gmp_extract_double __GMP_PROTO ((mp_ptr, double)); #define mpn_get_d __gmpn_get_d -double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, long)) __GMP_ATTRIBUTE_PURE; +__GMP_DECLSPEC double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, long)) __GMP_ATTRIBUTE_PURE; /* DOUBLE_NAN_INF_ACTION executes code a_nan if x is a NaN, or executes @@ -3348,12 +3516,12 @@ double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, long)) __GMP_ATT #endif -extern int __gmp_junk; -extern const int __gmp_0; -void __gmp_exception __GMP_PROTO ((int)) ATTRIBUTE_NORETURN; -void __gmp_divide_by_zero __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; -void __gmp_sqrt_of_negative __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; -void __gmp_invalid_operation __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; +__GMP_DECLSPEC extern int __gmp_junk; +__GMP_DECLSPEC extern const int __gmp_0; +__GMP_DECLSPEC void __gmp_exception __GMP_PROTO ((int)) ATTRIBUTE_NORETURN; +__GMP_DECLSPEC void __gmp_divide_by_zero __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; +__GMP_DECLSPEC void __gmp_sqrt_of_negative __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; +__GMP_DECLSPEC void __gmp_invalid_operation __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; #define GMP_ERROR(code) __gmp_exception (code) #define DIVIDE_BY_ZERO __gmp_divide_by_zero () #define SQRT_OF_NEGATIVE __gmp_sqrt_of_negative () @@ -3538,7 +3706,7 @@ void __gmp_invalid_operation __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; ASSERT (__b & 1); \ \ if ((GMP_NUMB_BITS % 2) != 0 \ - || BELOW_THRESHOLD (__a_size, MODEXACT_1_ODD_THRESHOLD)) \ + || ABOVE_THRESHOLD (__a_size, BMOD_1_TO_MOD_1_THRESHOLD)) \ { \ (a_rem) = mpn_mod_1 (__a_ptr, __a_size, __b); \ } \ @@ -3551,11 +3719,11 @@ void __gmp_invalid_operation __GMP_PROTO ((void)) ATTRIBUTE_NORETURN; /* Matrix multiplication */ #define mpn_matrix22_mul __MPN(matrix22_mul) -void mpn_matrix22_mul __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_matrix22_mul __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_matrix22_mul_strassen __MPN(matrix22_mul_strassen) -void mpn_matrix22_mul_strassen __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_matrix22_mul_strassen __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr)); #define mpn_matrix22_mul_itch __MPN(matrix22_mul_itch) -mp_size_t mpn_matrix22_mul_itch __GMP_PROTO ((mp_size_t, mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch __GMP_PROTO ((mp_size_t, mp_size_t)); #ifndef MATRIX22_STRASSEN_THRESHOLD #define MATRIX22_STRASSEN_THRESHOLD 30 @@ -3593,13 +3761,13 @@ struct hgcd_matrix1 }; #define mpn_hgcd2 __MPN (hgcd2) -int mpn_hgcd2 __GMP_PROTO ((mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1 *)); +__GMP_DECLSPEC int mpn_hgcd2 __GMP_PROTO ((mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1 *)); #define mpn_hgcd_mul_matrix1_vector __MPN (hgcd_mul_matrix1_vector) -mp_size_t mpn_hgcd_mul_matrix1_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_hgcd_mul_matrix1_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t)); #define mpn_hgcd_mul_matrix1_inverse_vector __MPN (hgcd_mul_matrix1_inverse_vector) -mp_size_t mpn_hgcd_mul_matrix1_inverse_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_hgcd_mul_matrix1_inverse_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t)); struct hgcd_matrix { @@ -3611,43 +3779,43 @@ struct hgcd_matrix #define MPN_HGCD_MATRIX_INIT_ITCH(n) (4 * ((n+1)/2 + 1)) #define mpn_hgcd_matrix_init __MPN (hgcd_matrix_init) -void mpn_hgcd_matrix_init __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr)); +__GMP_DECLSPEC void mpn_hgcd_matrix_init __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr)); #define mpn_hgcd_matrix_mul __MPN (hgcd_matrix_mul) -void mpn_hgcd_matrix_mul __GMP_PROTO ((struct hgcd_matrix *, const struct hgcd_matrix *, mp_ptr)); +__GMP_DECLSPEC void mpn_hgcd_matrix_mul __GMP_PROTO ((struct hgcd_matrix *, const struct hgcd_matrix *, mp_ptr)); #define mpn_hgcd_matrix_adjust __MPN (hgcd_matrix_adjust) -mp_size_t mpn_hgcd_matrix_adjust __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_hgcd_matrix_adjust __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); #define mpn_hgcd_itch __MPN (hgcd_itch) -mp_size_t mpn_hgcd_itch __GMP_PROTO ((mp_size_t)); +__GMP_DECLSPEC mp_size_t mpn_hgcd_itch __GMP_PROTO ((mp_size_t)); #define mpn_hgcd __MPN (hgcd) -mp_size_t mpn_hgcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_hgcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr)); #define MPN_HGCD_LEHMER_ITCH(n) (n) #define mpn_hgcd_lehmer __MPN (hgcd_lehmer) -mp_size_t mpn_hgcd_lehmer __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_hgcd_lehmer __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr)); /* Needs storage for the quotient */ #define MPN_GCD_SUBDIV_STEP_ITCH(n) (n) #define mpn_gcd_subdiv_step __MPN(gcd_subdiv_step) -mp_size_t mpn_gcd_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_gcd_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); #define MPN_GCD_LEHMER_N_ITCH(n) (n) #define mpn_gcd_lehmer_n __MPN(gcd_lehmer_n) -mp_size_t mpn_gcd_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_gcd_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); #define mpn_gcdext_subdiv_step __MPN(gcdext_subdiv_step) -mp_size_t mpn_gcdext_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_gcdext_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr)); #define MPN_GCDEXT_LEHMER_N_ITCH(n) (4*(n) + 3) #define mpn_gcdext_lehmer_n __MPN(gcdext_lehmer_n) -mp_size_t mpn_gcdext_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_gcdext_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr)); /* 4*(an + 1) + 4*(bn + 1) + an */ #define MPN_GCDEXT_LEHMER_ITCH(an, bn) (5*(an) + 4*(bn) + 8) @@ -3680,11 +3848,11 @@ typedef struct powers powers_t; #define mpn_dc_get_str_itch(n) ((n) + GMP_LIMB_BITS) #define mpn_dc_set_str __MPN(dc_set_str) -mp_size_t mpn_dc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, const powers_t *, mp_ptr)); +__GMP_DECLSPEC mp_size_t mpn_dc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, const powers_t *, mp_ptr)); #define mpn_bc_set_str __MPN(bc_set_str) -mp_size_t mpn_bc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, int)); +__GMP_DECLSPEC mp_size_t mpn_bc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, int)); #define mpn_set_str_compute_powtab __MPN(set_str_compute_powtab) -void mpn_set_str_compute_powtab __GMP_PROTO ((powers_t *, mp_ptr, mp_size_t, int)); +__GMP_DECLSPEC void mpn_set_str_compute_powtab __GMP_PROTO ((powers_t *, mp_ptr, mp_size_t, int)); /* __GMPF_BITS_TO_PREC applies a minimum 53 bits, rounds upwards to a whole @@ -3694,9 +3862,9 @@ void mpn_set_str_compute_powtab __GMP_PROTO ((powers_t *, mp_ptr, mp_size_t #define __GMPF_BITS_TO_PREC(n) \ ((mp_size_t) ((__GMP_MAX (53, n) + 2 * GMP_NUMB_BITS - 1) / GMP_NUMB_BITS)) #define __GMPF_PREC_TO_BITS(n) \ - ((unsigned long) (n) * GMP_NUMB_BITS - GMP_NUMB_BITS) + ((mp_bitcnt_t) (n) * GMP_NUMB_BITS - GMP_NUMB_BITS) -extern mp_size_t __gmp_default_fp_limb_precision; +__GMP_DECLSPEC extern mp_size_t __gmp_default_fp_limb_precision; /* Set n to the number of significant digits an mpf of the given _mp_prec @@ -3708,7 +3876,7 @@ extern mp_size_t __gmp_default_fp_limb_precision; further +1 is because the limbs usually won't fall on digit boundaries. FIXME: If base is a power of 2 and the bits per digit divides - BITS_PER_MP_LIMB then the +2 is unnecessary. This happens always for + GMP_LIMB_BITS then the +2 is unnecessary. This happens always for base==2, and in base==16 with the current 32 or 64 bit limb sizes. */ #define MPF_SIGNIFICANT_DIGITS(n, base, prec) \ @@ -3774,10 +3942,10 @@ struct doprnt_params_t { #if _GMP_H_HAVE_VA_LIST -typedef int (*doprnt_format_t) __GMP_PROTO ((void *, const char *, va_list)); -typedef int (*doprnt_memory_t) __GMP_PROTO ((void *, const char *, size_t)); -typedef int (*doprnt_reps_t) __GMP_PROTO ((void *, int, int)); -typedef int (*doprnt_final_t) __GMP_PROTO ((void *)); +__GMP_DECLSPEC typedef int (*doprnt_format_t) __GMP_PROTO ((void *, const char *, va_list)); +__GMP_DECLSPEC typedef int (*doprnt_memory_t) __GMP_PROTO ((void *, const char *, size_t)); +__GMP_DECLSPEC typedef int (*doprnt_reps_t) __GMP_PROTO ((void *, int, int)); +__GMP_DECLSPEC typedef int (*doprnt_final_t) __GMP_PROTO ((void *)); struct doprnt_funs_t { doprnt_format_t format; @@ -3883,7 +4051,7 @@ __GMP_DECLSPEC int __gmp_doprnt_integer __GMP_PROTO ((const struct doprnt_funs_t #define __gmp_doprnt_mpf __gmp_doprnt_mpf2 __GMP_DECLSPEC int __gmp_doprnt_mpf __GMP_PROTO ((const struct doprnt_funs_t *, void *, const struct doprnt_params_t *, const char *, mpf_srcptr)); -int __gmp_replacement_vsnprintf __GMP_PROTO ((char *, size_t, const char *, va_list)); +__GMP_DECLSPEC int __gmp_replacement_vsnprintf __GMP_PROTO ((char *, size_t, const char *, va_list)); #endif /* _GMP_H_HAVE_VA_LIST */ @@ -3902,8 +4070,7 @@ extern const struct gmp_doscan_funs_t __gmp_fscanf_funs; extern const struct gmp_doscan_funs_t __gmp_sscanf_funs; #if _GMP_H_HAVE_VA_LIST -int __gmp_doscan __GMP_PROTO ((const struct gmp_doscan_funs_t *, void *, - const char *, va_list)); +__GMP_DECLSPEC int __gmp_doscan __GMP_PROTO ((const struct gmp_doscan_funs_t *, void *, const char *, va_list)); #endif @@ -3959,7 +4126,7 @@ int __gmp_doscan __GMP_PROTO ((const struct gmp_doscan_funs_t *, void *, difference to the gmp code, since hopefully we arrange calls so there's no great need for the compiler to move things around. */ -#if WANT_FAT_BINARY && HAVE_HOST_CPU_FAMILY_x86 +#if WANT_FAT_BINARY && (HAVE_HOST_CPU_FAMILY_x86 || HAVE_HOST_CPU_FAMILY_x86_64) /* NOTE: The function pointers in this struct are also in CPUVEC_FUNCS_LIST in mpn/x86/x86-defs.m4. Be sure to update that when changing here. */ struct cpuvec_t { @@ -3984,15 +4151,15 @@ struct cpuvec_t { DECL_sub_n ((*sub_n)); DECL_submul_1 ((*submul_1)); int initialized; - mp_size_t mul_karatsuba_threshold; - mp_size_t mul_toom3_threshold; - mp_size_t sqr_karatsuba_threshold; + mp_size_t mul_toom22_threshold; + mp_size_t mul_toom33_threshold; + mp_size_t sqr_toom2_threshold; mp_size_t sqr_toom3_threshold; }; __GMP_DECLSPEC extern struct cpuvec_t __gmpn_cpuvec; #endif /* x86 fat binary */ -void __gmpn_cpuvec_init __GMP_PROTO ((void)); +__GMP_DECLSPEC void __gmpn_cpuvec_init __GMP_PROTO ((void)); /* Get a threshold "field" from __gmpn_cpuvec, running __gmpn_cpuvec_init() if that hasn't yet been done (to establish the right values). */ @@ -4051,201 +4218,409 @@ mpn_zero_p (mp_srcptr ap, mp_size_t n) on #ifdef in the .c files. For some this is not so (the defaults are instead established above), but all are done this way for consistency. */ -#undef MUL_KARATSUBA_THRESHOLD -#define MUL_KARATSUBA_THRESHOLD mul_karatsuba_threshold -extern mp_size_t mul_karatsuba_threshold; +#undef MUL_TOOM22_THRESHOLD +#define MUL_TOOM22_THRESHOLD mul_toom22_threshold +extern mp_size_t mul_toom22_threshold; -#undef MUL_TOOM3_THRESHOLD -#define MUL_TOOM3_THRESHOLD mul_toom3_threshold -extern mp_size_t mul_toom3_threshold; +#undef MUL_TOOM33_THRESHOLD +#define MUL_TOOM33_THRESHOLD mul_toom33_threshold +extern mp_size_t mul_toom33_threshold; -#undef MUL_TOOM44_THRESHOLD -#define MUL_TOOM44_THRESHOLD mul_toom44_threshold -extern mp_size_t mul_toom44_threshold; +#undef MUL_TOOM44_THRESHOLD +#define MUL_TOOM44_THRESHOLD mul_toom44_threshold +extern mp_size_t mul_toom44_threshold; -#undef MUL_FFT_THRESHOLD -#define MUL_FFT_THRESHOLD mul_fft_threshold -extern mp_size_t mul_fft_threshold; +#undef MUL_TOOM6H_THRESHOLD +#define MUL_TOOM6H_THRESHOLD mul_toom6h_threshold +extern mp_size_t mul_toom6h_threshold; + +#undef MUL_TOOM8H_THRESHOLD +#define MUL_TOOM8H_THRESHOLD mul_toom8h_threshold +extern mp_size_t mul_toom8h_threshold; + +#undef MUL_TOOM32_TO_TOOM43_THRESHOLD +#define MUL_TOOM32_TO_TOOM43_THRESHOLD mul_toom32_to_toom43_threshold +extern mp_size_t mul_toom32_to_toom43_threshold; -#undef MUL_FFT_MODF_THRESHOLD -#define MUL_FFT_MODF_THRESHOLD mul_fft_modf_threshold -extern mp_size_t mul_fft_modf_threshold; +#undef MUL_TOOM32_TO_TOOM53_THRESHOLD +#define MUL_TOOM32_TO_TOOM53_THRESHOLD mul_toom32_to_toom53_threshold +extern mp_size_t mul_toom32_to_toom53_threshold; -#undef MUL_FFT_TABLE -#define MUL_FFT_TABLE { 0 } +#undef MUL_TOOM42_TO_TOOM53_THRESHOLD +#define MUL_TOOM42_TO_TOOM53_THRESHOLD mul_toom42_to_toom53_threshold +extern mp_size_t mul_toom42_to_toom53_threshold; + +#undef MUL_TOOM42_TO_TOOM63_THRESHOLD +#define MUL_TOOM42_TO_TOOM63_THRESHOLD mul_toom42_to_toom63_threshold +extern mp_size_t mul_toom42_to_toom63_threshold; + +#undef MUL_FFT_THRESHOLD +#define MUL_FFT_THRESHOLD mul_fft_threshold +extern mp_size_t mul_fft_threshold; + +#undef MUL_FFT_MODF_THRESHOLD +#define MUL_FFT_MODF_THRESHOLD mul_fft_modf_threshold +extern mp_size_t mul_fft_modf_threshold; + +#undef MUL_FFT_TABLE +#define MUL_FFT_TABLE { 0 } + +#undef MUL_FFT_TABLE3 +#define MUL_FFT_TABLE3 { {0,0} } /* A native mpn_sqr_basecase is not tuned and SQR_BASECASE_THRESHOLD should remain as zero (always use it). */ #if ! HAVE_NATIVE_mpn_sqr_basecase -#undef SQR_BASECASE_THRESHOLD -#define SQR_BASECASE_THRESHOLD sqr_basecase_threshold -extern mp_size_t sqr_basecase_threshold; +#undef SQR_BASECASE_THRESHOLD +#define SQR_BASECASE_THRESHOLD sqr_basecase_threshold +extern mp_size_t sqr_basecase_threshold; #endif #if TUNE_PROGRAM_BUILD_SQR -#undef SQR_KARATSUBA_THRESHOLD -#define SQR_KARATSUBA_THRESHOLD SQR_KARATSUBA_MAX_GENERIC +#undef SQR_TOOM2_THRESHOLD +#define SQR_TOOM2_THRESHOLD SQR_TOOM2_MAX_GENERIC #else -#undef SQR_KARATSUBA_THRESHOLD -#define SQR_KARATSUBA_THRESHOLD sqr_karatsuba_threshold -extern mp_size_t sqr_karatsuba_threshold; +#undef SQR_TOOM2_THRESHOLD +#define SQR_TOOM2_THRESHOLD sqr_toom2_threshold +extern mp_size_t sqr_toom2_threshold; #endif -#undef SQR_TOOM3_THRESHOLD -#define SQR_TOOM3_THRESHOLD sqr_toom3_threshold -extern mp_size_t sqr_toom3_threshold; +#undef SQR_TOOM3_THRESHOLD +#define SQR_TOOM3_THRESHOLD sqr_toom3_threshold +extern mp_size_t sqr_toom3_threshold; -#undef SQR_TOOM4_THRESHOLD -#define SQR_TOOM4_THRESHOLD sqr_toom4_threshold -extern mp_size_t sqr_toom4_threshold; +#undef SQR_TOOM4_THRESHOLD +#define SQR_TOOM4_THRESHOLD sqr_toom4_threshold +extern mp_size_t sqr_toom4_threshold; -#undef SQR_FFT_THRESHOLD -#define SQR_FFT_THRESHOLD sqr_fft_threshold -extern mp_size_t sqr_fft_threshold; +#undef SQR_TOOM6_THRESHOLD +#define SQR_TOOM6_THRESHOLD sqr_toom6_threshold +extern mp_size_t sqr_toom6_threshold; -#undef SQR_FFT_MODF_THRESHOLD -#define SQR_FFT_MODF_THRESHOLD sqr_fft_modf_threshold -extern mp_size_t sqr_fft_modf_threshold; +#undef SQR_TOOM8_THRESHOLD +#define SQR_TOOM8_THRESHOLD sqr_toom8_threshold +extern mp_size_t sqr_toom8_threshold; -#undef SQR_FFT_TABLE -#define SQR_FFT_TABLE { 0 } +#undef SQR_FFT_THRESHOLD +#define SQR_FFT_THRESHOLD sqr_fft_threshold +extern mp_size_t sqr_fft_threshold; -#undef MULLOW_BASECASE_THRESHOLD -#define MULLOW_BASECASE_THRESHOLD mullow_basecase_threshold -extern mp_size_t mullow_basecase_threshold; +#undef SQR_FFT_MODF_THRESHOLD +#define SQR_FFT_MODF_THRESHOLD sqr_fft_modf_threshold +extern mp_size_t sqr_fft_modf_threshold; -#undef MULLOW_DC_THRESHOLD -#define MULLOW_DC_THRESHOLD mullow_dc_threshold -extern mp_size_t mullow_dc_threshold; +#undef SQR_FFT_TABLE +#define SQR_FFT_TABLE { 0 } -#undef MULLOW_MUL_N_THRESHOLD -#define MULLOW_MUL_N_THRESHOLD mullow_mul_n_threshold -extern mp_size_t mullow_mul_n_threshold; +#undef SQR_FFT_TABLE3 +#define SQR_FFT_TABLE3 { {0,0} } +#undef MULLO_BASECASE_THRESHOLD +#define MULLO_BASECASE_THRESHOLD mullo_basecase_threshold +extern mp_size_t mullo_basecase_threshold; -#if ! UDIV_PREINV_ALWAYS -#undef DIV_SB_PREINV_THRESHOLD -#define DIV_SB_PREINV_THRESHOLD div_sb_preinv_threshold -extern mp_size_t div_sb_preinv_threshold; -#endif +#undef MULLO_DC_THRESHOLD +#define MULLO_DC_THRESHOLD mullo_dc_threshold +extern mp_size_t mullo_dc_threshold; -#undef DIV_DC_THRESHOLD -#define DIV_DC_THRESHOLD div_dc_threshold -extern mp_size_t div_dc_threshold; +#undef MULLO_MUL_N_THRESHOLD +#define MULLO_MUL_N_THRESHOLD mullo_mul_n_threshold +extern mp_size_t mullo_mul_n_threshold; -#undef POWM_THRESHOLD -#define POWM_THRESHOLD powm_threshold -extern mp_size_t powm_threshold; +#undef DC_DIV_QR_THRESHOLD +#define DC_DIV_QR_THRESHOLD dc_div_qr_threshold +extern mp_size_t dc_div_qr_threshold; -#undef MATRIX22_STRASSEN_THRESHOLD -#define MATRIX22_STRASSEN_THRESHOLD matrix22_strassen_threshold -extern mp_size_t matrix22_strassen_threshold; +#undef DC_DIVAPPR_Q_THRESHOLD +#define DC_DIVAPPR_Q_THRESHOLD dc_divappr_q_threshold +extern mp_size_t dc_divappr_q_threshold; -#undef HGCD_THRESHOLD -#define HGCD_THRESHOLD hgcd_threshold -extern mp_size_t hgcd_threshold; +#undef DC_BDIV_Q_THRESHOLD +#define DC_BDIV_Q_THRESHOLD dc_bdiv_q_threshold +extern mp_size_t dc_bdiv_q_threshold; -#undef GCD_ACCEL_THRESHOLD -#define GCD_ACCEL_THRESHOLD gcd_accel_threshold -extern mp_size_t gcd_accel_threshold; +#undef DC_BDIV_QR_THRESHOLD +#define DC_BDIV_QR_THRESHOLD dc_bdiv_qr_threshold +extern mp_size_t dc_bdiv_qr_threshold; -#undef GCD_DC_THRESHOLD -#define GCD_DC_THRESHOLD gcd_dc_threshold -extern mp_size_t gcd_dc_threshold; +#undef MU_DIV_QR_THRESHOLD +#define MU_DIV_QR_THRESHOLD mu_div_qr_threshold +extern mp_size_t mu_div_qr_threshold; -#undef GCDEXT_DC_THRESHOLD -#define GCDEXT_DC_THRESHOLD gcdext_dc_threshold -extern mp_size_t gcdext_dc_threshold; +#undef MU_DIVAPPR_Q_THRESHOLD +#define MU_DIVAPPR_Q_THRESHOLD mu_divappr_q_threshold +extern mp_size_t mu_divappr_q_threshold; -#undef DIVREM_1_NORM_THRESHOLD -#define DIVREM_1_NORM_THRESHOLD divrem_1_norm_threshold -extern mp_size_t divrem_1_norm_threshold; +#undef MUPI_DIV_QR_THRESHOLD +#define MUPI_DIV_QR_THRESHOLD mupi_div_qr_threshold +extern mp_size_t mupi_div_qr_threshold; -#undef DIVREM_1_UNNORM_THRESHOLD -#define DIVREM_1_UNNORM_THRESHOLD divrem_1_unnorm_threshold -extern mp_size_t divrem_1_unnorm_threshold; +#undef MU_BDIV_QR_THRESHOLD +#define MU_BDIV_QR_THRESHOLD mu_bdiv_qr_threshold +extern mp_size_t mu_bdiv_qr_threshold; -#undef MOD_1_NORM_THRESHOLD -#define MOD_1_NORM_THRESHOLD mod_1_norm_threshold -extern mp_size_t mod_1_norm_threshold; +#undef MU_BDIV_Q_THRESHOLD +#define MU_BDIV_Q_THRESHOLD mu_bdiv_q_threshold +extern mp_size_t mu_bdiv_q_threshold; -#undef MOD_1_UNNORM_THRESHOLD -#define MOD_1_UNNORM_THRESHOLD mod_1_unnorm_threshold -extern mp_size_t mod_1_unnorm_threshold; +#undef INV_MULMOD_BNM1_THRESHOLD +#define INV_MULMOD_BNM1_THRESHOLD inv_mulmod_bnm1_threshold +extern mp_size_t inv_mulmod_bnm1_threshold; + +#undef INV_NEWTON_THRESHOLD +#define INV_NEWTON_THRESHOLD inv_newton_threshold +extern mp_size_t inv_newton_threshold; + +#undef INV_APPR_THRESHOLD +#define INV_APPR_THRESHOLD inv_appr_threshold +extern mp_size_t inv_appr_threshold; + +#undef BINV_NEWTON_THRESHOLD +#define BINV_NEWTON_THRESHOLD binv_newton_threshold +extern mp_size_t binv_newton_threshold; + +#undef REDC_1_TO_REDC_2_THRESHOLD +#define REDC_1_TO_REDC_2_THRESHOLD redc_1_to_redc_2_threshold +extern mp_size_t redc_1_to_redc_2_threshold; + +#undef REDC_2_TO_REDC_N_THRESHOLD +#define REDC_2_TO_REDC_N_THRESHOLD redc_2_to_redc_n_threshold +extern mp_size_t redc_2_to_redc_n_threshold; + +#undef REDC_1_TO_REDC_N_THRESHOLD +#define REDC_1_TO_REDC_N_THRESHOLD redc_1_to_redc_n_threshold +extern mp_size_t redc_1_to_redc_n_threshold; + +#undef MATRIX22_STRASSEN_THRESHOLD +#define MATRIX22_STRASSEN_THRESHOLD matrix22_strassen_threshold +extern mp_size_t matrix22_strassen_threshold; -#undef MOD_1_1_THRESHOLD -#define MOD_1_1_THRESHOLD mod_1_1_threshold -extern mp_size_t mod_1_1_threshold; +#undef HGCD_THRESHOLD +#define HGCD_THRESHOLD hgcd_threshold +extern mp_size_t hgcd_threshold; -#undef MOD_1_2_THRESHOLD -#define MOD_1_2_THRESHOLD mod_1_2_threshold -extern mp_size_t mod_1_2_threshold; +#undef GCD_DC_THRESHOLD +#define GCD_DC_THRESHOLD gcd_dc_threshold +extern mp_size_t gcd_dc_threshold; -#undef MOD_1_3_THRESHOLD -#define MOD_1_3_THRESHOLD mod_1_3_threshold -extern mp_size_t mod_1_3_threshold; +#undef GCDEXT_DC_THRESHOLD +#define GCDEXT_DC_THRESHOLD gcdext_dc_threshold +extern mp_size_t gcdext_dc_threshold; -#undef MOD_1_4_THRESHOLD -#define MOD_1_4_THRESHOLD mod_1_4_threshold -extern mp_size_t mod_1_4_threshold; +#undef DIVREM_1_NORM_THRESHOLD +#define DIVREM_1_NORM_THRESHOLD divrem_1_norm_threshold +extern mp_size_t divrem_1_norm_threshold; + +#undef DIVREM_1_UNNORM_THRESHOLD +#define DIVREM_1_UNNORM_THRESHOLD divrem_1_unnorm_threshold +extern mp_size_t divrem_1_unnorm_threshold; + +#undef MOD_1_NORM_THRESHOLD +#define MOD_1_NORM_THRESHOLD mod_1_norm_threshold +extern mp_size_t mod_1_norm_threshold; + +#undef MOD_1_UNNORM_THRESHOLD +#define MOD_1_UNNORM_THRESHOLD mod_1_unnorm_threshold +extern mp_size_t mod_1_unnorm_threshold; + +#undef MOD_1N_TO_MOD_1_1_THRESHOLD +#define MOD_1N_TO_MOD_1_1_THRESHOLD mod_1n_to_mod_1_1_threshold +extern mp_size_t mod_1n_to_mod_1_1_threshold; + +#undef MOD_1U_TO_MOD_1_1_THRESHOLD +#define MOD_1U_TO_MOD_1_1_THRESHOLD mod_1u_to_mod_1_1_threshold +extern mp_size_t mod_1u_to_mod_1_1_threshold; + +#undef MOD_1_1_TO_MOD_1_2_THRESHOLD +#define MOD_1_1_TO_MOD_1_2_THRESHOLD mod_1_1_to_mod_1_2_threshold +extern mp_size_t mod_1_1_to_mod_1_2_threshold; + +#undef MOD_1_2_TO_MOD_1_4_THRESHOLD +#define MOD_1_2_TO_MOD_1_4_THRESHOLD mod_1_2_to_mod_1_4_threshold +extern mp_size_t mod_1_2_to_mod_1_4_threshold; + +#undef PREINV_MOD_1_TO_MOD_1_THRESHOLD +#define PREINV_MOD_1_TO_MOD_1_THRESHOLD preinv_mod_1_to_mod_1_threshold +extern mp_size_t preinv_mod_1_to_mod_1_threshold; #if ! UDIV_PREINV_ALWAYS -#undef DIVREM_2_THRESHOLD -#define DIVREM_2_THRESHOLD divrem_2_threshold -extern mp_size_t divrem_2_threshold; +#undef DIVREM_2_THRESHOLD +#define DIVREM_2_THRESHOLD divrem_2_threshold +extern mp_size_t divrem_2_threshold; #endif -#undef GET_STR_DC_THRESHOLD -#define GET_STR_DC_THRESHOLD get_str_dc_threshold -extern mp_size_t get_str_dc_threshold; +#undef MULMOD_BNM1_THRESHOLD +#define MULMOD_BNM1_THRESHOLD mulmod_bnm1_threshold +extern mp_size_t mulmod_bnm1_threshold; + +#undef SQRMOD_BNM1_THRESHOLD +#define SQRMOD_BNM1_THRESHOLD sqrmod_bnm1_threshold +extern mp_size_t sqrmod_bnm1_threshold; -#undef GET_STR_PRECOMPUTE_THRESHOLD -#define GET_STR_PRECOMPUTE_THRESHOLD get_str_precompute_threshold -extern mp_size_t get_str_precompute_threshold; +#undef GET_STR_DC_THRESHOLD +#define GET_STR_DC_THRESHOLD get_str_dc_threshold +extern mp_size_t get_str_dc_threshold; -#undef SET_STR_DC_THRESHOLD -#define SET_STR_DC_THRESHOLD set_str_dc_threshold -extern mp_size_t set_str_dc_threshold; +#undef GET_STR_PRECOMPUTE_THRESHOLD +#define GET_STR_PRECOMPUTE_THRESHOLD get_str_precompute_threshold +extern mp_size_t get_str_precompute_threshold; -#undef SET_STR_PRECOMPUTE_THRESHOLD -#define SET_STR_PRECOMPUTE_THRESHOLD set_str_precompute_threshold -extern mp_size_t set_str_precompute_threshold; +#undef SET_STR_DC_THRESHOLD +#define SET_STR_DC_THRESHOLD set_str_dc_threshold +extern mp_size_t set_str_dc_threshold; -#undef SET_STR_THRESHOLD -#define SET_STR_THRESHOLD set_str_threshold -extern mp_size_t SET_STR_THRESHOLD; +#undef SET_STR_PRECOMPUTE_THRESHOLD +#define SET_STR_PRECOMPUTE_THRESHOLD set_str_precompute_threshold +extern mp_size_t set_str_precompute_threshold; #undef FFT_TABLE_ATTRS #define FFT_TABLE_ATTRS extern mp_size_t mpn_fft_table[2][MPN_FFT_TABLE_SIZE]; +#define FFT_TABLE3_SIZE 2000 /* generous space for tuning */ +extern struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE]; /* Sizes the tune program tests up to, used in a couple of recompilations. */ -#undef MUL_KARATSUBA_THRESHOLD_LIMIT -#undef MUL_TOOM3_THRESHOLD_LIMIT -#undef MULLOW_BASECASE_THRESHOLD_LIMIT +#undef MUL_TOOM22_THRESHOLD_LIMIT +#undef MUL_TOOM33_THRESHOLD_LIMIT +#undef MULLO_BASECASE_THRESHOLD_LIMIT #undef SQR_TOOM3_THRESHOLD_LIMIT -#define SQR_KARATSUBA_MAX_GENERIC 200 -#define MUL_KARATSUBA_THRESHOLD_LIMIT 700 -#define MUL_TOOM3_THRESHOLD_LIMIT 700 +#define SQR_TOOM2_MAX_GENERIC 200 +#define MUL_TOOM22_THRESHOLD_LIMIT 700 +#define MUL_TOOM33_THRESHOLD_LIMIT 700 #define SQR_TOOM3_THRESHOLD_LIMIT 400 #define MUL_TOOM44_THRESHOLD_LIMIT 1000 #define SQR_TOOM4_THRESHOLD_LIMIT 1000 -#define MULLOW_BASECASE_THRESHOLD_LIMIT 200 +#define MUL_TOOM6H_THRESHOLD_LIMIT 1100 +#define SQR_TOOM6_THRESHOLD_LIMIT 1100 +#define MUL_TOOM8H_THRESHOLD_LIMIT 1200 +#define SQR_TOOM8_THRESHOLD_LIMIT 1200 +#define MULLO_BASECASE_THRESHOLD_LIMIT 200 #define GET_STR_THRESHOLD_LIMIT 150 -/* "thresh" will normally be a variable when tuning, so use the cached - result. This helps mpn_sb_divrem_mn for instance. */ -#undef CACHED_ABOVE_THRESHOLD -#define CACHED_ABOVE_THRESHOLD(cache, thresh) (cache) -#undef CACHED_BELOW_THRESHOLD -#define CACHED_BELOW_THRESHOLD(cache, thresh) (cache) - #endif /* TUNE_PROGRAM_BUILD */ #if defined (__cplusplus) } #endif +/* FIXME: Make these itch functions less conservative. Also consider making + them dependent on just 'an', and compute the allocation directly from 'an' + instead of via n. */ + +/* toom22/toom2: Scratch need is 2*(an + k), k is the recursion depth. + k is ths smallest k such that + ceil(an/2^k) < MUL_TOOM22_THRESHOLD. + which implies that + k = bitsize of floor ((an-1)/(MUL_TOOM22_THRESHOLD-1)) + = 1 + floor (log_2 (floor ((an-1)/(MUL_TOOM22_THRESHOLD-1)))) +*/ +#define mpn_toom22_mul_itch(an, bn) \ + (2 * ((an) + GMP_NUMB_BITS)) +#define mpn_toom2_sqr_itch(an) \ + (2 * ((an) + GMP_NUMB_BITS)) + +/* Can probably be trimmed to 2 an + O(log an). */ +#define mpn_toom33_mul_itch(an, bn) \ + ((5 * (an) >> 1) + GMP_NUMB_BITS) +#define mpn_toom3_sqr_itch(an) \ + ((5 * (an) >> 1) + GMP_NUMB_BITS) + +#define mpn_toom44_mul_itch(an, bn) \ + (3 * (an) + GMP_NUMB_BITS) +#define mpn_toom4_sqr_itch(an) \ + (3 * (an) + GMP_NUMB_BITS) + +#define mpn_toom6_sqr_itch(n) \ +( ((n) - SQR_TOOM6_THRESHOLD)*2 + \ + MAX(SQR_TOOM6_THRESHOLD*2 + GMP_NUMB_BITS*6, \ + mpn_toom4_sqr_itch(SQR_TOOM6_THRESHOLD)) ) + +#define mpn_toom6_mul_n_itch(n) \ +( ((n) - MUL_TOOM6H_THRESHOLD)*2 + \ + MAX(MUL_TOOM6H_THRESHOLD*2 + GMP_NUMB_BITS*6, \ + mpn_toom44_mul_itch(MUL_TOOM6H_THRESHOLD,MUL_TOOM6H_THRESHOLD)) ) + +static inline mp_size_t +mpn_toom6h_mul_itch (mp_size_t an, mp_size_t bn) { + mp_size_t estimatedN; + estimatedN = (an + bn) / (size_t) 10 + 1; + return mpn_toom6_mul_n_itch (estimatedN * 6); +} + +#define mpn_toom8_sqr_itch(n) \ +( (((n)*15)>>3) - ((SQR_TOOM8_THRESHOLD*15)>>3) + \ + MAX(((SQR_TOOM8_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6, \ + mpn_toom6_sqr_itch(SQR_TOOM8_THRESHOLD)) ) + +#define mpn_toom8_mul_n_itch(n) \ +( (((n)*15)>>3) - ((MUL_TOOM8H_THRESHOLD*15)>>3) + \ + MAX(((MUL_TOOM8H_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6, \ + mpn_toom6_mul_n_itch(MUL_TOOM8H_THRESHOLD)) ) + +static inline mp_size_t +mpn_toom8h_mul_itch (mp_size_t an, mp_size_t bn) { + mp_size_t estimatedN; + estimatedN = (an + bn) / (size_t) 14 + 1; + return mpn_toom8_mul_n_itch (estimatedN * 8); +} + +static inline mp_size_t +mpn_toom32_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1); + mp_size_t itch = 2 * n + 1; + + return itch; +} + +static inline mp_size_t +mpn_toom42_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = an >= 2 * bn ? (an + 3) >> 2 : (bn + 1) >> 1; + return 6 * n + 3; +} + +static inline mp_size_t +mpn_toom43_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (3 * an >= 4 * bn ? (an - 1) >> 2 : (bn - 1) / (size_t) 3); + + return 6*n + 4; +} + +static inline mp_size_t +mpn_toom52_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (2 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) >> 1); + return 6*n + 4; +} + +static inline mp_size_t +mpn_toom53_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (3 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 3); + return 10 * n + 10; +} + +static inline mp_size_t +mpn_toom62_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (an >= 3 * bn ? (an - 1) / (size_t) 6 : (bn - 1) >> 1); + return 10 * n + 10; +} + +static inline mp_size_t +mpn_toom63_mul_itch (mp_size_t an, mp_size_t bn) +{ + mp_size_t n = 1 + (an >= 2 * bn ? (an - 1) / (size_t) 6 : (bn - 1) / (size_t) 3); + return 9 * n + 3; +} + +#if 0 +#define mpn_fft_mul mpn_mul_fft_full +#else +#define mpn_fft_mul mpn_nussbaumer_mul +#endif #ifdef __cplusplus diff --git a/contrib/gmp/longlong.h b/contrib/gmp/longlong.h index 1354d7df11..130dc85129 100644 --- a/contrib/gmp/longlong.h +++ b/contrib/gmp/longlong.h @@ -19,18 +19,25 @@ along with this file. If not, see http://www.gnu.org/licenses/. */ /* You have to define the following before including this file: UWtype -- An unsigned type, default type for operations (typically a "word") - UHWtype -- An unsigned type, at least half the size of UWtype. + UHWtype -- An unsigned type, at least half the size of UWtype UDWtype -- An unsigned type, at least twice as large a UWtype W_TYPE_SIZE -- size in bits of UWtype - SItype, USItype -- Signed and unsigned 32 bit types. - DItype, UDItype -- Signed and unsigned 64 bit types. + SItype, USItype -- Signed and unsigned 32 bit types + DItype, UDItype -- Signed and unsigned 64 bit types On a 32 bit machine UWtype should typically be USItype; on a 64 bit machine, UWtype should typically be UDItype. - CAUTION! Using this file outside of GMP is not safe. You need to include - gmp.h and gmp-impl.h, or certain things might not work as expected. + Optionally, define: + + LONGLONG_STANDALONE -- Avoid code that needs machine-dependent support files + NO_ASM -- Disable inline asm + + + CAUTION! Using this version of longlong.h outside of GMP is not safe. You + need to include gmp.h and gmp-impl.h, or certain things might not work as + expected. */ #define __BITS4 (W_TYPE_SIZE / 4) @@ -506,6 +513,12 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype)); #define UDIV_TIME 200 #endif /* LONGLONG_STANDALONE */ #endif +#if defined (__ARM_ARCH_5__) +/* This actually requires arm 5 */ +#define count_leading_zeros(count, x) \ + __asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x)) +#define COUNT_LEADING_ZEROS_0 32 +#endif #endif /* __arm__ */ #if defined (__clipper__) && W_TYPE_SIZE == 32 diff --git a/contrib/gmp/mp-h.in b/contrib/gmp/mp-h.in deleted file mode 100644 index 92a6ec4bd9..0000000000 --- a/contrib/gmp/mp-h.in +++ /dev/null @@ -1,163 +0,0 @@ -/* mp-h.in -- Definitions for the GNU multiple precision library -*-mode:c-*- - BSD mp compatible functions. - -Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004 Free Software -Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#ifndef __MP_H__ - - -/* The following (everything under ifndef __GNU_MP__) must be identical in - gmp.h and mp.h to allow both to be included in an application or during - the library build. Use the t-gmp-mp-h.pl script to check. */ -#ifndef __GNU_MP__ -#define __GNU_MP__ 4 - -#define __need_size_t /* tell gcc stddef.h we only want size_t */ -#if defined (__cplusplus) -#include /* for size_t */ -#else -#include /* for size_t */ -#endif -#undef __need_size_t - -/* The following instantiated by configure, for internal use only */ -#if ! defined (__GMP_WITHIN_CONFIGURE) -@DEFN_LONG_LONG_LIMB@ -#define __GMP_LIBGMP_DLL @LIBGMP_DLL@ -#endif - -#if defined (__STDC__) \ - || defined (__cplusplus) \ - || defined (_AIX) \ - || defined (__DECC) \ - || (defined (__mips) && defined (_SYSTYPE_SVR4)) \ - || defined (_MSC_VER) \ - || defined (_WIN32) -#define __GMP_HAVE_CONST 1 -#define __GMP_HAVE_PROTOTYPES 1 -#define __GMP_HAVE_TOKEN_PASTE 1 -#else -#define __GMP_HAVE_CONST 0 -#define __GMP_HAVE_PROTOTYPES 0 -#define __GMP_HAVE_TOKEN_PASTE 0 -#endif - - -#if __GMP_HAVE_CONST -#define __gmp_const const -#define __gmp_signed signed -#else -#define __gmp_const -#define __gmp_signed -#endif - -#if defined (__GNUC__) -#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__) -#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__) -#endif -#if defined (_MSC_VER) || defined (__BORLANDC__) -#define __GMP_DECLSPEC_EXPORT __declspec(dllexport) -#define __GMP_DECLSPEC_IMPORT __declspec(dllimport) -#endif -#ifdef __WATCOMC__ -#define __GMP_DECLSPEC_EXPORT __export -#define __GMP_DECLSPEC_IMPORT __import -#endif -#ifdef __IBMC__ -#define __GMP_DECLSPEC_EXPORT _Export -#define __GMP_DECLSPEC_IMPORT _Import -#endif - -#if __GMP_LIBGMP_DLL -#if __GMP_WITHIN_GMP -#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT -#else -#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT -#endif -#else -#define __GMP_DECLSPEC -#endif - -#ifdef __GMP_SHORT_LIMB -typedef unsigned int mp_limb_t; -typedef int mp_limb_signed_t; -#else -#ifdef _LONG_LONG_LIMB -typedef unsigned long long int mp_limb_t; -typedef long long int mp_limb_signed_t; -#else -typedef unsigned long int mp_limb_t; -typedef long int mp_limb_signed_t; -#endif -#endif - -typedef struct -{ - int _mp_alloc; /* Number of *limbs* allocated and pointed - to by the _mp_d field. */ - int _mp_size; /* abs(_mp_size) is the number of limbs the - last field points to. If _mp_size is - negative this is a negative number. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpz_struct; - -#endif /* __GNU_MP__ */ - -/* User-visible types. */ -typedef __mpz_struct MINT; - - -#if __GMP_HAVE_PROTOTYPES -#define __GMP_PROTO(x) x -#else -#define __GMP_PROTO(x) () -#endif - -#if defined (__cplusplus) -extern "C" { -#endif - -#define mp_set_memory_functions __gmp_set_memory_functions -__GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t), - void *(*) (void *, size_t, size_t), - void (*) (void *, size_t))); -__GMP_DECLSPEC MINT *itom __GMP_PROTO ((signed short int)); -__GMP_DECLSPEC MINT *xtom __GMP_PROTO ((const char *)); -__GMP_DECLSPEC void move __GMP_PROTO ((const MINT *, MINT *)); -__GMP_DECLSPEC void madd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); -__GMP_DECLSPEC void msub __GMP_PROTO ((const MINT *, const MINT *, MINT *)); -__GMP_DECLSPEC void mult __GMP_PROTO ((const MINT *, const MINT *, MINT *)); -__GMP_DECLSPEC void mdiv __GMP_PROTO ((const MINT *, const MINT *, MINT *, MINT *)); -__GMP_DECLSPEC void sdiv __GMP_PROTO ((const MINT *, signed short int, MINT *, signed short int *)); -__GMP_DECLSPEC void msqrt __GMP_PROTO ((const MINT *, MINT *, MINT *)); -__GMP_DECLSPEC void pow __GMP_PROTO ((const MINT *, const MINT *, const MINT *, MINT *)); -__GMP_DECLSPEC void rpow __GMP_PROTO ((const MINT *, signed short int, MINT *)); -__GMP_DECLSPEC void gcd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); -__GMP_DECLSPEC int mcmp __GMP_PROTO ((const MINT *, const MINT *)); -__GMP_DECLSPEC void min __GMP_PROTO ((MINT *)); -__GMP_DECLSPEC void mout __GMP_PROTO ((const MINT *)); -__GMP_DECLSPEC char *mtox __GMP_PROTO ((const MINT *)); -__GMP_DECLSPEC void mfree __GMP_PROTO ((MINT *)); - -#if defined (__cplusplus) -} -#endif - -#define __MP_H__ -#endif /* __MP_H__ */ diff --git a/contrib/gmp/mp_bpl.c b/contrib/gmp/mp_bpl.c index 1e05f34661..1fc1ca9602 100644 --- a/contrib/gmp/mp_bpl.c +++ b/contrib/gmp/mp_bpl.c @@ -19,6 +19,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -const int mp_bits_per_limb = BITS_PER_MP_LIMB; +const int mp_bits_per_limb = GMP_LIMB_BITS; const int __gmp_0 = 0; int __gmp_junk; diff --git a/contrib/gmp/mpf/Makefile.am b/contrib/gmp/mpf/Makefile.am deleted file mode 100644 index fcaca07292..0000000000 --- a/contrib/gmp/mpf/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, -# Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) - -noinst_LTLIBRARIES = libmpf.la -libmpf_la_SOURCES = \ - init.c init2.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \ - set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c get_str.c \ - dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \ - add.c add_ui.c sub.c sub_ui.c ui_sub.c mul.c mul_ui.c div.c div_ui.c \ - cmp.c cmp_d.c cmp_si.c cmp_ui.c mul_2exp.c div_2exp.c abs.c neg.c get_d.c \ - get_d_2exp.c set_dfl_prec.c set_prc.c set_prc_raw.c get_dfl_prec.c get_prc.c \ - ui_div.c sqrt_ui.c \ - pow_ui.c urandomb.c swap.c get_si.c get_ui.c int_p.c \ - ceilfloor.c trunc.c \ - fits_sint.c fits_slong.c fits_sshort.c \ - fits_uint.c fits_ulong.c fits_ushort.c \ - fits_s.h fits_u.h diff --git a/contrib/gmp/mpf/Makefile.in b/contrib/gmp/mpf/Makefile.in deleted file mode 100644 index d277445ae2..0000000000 --- a/contrib/gmp/mpf/Makefile.in +++ /dev/null @@ -1,660 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, -# Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(libmpf_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -subdir = mpf -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libmpf_la_LIBADD = -am_libmpf_la_OBJECTS = init$U.lo init2$U.lo set$U.lo set_ui$U.lo \ - set_si$U.lo set_str$U.lo set_d$U.lo set_z$U.lo set_q$U.lo \ - iset$U.lo iset_ui$U.lo iset_si$U.lo iset_str$U.lo iset_d$U.lo \ - clear$U.lo get_str$U.lo dump$U.lo size$U.lo eq$U.lo \ - reldiff$U.lo sqrt$U.lo random2$U.lo inp_str$U.lo out_str$U.lo \ - add$U.lo add_ui$U.lo sub$U.lo sub_ui$U.lo ui_sub$U.lo mul$U.lo \ - mul_ui$U.lo div$U.lo div_ui$U.lo cmp$U.lo cmp_d$U.lo \ - cmp_si$U.lo cmp_ui$U.lo mul_2exp$U.lo div_2exp$U.lo abs$U.lo \ - neg$U.lo get_d$U.lo get_d_2exp$U.lo set_dfl_prec$U.lo \ - set_prc$U.lo set_prc_raw$U.lo get_dfl_prec$U.lo get_prc$U.lo \ - ui_div$U.lo sqrt_ui$U.lo pow_ui$U.lo urandomb$U.lo swap$U.lo \ - get_si$U.lo get_ui$U.lo int_p$U.lo ceilfloor$U.lo trunc$U.lo \ - fits_sint$U.lo fits_slong$U.lo fits_sshort$U.lo fits_uint$U.lo \ - fits_ulong$U.lo fits_ushort$U.lo -libmpf_la_OBJECTS = $(am_libmpf_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmpf_la_SOURCES) -DIST_SOURCES = $(libmpf_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) -noinst_LTLIBRARIES = libmpf.la -libmpf_la_SOURCES = \ - init.c init2.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \ - set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c get_str.c \ - dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \ - add.c add_ui.c sub.c sub_ui.c ui_sub.c mul.c mul_ui.c div.c div_ui.c \ - cmp.c cmp_d.c cmp_si.c cmp_ui.c mul_2exp.c div_2exp.c abs.c neg.c get_d.c \ - get_d_2exp.c set_dfl_prec.c set_prc.c set_prc_raw.c get_dfl_prec.c get_prc.c \ - ui_div.c sqrt_ui.c \ - pow_ui.c urandomb.c swap.c get_si.c get_ui.c int_p.c \ - ceilfloor.c trunc.c \ - fits_sint.c fits_slong.c fits_sshort.c \ - fits_uint.c fits_ulong.c fits_ushort.c \ - fits_s.h fits_u.h - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmpf.la: $(libmpf_la_OBJECTS) $(libmpf_la_DEPENDENCIES) - $(LINK) $(libmpf_la_LDFLAGS) $(libmpf_la_OBJECTS) $(libmpf_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -abs_.c: abs.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_.c: add.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_ui_.c: add_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_ui.c; then echo $(srcdir)/add_ui.c; else echo add_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ceilfloor_.c: ceilfloor.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ceilfloor.c; then echo $(srcdir)/ceilfloor.c; else echo ceilfloor.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -clear_.c: clear.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_.c: cmp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_d_.c: cmp_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_d.c; then echo $(srcdir)/cmp_d.c; else echo cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_si_.c: cmp_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_ui_.c: cmp_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -div_.c: div.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div.c; then echo $(srcdir)/div.c; else echo div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -div_2exp_.c: div_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div_2exp.c; then echo $(srcdir)/div_2exp.c; else echo div_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -div_ui_.c: div_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div_ui.c; then echo $(srcdir)/div_ui.c; else echo div_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dump_.c: dump.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -eq_.c: eq.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eq.c; then echo $(srcdir)/eq.c; else echo eq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_sint_.c: fits_sint.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sint.c; then echo $(srcdir)/fits_sint.c; else echo fits_sint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_slong_.c: fits_slong.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_slong.c; then echo $(srcdir)/fits_slong.c; else echo fits_slong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_sshort_.c: fits_sshort.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sshort.c; then echo $(srcdir)/fits_sshort.c; else echo fits_sshort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_uint_.c: fits_uint.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_uint.c; then echo $(srcdir)/fits_uint.c; else echo fits_uint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_ulong_.c: fits_ulong.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ulong.c; then echo $(srcdir)/fits_ulong.c; else echo fits_ulong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_ushort_.c: fits_ushort.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ushort.c; then echo $(srcdir)/fits_ushort.c; else echo fits_ushort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_.c: get_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_2exp_.c: get_d_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d_2exp.c; then echo $(srcdir)/get_d_2exp.c; else echo get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_dfl_prec_.c: get_dfl_prec.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_dfl_prec.c; then echo $(srcdir)/get_dfl_prec.c; else echo get_dfl_prec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_prc_.c: get_prc.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_prc.c; then echo $(srcdir)/get_prc.c; else echo get_prc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_si_.c: get_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_si.c; then echo $(srcdir)/get_si.c; else echo get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_str_.c: get_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_ui_.c: get_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_ui.c; then echo $(srcdir)/get_ui.c; else echo get_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -init_.c: init.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -init2_.c: init2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init2.c; then echo $(srcdir)/init2.c; else echo init2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -inp_str_.c: inp_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -int_p_.c: int_p.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/int_p.c; then echo $(srcdir)/int_p.c; else echo int_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_.c: iset.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset.c; then echo $(srcdir)/iset.c; else echo iset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_d_.c: iset_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_d.c; then echo $(srcdir)/iset_d.c; else echo iset_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_si_.c: iset_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_si.c; then echo $(srcdir)/iset_si.c; else echo iset_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_str_.c: iset_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_str.c; then echo $(srcdir)/iset_str.c; else echo iset_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_ui_.c: iset_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_ui.c; then echo $(srcdir)/iset_ui.c; else echo iset_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_.c: mul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_2exp_.c: mul_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2exp.c; then echo $(srcdir)/mul_2exp.c; else echo mul_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_ui_.c: mul_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_ui.c; then echo $(srcdir)/mul_ui.c; else echo mul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -neg_.c: neg.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -out_str_.c: out_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pow_ui_.c: pow_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_ui.c; then echo $(srcdir)/pow_ui.c; else echo pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -random2_.c: random2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -reldiff_.c: reldiff.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reldiff.c; then echo $(srcdir)/reldiff.c; else echo reldiff.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_.c: set.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_d_.c: set_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_dfl_prec_.c: set_dfl_prec.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_dfl_prec.c; then echo $(srcdir)/set_dfl_prec.c; else echo set_dfl_prec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_prc_.c: set_prc.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_prc.c; then echo $(srcdir)/set_prc.c; else echo set_prc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_prc_raw_.c: set_prc_raw.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_prc_raw.c; then echo $(srcdir)/set_prc_raw.c; else echo set_prc_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_q_.c: set_q.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_q.c; then echo $(srcdir)/set_q.c; else echo set_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_si_.c: set_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_str_.c: set_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_ui_.c: set_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_z_.c: set_z.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_z.c; then echo $(srcdir)/set_z.c; else echo set_z.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -size_.c: size.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/size.c; then echo $(srcdir)/size.c; else echo size.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqrt_.c: sqrt.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt.c; then echo $(srcdir)/sqrt.c; else echo sqrt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqrt_ui_.c: sqrt_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt_ui.c; then echo $(srcdir)/sqrt_ui.c; else echo sqrt_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_.c: sub.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_ui_.c: sub_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_ui.c; then echo $(srcdir)/sub_ui.c; else echo sub_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -swap_.c: swap.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -trunc_.c: trunc.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trunc.c; then echo $(srcdir)/trunc.c; else echo trunc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ui_div_.c: ui_div.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_div.c; then echo $(srcdir)/ui_div.c; else echo ui_div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ui_sub_.c: ui_sub.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_sub.c; then echo $(srcdir)/ui_sub.c; else echo ui_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -urandomb_.c: urandomb.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomb.c; then echo $(srcdir)/urandomb.c; else echo urandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -abs_.$(OBJEXT) abs_.lo add_.$(OBJEXT) add_.lo add_ui_.$(OBJEXT) \ -add_ui_.lo ceilfloor_.$(OBJEXT) ceilfloor_.lo clear_.$(OBJEXT) \ -clear_.lo cmp_.$(OBJEXT) cmp_.lo cmp_d_.$(OBJEXT) cmp_d_.lo \ -cmp_si_.$(OBJEXT) cmp_si_.lo cmp_ui_.$(OBJEXT) cmp_ui_.lo \ -div_.$(OBJEXT) div_.lo div_2exp_.$(OBJEXT) div_2exp_.lo \ -div_ui_.$(OBJEXT) div_ui_.lo dump_.$(OBJEXT) dump_.lo eq_.$(OBJEXT) \ -eq_.lo fits_sint_.$(OBJEXT) fits_sint_.lo fits_slong_.$(OBJEXT) \ -fits_slong_.lo fits_sshort_.$(OBJEXT) fits_sshort_.lo \ -fits_uint_.$(OBJEXT) fits_uint_.lo fits_ulong_.$(OBJEXT) \ -fits_ulong_.lo fits_ushort_.$(OBJEXT) fits_ushort_.lo get_d_.$(OBJEXT) \ -get_d_.lo get_d_2exp_.$(OBJEXT) get_d_2exp_.lo get_dfl_prec_.$(OBJEXT) \ -get_dfl_prec_.lo get_prc_.$(OBJEXT) get_prc_.lo get_si_.$(OBJEXT) \ -get_si_.lo get_str_.$(OBJEXT) get_str_.lo get_ui_.$(OBJEXT) get_ui_.lo \ -init_.$(OBJEXT) init_.lo init2_.$(OBJEXT) init2_.lo inp_str_.$(OBJEXT) \ -inp_str_.lo int_p_.$(OBJEXT) int_p_.lo iset_.$(OBJEXT) iset_.lo \ -iset_d_.$(OBJEXT) iset_d_.lo iset_si_.$(OBJEXT) iset_si_.lo \ -iset_str_.$(OBJEXT) iset_str_.lo iset_ui_.$(OBJEXT) iset_ui_.lo \ -mul_.$(OBJEXT) mul_.lo mul_2exp_.$(OBJEXT) mul_2exp_.lo \ -mul_ui_.$(OBJEXT) mul_ui_.lo neg_.$(OBJEXT) neg_.lo out_str_.$(OBJEXT) \ -out_str_.lo pow_ui_.$(OBJEXT) pow_ui_.lo random2_.$(OBJEXT) \ -random2_.lo reldiff_.$(OBJEXT) reldiff_.lo set_.$(OBJEXT) set_.lo \ -set_d_.$(OBJEXT) set_d_.lo set_dfl_prec_.$(OBJEXT) set_dfl_prec_.lo \ -set_prc_.$(OBJEXT) set_prc_.lo set_prc_raw_.$(OBJEXT) set_prc_raw_.lo \ -set_q_.$(OBJEXT) set_q_.lo set_si_.$(OBJEXT) set_si_.lo \ -set_str_.$(OBJEXT) set_str_.lo set_ui_.$(OBJEXT) set_ui_.lo \ -set_z_.$(OBJEXT) set_z_.lo size_.$(OBJEXT) size_.lo sqrt_.$(OBJEXT) \ -sqrt_.lo sqrt_ui_.$(OBJEXT) sqrt_ui_.lo sub_.$(OBJEXT) sub_.lo \ -sub_ui_.$(OBJEXT) sub_ui_.lo swap_.$(OBJEXT) swap_.lo trunc_.$(OBJEXT) \ -trunc_.lo ui_div_.$(OBJEXT) ui_div_.lo ui_sub_.$(OBJEXT) ui_sub_.lo \ -urandomb_.$(OBJEXT) urandomb_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/mpf/add.c b/contrib/gmp/mpf/add.c index 341b36b49c..48f73e9543 100644 --- a/contrib/gmp/mpf/add.c +++ b/contrib/gmp/mpf/add.c @@ -110,7 +110,7 @@ mpf_add (mpf_ptr r, mpf_srcptr u, mpf_srcptr v) /* Allocate temp space for the result. Allocate just vsize + ediff later??? */ - tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (prec); if (ediff >= prec) { diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpf/clears.c similarity index 58% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpf/clears.c index 3072cd40f9..8d43006c4d 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpf/clears.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpf_clears() -- Clear multiple mpf_t variables. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpf_clears (mpf_ptr x, ...) +#else +mpf_clears (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpf_ptr x; + va_start (ap); + x = va_arg (ap, mpf_ptr); +#endif + + while (x != NULL) + { + mpf_clear (x); + x = va_arg (ap, mpf_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpf/div.c b/contrib/gmp/mpf/div.c index ef3675eb34..8f3abc6110 100644 --- a/contrib/gmp/mpf/div.c +++ b/contrib/gmp/mpf/div.c @@ -1,6 +1,6 @@ /* mpf_div -- Divide two floats. -Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2005 Free Software +Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2005, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -18,10 +18,8 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" /* Not done: @@ -42,105 +40,87 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ overlap between quotient and dividend in mpn_tdiv_qr, then we can avoid copying up,usize. This would only arise from a prec reduced with mpf_set_prec_raw and will be pretty unusual, but might be worthwhile if - it could be worked into the copy_u decision cleanly. - - Future: - - If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of - padding u with zeros in temporary space. - - If/when a quotient-only division exists it can be used here immediately. - remp is only to satisfy mpn_tdiv_qr, the remainder is not used. */ + it could be worked into the copy_u decision cleanly. */ void mpf_div (mpf_ptr r, mpf_srcptr u, mpf_srcptr v) { mp_srcptr up, vp; - mp_ptr rp, remp, tp, new_vp; - mp_size_t usize, vsize, rsize, prospective_rsize, tsize, zeros, copy_v_size; + mp_ptr rp, tp, new_vp; + mp_size_t usize, vsize, rsize, prospective_rsize, tsize, zeros; mp_size_t sign_quotient, prec, high_zero, chop; mp_exp_t rexp; int copy_u; TMP_DECL; - usize = u->_mp_size; - vsize = v->_mp_size; + usize = SIZ(u); + vsize = SIZ(v); sign_quotient = usize ^ vsize; usize = ABS (usize); vsize = ABS (vsize); - prec = r->_mp_prec; + prec = PREC(r); if (vsize == 0) DIVIDE_BY_ZERO; if (usize == 0) { - r->_mp_size = 0; - r->_mp_exp = 0; + SIZ(r) = 0; + EXP(r) = 0; return; } TMP_MARK; - rexp = u->_mp_exp - v->_mp_exp + 1; + rexp = EXP(u) - EXP(v) + 1; - rp = r->_mp_d; - up = u->_mp_d; - vp = v->_mp_d; + rp = PTR(r); + up = PTR(u); + vp = PTR(v); prospective_rsize = usize - vsize + 1; /* quot from using given u,v sizes */ - rsize = prec + 1; /* desired quot */ + rsize = prec + 1; /* desired quot */ - zeros = rsize - prospective_rsize; /* padding u to give rsize */ - copy_u = (zeros > 0 || rp == up); /* copy u if overlap or padding */ + zeros = rsize - prospective_rsize; /* padding u to give rsize */ + copy_u = (zeros > 0 || rp == up); /* copy u if overlap or padding */ - chop = MAX (-zeros, 0); /* negative zeros means shorten u */ + chop = MAX (-zeros, 0); /* negative zeros means shorten u */ up += chop; usize -= chop; - zeros += chop; /* now zeros >= 0 */ + zeros += chop; /* now zeros >= 0 */ - tsize = usize + zeros; /* size for possible copy of u */ - - if (WANT_TMP_DEBUG) - { - /* separate blocks, for malloc debugging */ - remp = TMP_ALLOC_LIMBS (vsize); - tp = (copy_u ? TMP_ALLOC_LIMBS (tsize) : NULL); - new_vp = (rp == vp ? TMP_ALLOC_LIMBS (vsize) : NULL); - } - else - { - /* one block with conditionalized size, for efficiency */ - copy_v_size = (rp == vp ? vsize : 0); - remp = TMP_ALLOC_LIMBS (vsize + copy_v_size + (copy_u ? tsize : 0)); - new_vp = remp + vsize; - tp = new_vp + copy_v_size; - } + tsize = usize + zeros; /* size for possible copy of u */ /* copy and possibly extend u if necessary */ if (copy_u) { + tp = TMP_ALLOC_LIMBS (tsize + 1); /* +1 for mpn_div_q's scratch needs */ MPN_ZERO (tp, zeros); MPN_COPY (tp+zeros, up, usize); up = tp; usize = tsize; } + else + { + tp = TMP_ALLOC_LIMBS (usize + 1); + } /* ensure divisor doesn't overlap quotient */ if (rp == vp) { + new_vp = TMP_ALLOC_LIMBS (vsize); MPN_COPY (new_vp, vp, vsize); vp = new_vp; } ASSERT (usize-vsize+1 == rsize); - mpn_tdiv_qr (rp, remp, (mp_size_t) 0, up, usize, vp, vsize); + mpn_div_q (rp, up, usize, vp, vsize, tp); /* strip possible zero high limb */ high_zero = (rp[rsize-1] == 0); rsize -= high_zero; rexp -= high_zero; - r->_mp_size = sign_quotient >= 0 ? rsize : -rsize; - r->_mp_exp = rexp; + SIZ(r) = sign_quotient >= 0 ? rsize : -rsize; + EXP(r) = rexp; TMP_FREE; } diff --git a/contrib/gmp/mpf/div_2exp.c b/contrib/gmp/mpf/div_2exp.c index eea5de3bc8..f74cd8bcda 100644 --- a/contrib/gmp/mpf/div_2exp.c +++ b/contrib/gmp/mpf/div_2exp.c @@ -65,7 +65,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ then use that mpn_rshift. */ void -mpf_div_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp) +mpf_div_2exp (mpf_ptr r, mpf_srcptr u, mp_bitcnt_t exp) { mp_srcptr up; mp_ptr rp = r->_mp_d; diff --git a/contrib/gmp/mpf/div_ui.c b/contrib/gmp/mpf/div_ui.c index bcf2b699cc..2f4de1511e 100644 --- a/contrib/gmp/mpf/div_ui.c +++ b/contrib/gmp/mpf/div_ui.c @@ -71,7 +71,7 @@ mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v) up = u->_mp_d; tsize = 1 + prec; - tp = (mp_ptr) TMP_ALLOC ((tsize + 1) * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (tsize + 1); if (usize > tsize) { diff --git a/contrib/gmp/mpf/eq.c b/contrib/gmp/mpf/eq.c index 3832c0b330..cdbbcb96da 100644 --- a/contrib/gmp/mpf/eq.c +++ b/contrib/gmp/mpf/eq.c @@ -23,10 +23,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "longlong.h" int -mpf_eq (mpf_srcptr u, mpf_srcptr v, unsigned long int n_bits) +mpf_eq (mpf_srcptr u, mpf_srcptr v, mp_bitcnt_t n_bits) { mp_srcptr up, vp, p; - mp_size_t usize, vsize, minsize, maxsize, n_limbs, i; + mp_size_t usize, vsize, minsize, maxsize, n_limbs, i, size; mp_exp_t uexp, vexp; mp_limb_t diff; int cnt; @@ -100,32 +100,37 @@ mpf_eq (mpf_srcptr u, mpf_srcptr v, unsigned long int n_bits) return 0; } - if (minsize != maxsize) + n_bits -= (maxsize - 1) * GMP_NUMB_BITS; + + size = maxsize - minsize; + if (size != 0) { if (up[0] != vp[0]) return 0; - } - /* Now either U or V has its limbs consumed. Check the the other operand - has just zeros in the corresponding, relevant part. */ + /* Now either U or V has its limbs consumed, i.e, continues with an + infinite number of implicit zero limbs. Check that the other operand + has just zeros in the corresponding, relevant part. */ - if (usize > vsize) - p = up + minsize - maxsize; - else - p = vp + minsize - maxsize; + if (usize > vsize) + p = up - size; + else + p = vp - size; - for (i = maxsize - minsize - 1; i > 0; i--) - { - if (p[i] != 0) - return 0; - } + for (i = size - 1; i > 0; i--) + { + if (p[i] != 0) + return 0; + } - n_bits -= (maxsize - 1) * GMP_NUMB_BITS; - - if (minsize != maxsize) - diff = p[0]; + diff = p[0]; + } else - diff = up[0] ^ vp[0]; + { + /* Both U or V has its limbs consumed. */ + + diff = up[0] ^ vp[0]; + } if (n_bits < GMP_NUMB_BITS) diff >>= GMP_NUMB_BITS - n_bits; diff --git a/contrib/gmp/mpf/get_dfl_prec.c b/contrib/gmp/mpf/get_dfl_prec.c index a44adbbe54..e48a3a1f40 100644 --- a/contrib/gmp/mpf/get_dfl_prec.c +++ b/contrib/gmp/mpf/get_dfl_prec.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" -unsigned long +mp_bitcnt_t mpf_get_default_prec (void) { return __GMPF_PREC_TO_BITS (__gmp_default_fp_limb_precision); diff --git a/contrib/gmp/mpf/get_prc.c b/contrib/gmp/mpf/get_prc.c index 6061063ac4..c413582b91 100644 --- a/contrib/gmp/mpf/get_prc.c +++ b/contrib/gmp/mpf/get_prc.c @@ -20,7 +20,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -unsigned long int +mp_bitcnt_t mpf_get_prec (mpf_srcptr x) { return __GMPF_PREC_TO_BITS (x->_mp_prec); diff --git a/contrib/gmp/mpf/get_str.c b/contrib/gmp/mpf/get_str.c index 30b12e7c29..447bfdbb97 100644 --- a/contrib/gmp/mpf/get_str.c +++ b/contrib/gmp/mpf/get_str.c @@ -67,7 +67,7 @@ mpn_pow_1_highpart (mp_ptr rp, mp_size_t *ignp, count_leading_zeros (cnt, exp); for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--) { - mpn_sqr_n (tp, rp + off, rn); + mpn_sqr (tp, rp + off, rn); rn = 2 * rn; rn -= tp[rn - 1] == 0; ign <<= 1; diff --git a/contrib/gmp/mpf/init2.c b/contrib/gmp/mpf/init2.c index 8fc4b938ad..8298a6b809 100644 --- a/contrib/gmp/mpf/init2.c +++ b/contrib/gmp/mpf/init2.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpf_init2 (mpf_ptr r, unsigned long int prec_in_bits) +mpf_init2 (mpf_ptr r, mp_bitcnt_t prec_in_bits) { mp_size_t prec; diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpf/inits.c similarity index 57% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpf/inits.c index 3072cd40f9..33471f6949 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpf/inits.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpf_inits() -- Initialize multiple mpf_t variables and set them to 0. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpf_inits (mpf_ptr x, ...) +#else +mpf_inits (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpf_ptr x; + va_start (ap); + x = va_arg (ap, mpf_ptr); +#endif + + while (x != NULL) + { + mpf_init (x); + x = va_arg (ap, mpf_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpf/mul.c b/contrib/gmp/mpf/mul.c index d4d9143746..0082aa40ad 100644 --- a/contrib/gmp/mpf/mul.c +++ b/contrib/gmp/mpf/mul.c @@ -63,7 +63,7 @@ mpf_mul (mpf_ptr r, mpf_srcptr u, mpf_srcptr v) mp_size_t adj; rsize = usize + vsize; - tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (rsize); cy_limb = (usize >= vsize ? mpn_mul (tp, up, usize, vp, vsize) : mpn_mul (tp, vp, vsize, up, usize)); diff --git a/contrib/gmp/mpf/mul_2exp.c b/contrib/gmp/mpf/mul_2exp.c index bd7df9c46f..5ec70e46a9 100644 --- a/contrib/gmp/mpf/mul_2exp.c +++ b/contrib/gmp/mpf/mul_2exp.c @@ -59,7 +59,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ then use that mpn_rshift. */ void -mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp) +mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, mp_bitcnt_t exp) { mp_srcptr up; mp_ptr rp = r->_mp_d; diff --git a/contrib/gmp/mpf/set_dfl_prec.c b/contrib/gmp/mpf/set_dfl_prec.c index 5266745be8..df52488609 100644 --- a/contrib/gmp/mpf/set_dfl_prec.c +++ b/contrib/gmp/mpf/set_dfl_prec.c @@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ mp_size_t __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (53); void -mpf_set_default_prec (unsigned long int prec_in_bits) +mpf_set_default_prec (mp_bitcnt_t prec_in_bits) { __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (prec_in_bits); } diff --git a/contrib/gmp/mpf/set_prc.c b/contrib/gmp/mpf/set_prc.c index 52f44aa457..873b12e85c 100644 --- a/contrib/gmp/mpf/set_prc.c +++ b/contrib/gmp/mpf/set_prc.c @@ -28,7 +28,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ inconsistent. */ void -mpf_set_prec (mpf_ptr x, unsigned long int new_prec_in_bits) +mpf_set_prec (mpf_ptr x, mp_bitcnt_t new_prec_in_bits) { mp_size_t old_prec, new_prec, new_prec_plus1; mp_size_t size, sign; diff --git a/contrib/gmp/mpf/set_prc_raw.c b/contrib/gmp/mpf/set_prc_raw.c index f6c6ac3453..c42e7a0dc2 100644 --- a/contrib/gmp/mpf/set_prc_raw.c +++ b/contrib/gmp/mpf/set_prc_raw.c @@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpf_set_prec_raw (mpf_ptr x, unsigned long int prec_in_bits) +mpf_set_prec_raw (mpf_ptr x, mp_bitcnt_t prec_in_bits) { x->_mp_prec = __GMPF_BITS_TO_PREC (prec_in_bits); } diff --git a/contrib/gmp/mpf/set_str.c b/contrib/gmp/mpf/set_str.c index ce8a6bac37..01a175fa62 100644 --- a/contrib/gmp/mpf/set_str.c +++ b/contrib/gmp/mpf/set_str.c @@ -72,7 +72,7 @@ mpn_pow_1_highpart (mp_ptr rp, mp_size_t *ignp, count_leading_zeros (cnt, exp); for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--) { - mpn_sqr_n (tp, rp + off, rn); + mpn_sqr (tp, rp + off, rn); rn = 2 * rn; rn -= tp[rn - 1] == 0; ign <<= 1; diff --git a/contrib/gmp/mpf/sqrt.c b/contrib/gmp/mpf/sqrt.c index 19a7ca08b0..dce9aff46f 100644 --- a/contrib/gmp/mpf/sqrt.c +++ b/contrib/gmp/mpf/sqrt.c @@ -82,7 +82,7 @@ mpf_sqrt (mpf_ptr r, mpf_srcptr u) /* root size is ceil(tsize/2), this will be our desired "prec" limbs */ ASSERT ((tsize + 1) / 2 == prec); - tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (tsize); if (usize > tsize) { diff --git a/contrib/gmp/mpf/sqrt_ui.c b/contrib/gmp/mpf/sqrt_ui.c index 17a39910fe..c3222555ec 100644 --- a/contrib/gmp/mpf/sqrt_ui.c +++ b/contrib/gmp/mpf/sqrt_ui.c @@ -77,7 +77,7 @@ mpf_sqrt_ui (mpf_ptr r, unsigned long int u) zeros = 2 * prec - 2; rsize = zeros + 1 + U2; - tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (rsize); MPN_ZERO (tp, zeros); tp[zeros] = u & GMP_NUMB_MASK; diff --git a/contrib/gmp/mpf/sub.c b/contrib/gmp/mpf/sub.c index 23f82273b7..845bdbc255 100644 --- a/contrib/gmp/mpf/sub.c +++ b/contrib/gmp/mpf/sub.c @@ -194,7 +194,7 @@ mpf_sub (mpf_ptr r, mpf_srcptr u, mpf_srcptr v) vsize = prec - 1; } - tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (prec); { mp_limb_t cy_limb; if (vsize == 0) @@ -275,7 +275,7 @@ general_case: /* Allocate temp space for the result. Allocate just vsize + ediff later??? */ - tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (prec); if (ediff >= prec) { diff --git a/contrib/gmp/mpf/ui_sub.c b/contrib/gmp/mpf/ui_sub.c index a665cc058b..081ca345f5 100644 --- a/contrib/gmp/mpf/ui_sub.c +++ b/contrib/gmp/mpf/ui_sub.c @@ -140,7 +140,7 @@ mpf_ui_sub (mpf_ptr r, unsigned long int u, mpf_srcptr v) /* Allocate temp space for the result. Allocate just vsize + ediff later??? */ - tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (prec); if (ediff >= prec) { diff --git a/contrib/gmp/mpf/urandomb.c b/contrib/gmp/mpf/urandomb.c index 41a4bc3c3d..02307e0fa2 100644 --- a/contrib/gmp/mpf/urandomb.c +++ b/contrib/gmp/mpf/urandomb.c @@ -24,7 +24,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpf_urandomb (mpf_t rop, gmp_randstate_t rstate, unsigned long int nbits) +mpf_urandomb (mpf_t rop, gmp_randstate_t rstate, mp_bitcnt_t nbits) { mp_ptr rp; mp_size_t nlimbs; diff --git a/contrib/gmp/mpn/Makefile.am b/contrib/gmp/mpn/Makefile.am deleted file mode 100644 index 073b89e988..0000000000 --- a/contrib/gmp/mpn/Makefile.am +++ /dev/null @@ -1,80 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, -# Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \ - -DOPERATION_`echo $* | sed 's/_$$//'` - -OFILES = @mpn_objects@ - - -# All possible mpn normal and optional function files are listed here, to -# get automake to generate ansi2knr rules for each. Such rules will be -# ignored for any that are instead implemented with a .asm (or whatever) for -# a particular target. -# -nodist_EXTRA_libmpn_la_SOURCES = \ - add.c add_1.c add_n.c \ - addmul_1.c addmul_2.c addmul_3.c addmul_4.c addmul_5.c addmul_6.c \ - addmul_7.c addmul_8.c \ - and_n.c andn_n.c bdivmod.c \ - cmp.c com_n.c copyd.c copyi.c \ - dc_divrem_n.c dive_1.c diveby3.c divis.c divrem.c divrem_1.c divrem_2.c \ - dump.c fib2_ui.c gcd.c \ - gcd_1.c gcdext.c get_d.c get_str.c \ - hamdist.c hgcd2.c hgcd.c invert_limb.c \ - ior_n.c iorn_n.c jacbase.c lshift.c \ - matrix22_mul.c mod_1.c mod_34lsub1.c mode1o.c \ - mod_1_1.c mod_1_2.c mod_1_3.c mod_1_4.c \ - mul.c mul_1.c mul_2.c mul_3.c mul_4.c mul_fft.c mul_n.c mul_basecase.c \ - mul_toom22.c mul_toom32.c mul_toom42.c \ - mullow_n.c mullow_basecase.c nand_n.c neg_n.c nior_n.c perfsqr.c \ - popcount.c pre_divrem_1.c pre_mod_1.c pow_1.c random.c random2.c rshift.c \ - rootrem.c sb_divrem_mn.c scan0.c scan1.c set_str.c \ - sqr_basecase.c sqr_diagonal.c \ - sqrtrem.c sub.c sub_1.c sub_n.c submul_1.c \ - tdiv_qr.c udiv_qrnnd.c udiv_w_sdiv.c xor_n.c xnor_n.c - -noinst_LTLIBRARIES = libmpn.la -nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c -libmpn_la_LIBADD = $(OFILES) -libmpn_la_DEPENDENCIES = $(OFILES) - -TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \ - minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr s390 \ - sh sparc32 sparc64 thumb vax x86 x86_64 z8000 z8000x - -EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST) - - -# These are BUILT_SOURCES at the top-level, so normally they're built before -# recursing into this directory. -# -fib_table.c: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/fib_table.c -mp_bases.c: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/mp_bases.c -perfsqr.h: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/perfsqr.h - -tune-gcd-p: gcd.c - $(COMPILE) -g -O1 -I $(top_srcdir)/tune -DTUNE_GCD_P=1 gcd.c -o tune-gcd-p -L ../.libs -L../tune/.libs -lspeed -lgmp -lm - -include Makeasm.am diff --git a/contrib/gmp/mpn/Makefile.in b/contrib/gmp/mpn/Makefile.in deleted file mode 100644 index e9817864fc..0000000000 --- a/contrib/gmp/mpn/Makefile.in +++ /dev/null @@ -1,859 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, -# Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, -# Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(nodist_libmpn_la_SOURCES) $(nodist_EXTRA_libmpn_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -DIST_COMMON = README $(srcdir)/Makeasm.am $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -subdir = mpn -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -am__DEPENDENCIES_1 = -nodist_libmpn_la_OBJECTS = fib_table$U.lo mp_bases$U.lo -libmpn_la_OBJECTS = $(nodist_libmpn_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(nodist_libmpn_la_SOURCES) \ - $(nodist_EXTRA_libmpn_la_SOURCES) -DIST_SOURCES = -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \ - -DOPERATION_`echo $* | sed 's/_$$//'` - -OFILES = @mpn_objects@ - -# All possible mpn normal and optional function files are listed here, to -# get automake to generate ansi2knr rules for each. Such rules will be -# ignored for any that are instead implemented with a .asm (or whatever) for -# a particular target. -# -nodist_EXTRA_libmpn_la_SOURCES = \ - add.c add_1.c add_n.c \ - addmul_1.c addmul_2.c addmul_3.c addmul_4.c addmul_5.c addmul_6.c \ - addmul_7.c addmul_8.c \ - and_n.c andn_n.c bdivmod.c \ - cmp.c com_n.c copyd.c copyi.c \ - dc_divrem_n.c dive_1.c diveby3.c divis.c divrem.c divrem_1.c divrem_2.c \ - dump.c fib2_ui.c gcd.c \ - gcd_1.c gcdext.c get_d.c get_str.c \ - hamdist.c hgcd2.c hgcd.c invert_limb.c \ - ior_n.c iorn_n.c jacbase.c lshift.c \ - matrix22_mul.c mod_1.c mod_34lsub1.c mode1o.c \ - mod_1_1.c mod_1_2.c mod_1_3.c mod_1_4.c \ - mul.c mul_1.c mul_2.c mul_3.c mul_4.c mul_fft.c mul_n.c mul_basecase.c \ - mul_toom22.c mul_toom32.c mul_toom42.c \ - mullow_n.c mullow_basecase.c nand_n.c neg_n.c nior_n.c perfsqr.c \ - popcount.c pre_divrem_1.c pre_mod_1.c pow_1.c random.c random2.c rshift.c \ - rootrem.c sb_divrem_mn.c scan0.c scan1.c set_str.c \ - sqr_basecase.c sqr_diagonal.c \ - sqrtrem.c sub.c sub_1.c sub_n.c submul_1.c \ - tdiv_qr.c udiv_qrnnd.c udiv_w_sdiv.c xor_n.c xnor_n.c - -noinst_LTLIBRARIES = libmpn.la -nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c -libmpn_la_LIBADD = $(OFILES) -libmpn_la_DEPENDENCIES = $(OFILES) -TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \ - minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr s390 \ - sh sparc32 sparc64 thumb vax x86 x86_64 z8000 z8000x - -EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST) - -# COMPILE minus CC. -# -COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS) - - -# Flags used for preprocessing (in ansi2knr rules). -# -PREPROCESS_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) - - -# Recent versions of automake (1.5 and up for instance) append automake -# generated suffixes to this $(SUFFIXES) list. This is essential for us, -# since .c must come after .s, .S and .asm. If .c is before .s, for -# instance, then in the mpn directory "make" will see add_n.c mentioned in -# an explicit rule (the ansi2knr stuff) and decide it must have add_n.c, -# even if add_n.c doesn't exist but add_n.s does. See GNU make -# documentation "(make)Implicit Rule Search", part 5c. -# -# On IRIX 6 native make this doesn't work properly though. Somehow .c -# remains ahead of .s, perhaps because .c.s is a builtin rule. .asm works -# fine though, and mpn/mips3 uses this. -# -SUFFIXES = .s .S .asm - -# can be overridden during development, eg. "make RM_TMP=: mul_1.lo" -RM_TMP = rm -f -all: all-am - -.SUFFIXES: -.SUFFIXES: .s .S .asm .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makeasm.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmpn.la: $(libmpn_la_OBJECTS) $(libmpn_la_DEPENDENCIES) - $(LINK) $(libmpn_la_LDFLAGS) $(libmpn_la_OBJECTS) $(libmpn_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -add_.c: add.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_1_.c: add_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_1.c; then echo $(srcdir)/add_1.c; else echo add_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_n_.c: add_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_n.c; then echo $(srcdir)/add_n.c; else echo add_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_1_.c: addmul_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_1.c; then echo $(srcdir)/addmul_1.c; else echo addmul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_2_.c: addmul_2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_2.c; then echo $(srcdir)/addmul_2.c; else echo addmul_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_3_.c: addmul_3.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_3.c; then echo $(srcdir)/addmul_3.c; else echo addmul_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_4_.c: addmul_4.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_4.c; then echo $(srcdir)/addmul_4.c; else echo addmul_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_5_.c: addmul_5.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_5.c; then echo $(srcdir)/addmul_5.c; else echo addmul_5.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_6_.c: addmul_6.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_6.c; then echo $(srcdir)/addmul_6.c; else echo addmul_6.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_7_.c: addmul_7.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_7.c; then echo $(srcdir)/addmul_7.c; else echo addmul_7.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -addmul_8_.c: addmul_8.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_8.c; then echo $(srcdir)/addmul_8.c; else echo addmul_8.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -and_n_.c: and_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/and_n.c; then echo $(srcdir)/and_n.c; else echo and_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -andn_n_.c: andn_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/andn_n.c; then echo $(srcdir)/andn_n.c; else echo andn_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -bdivmod_.c: bdivmod.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bdivmod.c; then echo $(srcdir)/bdivmod.c; else echo bdivmod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_.c: cmp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -com_n_.c: com_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/com_n.c; then echo $(srcdir)/com_n.c; else echo com_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -copyd_.c: copyd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/copyd.c; then echo $(srcdir)/copyd.c; else echo copyd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -copyi_.c: copyi.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/copyi.c; then echo $(srcdir)/copyi.c; else echo copyi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dc_divrem_n_.c: dc_divrem_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dc_divrem_n.c; then echo $(srcdir)/dc_divrem_n.c; else echo dc_divrem_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dive_1_.c: dive_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_1.c; then echo $(srcdir)/dive_1.c; else echo dive_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -diveby3_.c: diveby3.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/diveby3.c; then echo $(srcdir)/diveby3.c; else echo diveby3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divis_.c: divis.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis.c; then echo $(srcdir)/divis.c; else echo divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divrem_.c: divrem.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem.c; then echo $(srcdir)/divrem.c; else echo divrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divrem_1_.c: divrem_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_1.c; then echo $(srcdir)/divrem_1.c; else echo divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divrem_2_.c: divrem_2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_2.c; then echo $(srcdir)/divrem_2.c; else echo divrem_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dump_.c: dump.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fib2_ui_.c: fib2_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib2_ui.c; then echo $(srcdir)/fib2_ui.c; else echo fib2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fib_table_.c: fib_table.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib_table.c; then echo $(srcdir)/fib_table.c; else echo fib_table.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcd_.c: gcd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd.c; then echo $(srcdir)/gcd.c; else echo gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcd_1_.c: gcd_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd_1.c; then echo $(srcdir)/gcd_1.c; else echo gcd_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcdext_.c: gcdext.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext.c; then echo $(srcdir)/gcdext.c; else echo gcdext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_.c: get_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_str_.c: get_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -hamdist_.c: hamdist.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hamdist.c; then echo $(srcdir)/hamdist.c; else echo hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -hgcd_.c: hgcd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hgcd.c; then echo $(srcdir)/hgcd.c; else echo hgcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -hgcd2_.c: hgcd2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hgcd2.c; then echo $(srcdir)/hgcd2.c; else echo hgcd2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -invert_limb_.c: invert_limb.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invert_limb.c; then echo $(srcdir)/invert_limb.c; else echo invert_limb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ior_n_.c: ior_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ior_n.c; then echo $(srcdir)/ior_n.c; else echo ior_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iorn_n_.c: iorn_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iorn_n.c; then echo $(srcdir)/iorn_n.c; else echo iorn_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -jacbase_.c: jacbase.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacbase.c; then echo $(srcdir)/jacbase.c; else echo jacbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -lshift_.c: lshift.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lshift.c; then echo $(srcdir)/lshift.c; else echo lshift.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -matrix22_mul_.c: matrix22_mul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/matrix22_mul.c; then echo $(srcdir)/matrix22_mul.c; else echo matrix22_mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_1_.c: mod_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1.c; then echo $(srcdir)/mod_1.c; else echo mod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_1_1_.c: mod_1_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_1.c; then echo $(srcdir)/mod_1_1.c; else echo mod_1_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_1_2_.c: mod_1_2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_2.c; then echo $(srcdir)/mod_1_2.c; else echo mod_1_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_1_3_.c: mod_1_3.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_3.c; then echo $(srcdir)/mod_1_3.c; else echo mod_1_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_1_4_.c: mod_1_4.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_4.c; then echo $(srcdir)/mod_1_4.c; else echo mod_1_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_34lsub1_.c: mod_34lsub1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_34lsub1.c; then echo $(srcdir)/mod_34lsub1.c; else echo mod_34lsub1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mode1o_.c: mode1o.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mode1o.c; then echo $(srcdir)/mode1o.c; else echo mode1o.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mp_bases_.c: mp_bases.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_bases.c; then echo $(srcdir)/mp_bases.c; else echo mp_bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_.c: mul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_1_.c: mul_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_1.c; then echo $(srcdir)/mul_1.c; else echo mul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_2_.c: mul_2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2.c; then echo $(srcdir)/mul_2.c; else echo mul_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_3_.c: mul_3.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_3.c; then echo $(srcdir)/mul_3.c; else echo mul_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_4_.c: mul_4.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_4.c; then echo $(srcdir)/mul_4.c; else echo mul_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_basecase_.c: mul_basecase.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_basecase.c; then echo $(srcdir)/mul_basecase.c; else echo mul_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_fft_.c: mul_fft.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_fft.c; then echo $(srcdir)/mul_fft.c; else echo mul_fft.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_n_.c: mul_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_n.c; then echo $(srcdir)/mul_n.c; else echo mul_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_toom22_.c: mul_toom22.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom22.c; then echo $(srcdir)/mul_toom22.c; else echo mul_toom22.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_toom32_.c: mul_toom32.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom32.c; then echo $(srcdir)/mul_toom32.c; else echo mul_toom32.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_toom42_.c: mul_toom42.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom42.c; then echo $(srcdir)/mul_toom42.c; else echo mul_toom42.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mullow_basecase_.c: mullow_basecase.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mullow_basecase.c; then echo $(srcdir)/mullow_basecase.c; else echo mullow_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mullow_n_.c: mullow_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mullow_n.c; then echo $(srcdir)/mullow_n.c; else echo mullow_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -nand_n_.c: nand_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nand_n.c; then echo $(srcdir)/nand_n.c; else echo nand_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -neg_n_.c: neg_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg_n.c; then echo $(srcdir)/neg_n.c; else echo neg_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -nior_n_.c: nior_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nior_n.c; then echo $(srcdir)/nior_n.c; else echo nior_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -perfsqr_.c: perfsqr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfsqr.c; then echo $(srcdir)/perfsqr.c; else echo perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -popcount_.c: popcount.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/popcount.c; then echo $(srcdir)/popcount.c; else echo popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pow_1_.c: pow_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_1.c; then echo $(srcdir)/pow_1.c; else echo pow_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pre_divrem_1_.c: pre_divrem_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pre_divrem_1.c; then echo $(srcdir)/pre_divrem_1.c; else echo pre_divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pre_mod_1_.c: pre_mod_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pre_mod_1.c; then echo $(srcdir)/pre_mod_1.c; else echo pre_mod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -random_.c: random.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -random2_.c: random2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rootrem_.c: rootrem.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rootrem.c; then echo $(srcdir)/rootrem.c; else echo rootrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rshift_.c: rshift.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rshift.c; then echo $(srcdir)/rshift.c; else echo rshift.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sb_divrem_mn_.c: sb_divrem_mn.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sb_divrem_mn.c; then echo $(srcdir)/sb_divrem_mn.c; else echo sb_divrem_mn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -scan0_.c: scan0.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan0.c; then echo $(srcdir)/scan0.c; else echo scan0.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -scan1_.c: scan1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan1.c; then echo $(srcdir)/scan1.c; else echo scan1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_str_.c: set_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqr_basecase_.c: sqr_basecase.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqr_basecase.c; then echo $(srcdir)/sqr_basecase.c; else echo sqr_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqr_diagonal_.c: sqr_diagonal.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqr_diagonal.c; then echo $(srcdir)/sqr_diagonal.c; else echo sqr_diagonal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqrtrem_.c: sqrtrem.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrtrem.c; then echo $(srcdir)/sqrtrem.c; else echo sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_.c: sub.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_1_.c: sub_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_1.c; then echo $(srcdir)/sub_1.c; else echo sub_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_n_.c: sub_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_n.c; then echo $(srcdir)/sub_n.c; else echo sub_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -submul_1_.c: submul_1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/submul_1.c; then echo $(srcdir)/submul_1.c; else echo submul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_qr_.c: tdiv_qr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr.c; then echo $(srcdir)/tdiv_qr.c; else echo tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -udiv_qrnnd_.c: udiv_qrnnd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/udiv_qrnnd.c; then echo $(srcdir)/udiv_qrnnd.c; else echo udiv_qrnnd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -udiv_w_sdiv_.c: udiv_w_sdiv.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/udiv_w_sdiv.c; then echo $(srcdir)/udiv_w_sdiv.c; else echo udiv_w_sdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -xnor_n_.c: xnor_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xnor_n.c; then echo $(srcdir)/xnor_n.c; else echo xnor_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -xor_n_.c: xor_n.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xor_n.c; then echo $(srcdir)/xor_n.c; else echo xor_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_.$(OBJEXT) add_.lo add_1_.$(OBJEXT) add_1_.lo add_n_.$(OBJEXT) \ -add_n_.lo addmul_1_.$(OBJEXT) addmul_1_.lo addmul_2_.$(OBJEXT) \ -addmul_2_.lo addmul_3_.$(OBJEXT) addmul_3_.lo addmul_4_.$(OBJEXT) \ -addmul_4_.lo addmul_5_.$(OBJEXT) addmul_5_.lo addmul_6_.$(OBJEXT) \ -addmul_6_.lo addmul_7_.$(OBJEXT) addmul_7_.lo addmul_8_.$(OBJEXT) \ -addmul_8_.lo and_n_.$(OBJEXT) and_n_.lo andn_n_.$(OBJEXT) andn_n_.lo \ -bdivmod_.$(OBJEXT) bdivmod_.lo cmp_.$(OBJEXT) cmp_.lo com_n_.$(OBJEXT) \ -com_n_.lo copyd_.$(OBJEXT) copyd_.lo copyi_.$(OBJEXT) copyi_.lo \ -dc_divrem_n_.$(OBJEXT) dc_divrem_n_.lo dive_1_.$(OBJEXT) dive_1_.lo \ -diveby3_.$(OBJEXT) diveby3_.lo divis_.$(OBJEXT) divis_.lo \ -divrem_.$(OBJEXT) divrem_.lo divrem_1_.$(OBJEXT) divrem_1_.lo \ -divrem_2_.$(OBJEXT) divrem_2_.lo dump_.$(OBJEXT) dump_.lo \ -fib2_ui_.$(OBJEXT) fib2_ui_.lo fib_table_.$(OBJEXT) fib_table_.lo \ -gcd_.$(OBJEXT) gcd_.lo gcd_1_.$(OBJEXT) gcd_1_.lo gcdext_.$(OBJEXT) \ -gcdext_.lo get_d_.$(OBJEXT) get_d_.lo get_str_.$(OBJEXT) get_str_.lo \ -hamdist_.$(OBJEXT) hamdist_.lo hgcd_.$(OBJEXT) hgcd_.lo \ -hgcd2_.$(OBJEXT) hgcd2_.lo invert_limb_.$(OBJEXT) invert_limb_.lo \ -ior_n_.$(OBJEXT) ior_n_.lo iorn_n_.$(OBJEXT) iorn_n_.lo \ -jacbase_.$(OBJEXT) jacbase_.lo lshift_.$(OBJEXT) lshift_.lo \ -matrix22_mul_.$(OBJEXT) matrix22_mul_.lo mod_1_.$(OBJEXT) mod_1_.lo \ -mod_1_1_.$(OBJEXT) mod_1_1_.lo mod_1_2_.$(OBJEXT) mod_1_2_.lo \ -mod_1_3_.$(OBJEXT) mod_1_3_.lo mod_1_4_.$(OBJEXT) mod_1_4_.lo \ -mod_34lsub1_.$(OBJEXT) mod_34lsub1_.lo mode1o_.$(OBJEXT) mode1o_.lo \ -mp_bases_.$(OBJEXT) mp_bases_.lo mul_.$(OBJEXT) mul_.lo \ -mul_1_.$(OBJEXT) mul_1_.lo mul_2_.$(OBJEXT) mul_2_.lo mul_3_.$(OBJEXT) \ -mul_3_.lo mul_4_.$(OBJEXT) mul_4_.lo mul_basecase_.$(OBJEXT) \ -mul_basecase_.lo mul_fft_.$(OBJEXT) mul_fft_.lo mul_n_.$(OBJEXT) \ -mul_n_.lo mul_toom22_.$(OBJEXT) mul_toom22_.lo mul_toom32_.$(OBJEXT) \ -mul_toom32_.lo mul_toom42_.$(OBJEXT) mul_toom42_.lo \ -mullow_basecase_.$(OBJEXT) mullow_basecase_.lo mullow_n_.$(OBJEXT) \ -mullow_n_.lo nand_n_.$(OBJEXT) nand_n_.lo neg_n_.$(OBJEXT) neg_n_.lo \ -nior_n_.$(OBJEXT) nior_n_.lo perfsqr_.$(OBJEXT) perfsqr_.lo \ -popcount_.$(OBJEXT) popcount_.lo pow_1_.$(OBJEXT) pow_1_.lo \ -pre_divrem_1_.$(OBJEXT) pre_divrem_1_.lo pre_mod_1_.$(OBJEXT) \ -pre_mod_1_.lo random_.$(OBJEXT) random_.lo random2_.$(OBJEXT) \ -random2_.lo rootrem_.$(OBJEXT) rootrem_.lo rshift_.$(OBJEXT) \ -rshift_.lo sb_divrem_mn_.$(OBJEXT) sb_divrem_mn_.lo scan0_.$(OBJEXT) \ -scan0_.lo scan1_.$(OBJEXT) scan1_.lo set_str_.$(OBJEXT) set_str_.lo \ -sqr_basecase_.$(OBJEXT) sqr_basecase_.lo sqr_diagonal_.$(OBJEXT) \ -sqr_diagonal_.lo sqrtrem_.$(OBJEXT) sqrtrem_.lo sub_.$(OBJEXT) sub_.lo \ -sub_1_.$(OBJEXT) sub_1_.lo sub_n_.$(OBJEXT) sub_n_.lo \ -submul_1_.$(OBJEXT) submul_1_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo \ -udiv_qrnnd_.$(OBJEXT) udiv_qrnnd_.lo udiv_w_sdiv_.$(OBJEXT) \ -udiv_w_sdiv_.lo xnor_n_.$(OBJEXT) xnor_n_.lo xor_n_.$(OBJEXT) \ -xor_n_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - - -# These are BUILT_SOURCES at the top-level, so normally they're built before -# recursing into this directory. -# -fib_table.c: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/fib_table.c -mp_bases.c: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/mp_bases.c -perfsqr.h: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/perfsqr.h - -tune-gcd-p: gcd.c - $(COMPILE) -g -O1 -I $(top_srcdir)/tune -DTUNE_GCD_P=1 gcd.c -o tune-gcd-p -L ../.libs -L../tune/.libs -lspeed -lgmp -lm - -# .s assembler, no preprocessing. -# -.s.o: - $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< -.s.obj: - $(CCAS) $(COMPILE_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` -.s.lo: - $(LIBTOOL) --mode=compile --tag=CC $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< - -# .S assembler, preprocessed with cpp. -# -# It's necessary to run $(CPP) separately, since it seems not all compilers -# recognise .S files, in particular "cc" on HP-UX 10 and 11 doesn't (and -# will silently do nothing if given a .S). -# -# For .lo we need a helper script, as described below for .asm.lo. -# -.S.o: - $(CPP) $(PREPROCESS_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< | grep -v '^#' >tmp-$*.s - $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ - $(RM_TMP) tmp-$*.s -.S.obj: - $(CPP) $(PREPROCESS_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` | grep -v '^#' >tmp-$*.s - $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ - $(RM_TMP) tmp-$*.s -.S.lo: - $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< - -# .asm assembler, preprocessed with m4. -# -# .o and .obj are non-PIC and just need m4 followed by a compile. -# -# .lo is a bit tricky. Libtool (as of version 1.5) has foo.lo as a little -# text file, and .libs/foo.o and foo.o as the PIC and non-PIC objects, -# respectively. It'd be asking for lots of trouble to try to create foo.lo -# ourselves, so instead arrange to invoke libtool like a --mode=compile, but -# with a special m4-ccas script which first m4 preprocesses, then compiles. -# --tag=CC is necessary since foo.asm is otherwise unknown to libtool. -# -# Libtool adds -DPIC when building a shared object and the .asm files look -# for that. But it should be noted that the other PIC flags are on occasion -# important too, in particular FreeBSD 2.2.8 gas 1.92.3 requires -k before -# it accepts PIC constructs like @GOT, and gcc adds that flag only under -# -fPIC. (Later versions of gas are happy to accept PIC stuff any time.) -# -.asm.o: - $(M4) -DOPERATION_$* `test -f '$<' || echo '$(srcdir)/'`$< >tmp-$*.s - $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ - $(RM_TMP) tmp-$*.s -.asm.obj: - $(M4) -DOPERATION_$* `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >tmp-$*.s - $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ - $(RM_TMP) tmp-$*.s -.asm.lo: - $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/mpn/generic/add_n.c b/contrib/gmp/mpn/generic/add_n.c index 5006e27780..47b6df6099 100644 --- a/contrib/gmp/mpn/generic/add_n.c +++ b/contrib/gmp/mpn/generic/add_n.c @@ -1,6 +1,7 @@ /* mpn_add_n -- Add equal length limb vectors. -Copyright 1992, 1993, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. +Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2009 Free Software Foundation, +Inc. This file is part of the GNU MP Library. @@ -29,8 +30,8 @@ mpn_add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) mp_limb_t ul, vl, sl, rl, cy, cy1, cy2; ASSERT (n >= 1); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, up, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n)); cy = 0; do @@ -59,8 +60,8 @@ mpn_add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) mp_limb_t ul, vl, rl, cy; ASSERT (n >= 1); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, up, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n)); cy = 0; do diff --git a/contrib/gmp/mpn/generic/addsub_n.c b/contrib/gmp/mpn/generic/addsub_n.c index 452cf7b211..21437c67bf 100644 --- a/contrib/gmp/mpn/generic/addsub_n.c +++ b/contrib/gmp/mpn/generic/addsub_n.c @@ -1,4 +1,4 @@ -/* mpn_addsub_n -- Add and Subtract two limb vectors of equal, non-zero length. +/* mpn_add_n_sub_n -- Add and Subtract two limb vectors of equal, non-zero length. THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST @@ -31,13 +31,13 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define PART_SIZE (L1_CACHE_SIZE / BYTES_PER_MP_LIMB / 6) -/* mpn_addsub_n. +/* mpn_add_n_sub_n. r1[] = s1[] + s2[] r2[] = s1[] - s2[] All operands have n limbs. In-place operations allowed. */ mp_limb_t -mpn_addsub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n) +mpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n) { mp_limb_t acyn, acyo; /* carry for add */ mp_limb_t scyn, scyo; /* carry for subtract */ @@ -148,13 +148,13 @@ main (int argc, char **argv) s2p = malloc (n * BYTES_PER_MP_LIMB); TIME (t,(mpn_add_n(r1p,s1p,s2p,n),mpn_sub_n(r1p,s1p,s2p,n))); printf (" separate add and sub: %.3f\n", t); - TIME (t,mpn_addsub_n(r1p,r2p,s1p,s2p,n)); + TIME (t,mpn_add_n_sub_n(r1p,r2p,s1p,s2p,n)); printf ("combined addsub separate variables: %.3f\n", t); - TIME (t,mpn_addsub_n(r1p,r2p,r1p,s2p,n)); + TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,s2p,n)); printf (" combined addsub r1 overlap: %.3f\n", t); - TIME (t,mpn_addsub_n(r1p,r2p,r1p,s2p,n)); + TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,s2p,n)); printf (" combined addsub r2 overlap: %.3f\n", t); - TIME (t,mpn_addsub_n(r1p,r2p,r1p,r2p,n)); + TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,r2p,n)); printf (" combined addsub in-place: %.3f\n", t); return 0; diff --git a/contrib/gmp/mpn/generic/bdiv_q.c b/contrib/gmp/mpn/generic/bdiv_q.c new file mode 100644 index 0000000000..7cb62e8ea8 --- /dev/null +++ b/contrib/gmp/mpn/generic/bdiv_q.c @@ -0,0 +1,66 @@ +/* mpn_bdiv_q -- Hensel division with precomputed inverse, returning quotient. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2006, 2007, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + + +/* Computes Q = N / D mod B^n. */ + +void +mpn_bdiv_q (mp_ptr qp, + mp_srcptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_ptr tp) +{ + mp_limb_t di; + + if (BELOW_THRESHOLD (dn, DC_BDIV_Q_THRESHOLD)) + { + MPN_COPY (tp, np, nn); + binvert_limb (di, dp[0]); di = -di; + mpn_sbpi1_bdiv_q (qp, tp, nn, dp, dn, di); + } + else if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD)) + { + MPN_COPY (tp, np, nn); + binvert_limb (di, dp[0]); di = -di; + mpn_dcpi1_bdiv_q (qp, tp, nn, dp, dn, di); + } + else + { + mpn_mu_bdiv_q (qp, np, nn, dp, dn, tp); + } + return; +} + +mp_size_t +mpn_bdiv_q_itch (mp_size_t nn, mp_size_t dn) +{ + if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD)) + return nn; + else + return mpn_mu_bdiv_q_itch (nn, dn); +} diff --git a/contrib/gmp/mpn/generic/bdiv_q_1.c b/contrib/gmp/mpn/generic/bdiv_q_1.c new file mode 100644 index 0000000000..727f9f0d40 --- /dev/null +++ b/contrib/gmp/mpn/generic/bdiv_q_1.c @@ -0,0 +1,115 @@ +/* mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- schoolbook Hensel division by 1-limb + divisor, returning quotient only. + + THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST + CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN + FUTURE GNU MP RELEASES. + +Copyright 2000, 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +mp_limb_t +mpn_pi1_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d, + mp_limb_t di, int shift) +{ + mp_size_t i; + mp_limb_t c, h, l, u, u_next, dummy; + + ASSERT (n >= 1); + ASSERT (d != 0); + ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); + ASSERT_MPN (up, n); + ASSERT_LIMB (d); + + d <<= GMP_NAIL_BITS; + + if (shift != 0) + { + c = 0; + + u = up[0]; + rp--; + for (i = 1; i < n; i++) + { + u_next = up[i]; + u = ((u >> shift) | (u_next << (GMP_NUMB_BITS-shift))) & GMP_NUMB_MASK; + + SUBC_LIMB (c, l, u, c); + + l = (l * di) & GMP_NUMB_MASK; + rp[i] = l; + + umul_ppmm (h, dummy, l, d); + c += h; + u = u_next; + } + + u = u >> shift; + l = u - c; + l = (l * di) & GMP_NUMB_MASK; + rp[i] = l; + } + else + { + u = up[0]; + l = (u * di) & GMP_NUMB_MASK; + rp[0] = l; + c = 0; + + for (i = 1; i < n; i++) + { + umul_ppmm (h, dummy, l, d); + c += h; + + u = up[i]; + SUBC_LIMB (c, l, u, c); + + l = (l * di) & GMP_NUMB_MASK; + rp[i] = l; + } + } + + return c; +} + +mp_limb_t +mpn_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d) +{ + mp_limb_t di; + int shift; + + ASSERT (n >= 1); + ASSERT (d != 0); + ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); + ASSERT_MPN (up, n); + ASSERT_LIMB (d); + + if ((d & 1) == 0) + { + count_trailing_zeros (shift, d); + d >>= shift; + } + else + shift = 0; + + binvert_limb (di, d); + return mpn_pi1_bdiv_q_1 (rp, up, n, d, di, shift); +} diff --git a/contrib/gmp/mpn/generic/bdiv_qr.c b/contrib/gmp/mpn/generic/bdiv_qr.c new file mode 100644 index 0000000000..6fc61b7934 --- /dev/null +++ b/contrib/gmp/mpn/generic/bdiv_qr.c @@ -0,0 +1,73 @@ +/* mpn_bdiv_qr -- Hensel division with precomputed inverse, returning quotient + and remainder. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2006, 2007, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + + +/* Computes Q = N / D mod B^n, + R = N - QD. */ + +mp_limb_t +mpn_bdiv_qr (mp_ptr qp, mp_ptr rp, + mp_srcptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_ptr tp) +{ + mp_limb_t di; + mp_limb_t rh; + + if (BELOW_THRESHOLD (dn, DC_BDIV_QR_THRESHOLD) || + BELOW_THRESHOLD (nn - dn, DC_BDIV_QR_THRESHOLD)) + { + MPN_COPY (tp, np, nn); + binvert_limb (di, dp[0]); di = -di; + rh = mpn_sbpi1_bdiv_qr (qp, tp, nn, dp, dn, di); + MPN_COPY (rp, tp + nn - dn, dn); + } + else if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD)) + { + MPN_COPY (tp, np, nn); + binvert_limb (di, dp[0]); di = -di; + rh = mpn_dcpi1_bdiv_qr (qp, tp, nn, dp, dn, di); + MPN_COPY (rp, tp + nn - dn, dn); + } + else + { + rh = mpn_mu_bdiv_qr (qp, rp, np, nn, dp, dn, tp); + } + + return rh; +} + +mp_size_t +mpn_bdiv_qr_itch (mp_size_t nn, mp_size_t dn) +{ + if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD)) + return nn; + else + return mpn_mu_bdiv_qr_itch (nn, dn); +} diff --git a/contrib/gmp/mpn/generic/bdivmod.c b/contrib/gmp/mpn/generic/bdivmod.c deleted file mode 100644 index 783b594082..0000000000 --- a/contrib/gmp/mpn/generic/bdivmod.c +++ /dev/null @@ -1,124 +0,0 @@ -/* mpn/bdivmod.c: mpn_bdivmod for computing U/V mod 2^d. - -Copyright 1991, 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -/* q_high = mpn_bdivmod (qp, up, usize, vp, vsize, d). - - Puts the low d/BITS_PER_MP_LIMB limbs of Q = U / V mod 2^d at qp, and - returns the high d%BITS_PER_MP_LIMB bits of Q as the result. - - Also, U - Q * V mod 2^(usize*BITS_PER_MP_LIMB) is placed at up. Since the - low d/BITS_PER_MP_LIMB limbs of this difference are zero, the code allows - the limb vectors at qp to overwrite the low limbs at up, provided qp <= up. - - Preconditions: - 1. V is odd. - 2. usize * BITS_PER_MP_LIMB >= d. - 3. If Q and U overlap, qp <= up. - - Ken Weber (kweber@mat.ufrgs.br, kweber@mcs.kent.edu) - - Funding for this work has been partially provided by Conselho Nacional - de Desenvolvimento Cienti'fico e Tecnolo'gico (CNPq) do Brazil, Grant - 301314194-2, and was done while I was a visiting reseacher in the Instituto - de Matema'tica at Universidade Federal do Rio Grande do Sul (UFRGS). - - References: - T. Jebelean, An algorithm for exact division, Journal of Symbolic - Computation, v. 15, 1993, pp. 169-180. - - K. Weber, The accelerated integer GCD algorithm, ACM Transactions on - Mathematical Software, v. 21 (March), 1995, pp. 111-122. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - - -mp_limb_t -mpn_bdivmod (mp_ptr qp, mp_ptr up, mp_size_t usize, - mp_srcptr vp, mp_size_t vsize, unsigned long int d) -{ - mp_limb_t v_inv; - - ASSERT (usize >= 1); - ASSERT (vsize >= 1); - ASSERT (usize * GMP_NUMB_BITS >= d); - ASSERT (! MPN_OVERLAP_P (up, usize, vp, vsize)); - ASSERT (! MPN_OVERLAP_P (qp, d/GMP_NUMB_BITS, vp, vsize)); - ASSERT (MPN_SAME_OR_INCR2_P (qp, d/GMP_NUMB_BITS, up, usize)); - ASSERT_MPN (up, usize); - ASSERT_MPN (vp, vsize); - - /* 1/V mod 2^GMP_NUMB_BITS. */ - binvert_limb (v_inv, vp[0]); - - /* Fast code for two cases previously used by the accel part of mpn_gcd. - (Could probably remove this now it's inlined there.) */ - if (usize == 2 && vsize == 2 && - (d == GMP_NUMB_BITS || d == 2*GMP_NUMB_BITS)) - { - mp_limb_t hi, lo; - mp_limb_t q = (up[0] * v_inv) & GMP_NUMB_MASK; - umul_ppmm (hi, lo, q, vp[0] << GMP_NAIL_BITS); - up[0] = 0; - up[1] -= hi + q*vp[1]; - qp[0] = q; - if (d == 2*GMP_NUMB_BITS) - { - q = (up[1] * v_inv) & GMP_NUMB_MASK; - up[1] = 0; - qp[1] = q; - } - return 0; - } - - /* Main loop. */ - while (d >= GMP_NUMB_BITS) - { - mp_limb_t q = (up[0] * v_inv) & GMP_NUMB_MASK; - mp_limb_t b = mpn_submul_1 (up, vp, MIN (usize, vsize), q); - if (usize > vsize) - mpn_sub_1 (up + vsize, up + vsize, usize - vsize, b); - d -= GMP_NUMB_BITS; - up += 1, usize -= 1; - *qp++ = q; - } - - if (d) - { - mp_limb_t b; - mp_limb_t q = (up[0] * v_inv) & (((mp_limb_t)1< vsize) - mpn_sub_1 (up + vsize, up + vsize, usize - vsize, b); - return q; - } - - return 0; -} diff --git a/contrib/gmp/mpn/generic/binvert.c b/contrib/gmp/mpn/generic/binvert.c index 24d4dcdb6f..f06030cfe7 100644 --- a/contrib/gmp/mpn/generic/binvert.c +++ b/contrib/gmp/mpn/generic/binvert.c @@ -1,13 +1,12 @@ -/* Compute {up,n}^(-1) mod 2(n*GMP_NUMB_BITS). +/* Compute {up,n}^(-1) mod B^n. Contributed to the GNU project by Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -52,12 +51,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ mp_size_t mpn_binvert_itch (mp_size_t n) { -#if WANT_FFT - if (ABOVE_THRESHOLD (n, 2 * MUL_FFT_MODF_THRESHOLD)) - return mpn_fft_next_size (n, mpn_fft_best_k (n, 0)); - else -#endif - return 3 * (n - (n >> 1)); + mp_size_t itch_local = mpn_mulmod_bnm1_next_size (n); + mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, n, (n + 1) >> 1); + return itch_local + itch_out; } void @@ -76,42 +72,28 @@ mpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch) xp = scratch; - /* Compute a base value using a low-overhead O(n^2) algorithm. FIXME: We - should call some divide-and-conquer lsb division function here for an - operand subrange. */ + /* Compute a base value of rn limbs. */ MPN_ZERO (xp, rn); xp[0] = 1; binvert_limb (di, up[0]); if (BELOW_THRESHOLD (rn, DC_BDIV_Q_THRESHOLD)) - mpn_sb_bdiv_q (rp, xp, rn, up, rn, -di); + mpn_sbpi1_bdiv_q (rp, xp, rn, up, rn, -di); else - mpn_dc_bdiv_q (rp, xp, rn, up, rn, -di); + mpn_dcpi1_bdiv_q (rp, xp, rn, up, rn, -di); /* Use Newton iterations to get the desired precision. */ for (; rn < n; rn = newrn) { + mp_size_t m; newrn = *--sizp; -#if WANT_FFT - if (ABOVE_THRESHOLD (newrn, 2 * MUL_FFT_MODF_THRESHOLD)) - { - int k; - mp_size_t m, i; - - k = mpn_fft_best_k (newrn, 0); - m = mpn_fft_next_size (newrn, k); - mpn_mul_fft (xp, m, up, newrn, rp, rn, k); - for (i = rn - 1; i >= 0; i--) - if (xp[i] > (i == 0)) - { - mpn_add_1 (xp + rn, xp + rn, newrn - rn, 1); - break; - } - } - else -#endif - mpn_mul (xp, up, newrn, rp, rn); - mpn_mullow_n (rp + rn, rp, xp + rn, newrn - rn); - mpn_neg_n (rp + rn, rp + rn, newrn - rn); + /* X <- UR. */ + m = mpn_mulmod_bnm1_next_size (newrn); + mpn_mulmod_bnm1 (xp, m, up, newrn, rp, rn, xp + m); + mpn_sub_1 (xp + m, xp, rn - (m - newrn), 1); + + /* R = R(X/B^rn) */ + mpn_mullo_n (rp + rn, rp, xp + rn, newrn - rn); + mpn_neg (rp + rn, rp + rn, newrn - rn); } } diff --git a/contrib/gmp/mpf/get_dfl_prec.c b/contrib/gmp/mpn/generic/com.c similarity index 73% copy from contrib/gmp/mpf/get_dfl_prec.c copy to contrib/gmp/mpn/generic/com.c index a44adbbe54..ed817e6aaf 100644 --- a/contrib/gmp/mpf/get_dfl_prec.c +++ b/contrib/gmp/mpn/generic/com.c @@ -1,6 +1,6 @@ -/* mpf_get_default_prec -- return default precision in bits. +/* mpn_com - complement an mpn. -Copyright 2001 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -20,9 +20,15 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" +#undef mpn_com +#define mpn_com __MPN(com) -unsigned long -mpf_get_default_prec (void) +void +mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n) { - return __GMPF_PREC_TO_BITS (__gmp_default_fp_limb_precision); + mp_limb_t ul; + do { + ul = *up++; + *rp++ = ~ul & GMP_NUMB_MASK; + } while (--n != 0); } diff --git a/contrib/gmp/mpn/generic/neg_n.c b/contrib/gmp/mpn/generic/copyd.c similarity index 80% copy from contrib/gmp/mpn/generic/neg_n.c copy to contrib/gmp/mpn/generic/copyd.c index 1609204c90..2a08ef48b5 100644 --- a/contrib/gmp/mpn/generic/neg_n.c +++ b/contrib/gmp/mpn/generic/copyd.c @@ -1,6 +1,6 @@ -/* mpn_neg_n - negate an mpn. +/* mpn_copyd -Copyright 2001, 2009 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -17,7 +17,14 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define __GMP_FORCE_mpn_neg_n 1 - #include "gmp.h" #include "gmp-impl.h" + +void +mpn_copyd (mp_ptr rp, mp_srcptr up, mp_size_t n) +{ + mp_size_t i; + + for (i = n - 1; i >= 0; i--) + rp[i] = up[i]; +} diff --git a/contrib/gmp/mpn/generic/neg_n.c b/contrib/gmp/mpn/generic/copyi.c similarity index 78% copy from contrib/gmp/mpn/generic/neg_n.c copy to contrib/gmp/mpn/generic/copyi.c index 1609204c90..c0a047b42a 100644 --- a/contrib/gmp/mpn/generic/neg_n.c +++ b/contrib/gmp/mpn/generic/copyi.c @@ -1,6 +1,6 @@ -/* mpn_neg_n - negate an mpn. +/* mpn_copyi -Copyright 2001, 2009 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -17,7 +17,16 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define __GMP_FORCE_mpn_neg_n 1 - #include "gmp.h" #include "gmp-impl.h" + +void +mpn_copyi (mp_ptr rp, mp_srcptr up, mp_size_t n) +{ + mp_size_t i; + + up += n; + rp += n; + for (i = -n; i != 0; i++) + rp[i] = up[i]; +} diff --git a/contrib/gmp/mpn/generic/dc_bdiv_q.c b/contrib/gmp/mpn/generic/dc_bdiv_q.c deleted file mode 100644 index 9a43d18b56..0000000000 --- a/contrib/gmp/mpn/generic/dc_bdiv_q.c +++ /dev/null @@ -1,137 +0,0 @@ -/* mpn_dc_bdiv_q -- divide-and-conquer Hensel division with precomputed - inverse, returning quotient. - - Contributed to the GNU project by Niels Möller and Torbjörn Granlund. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. - -Copyright 2006, 2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" - - -/* Computes Q = N / D mod B^n, destroys N. */ - -mp_size_t -mpn_dc_bdiv_q_n_itch (mp_size_t n) -{ - /* NOTE: Depends om mullow_n interface */ - return n; -} - -void -mpn_dc_bdiv_q_n (mp_ptr qp, - mp_ptr np, mp_srcptr dp, mp_size_t n, - mp_limb_t dinv, mp_ptr tp) -{ - while (ABOVE_THRESHOLD (n, DC_BDIV_Q_THRESHOLD)) - { - mp_limb_t l, h; - mp_limb_t cy; - - l = n >> 1; - h = n - l; - - cy = mpn_dc_bdiv_qr_n (qp, np, dp, l, dinv, tp); - - mpn_mullow_n (tp, qp, dp + h, l); - mpn_sub_n (np + h, np + h, tp, l); - - if (l < h) - { - cy += mpn_submul_1 (np + l, qp, l, dp[l]); - np[n - 1] -= cy; - } - qp += l; - np += l; - n -= l; - } - mpn_sb_bdiv_q (qp, np, n, dp, n, dinv); -} - -void -mpn_dc_bdiv_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_limb_t dinv) -{ - mp_size_t qn; - mp_limb_t cy; - mp_ptr tp; - TMP_DECL; - - TMP_MARK; - - tp = TMP_SALLOC_LIMBS (dn); - - qn = nn; - - if (qn > dn) - { - /* Reduce qn mod dn in a super-efficient manner. */ - do - qn -= dn; - while (qn > dn); - - /* Perform the typically smaller block first. */ - if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD)) - cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); - else - cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp); - - if (qn != dn) - { - if (qn > dn - qn) - mpn_mul (tp, qp, qn, dp + qn, dn - qn); - else - mpn_mul (tp, dp + qn, dn - qn, qp, qn); - mpn_incr_u (tp + qn, cy); - - mpn_sub (np + qn, np + qn, nn - qn, tp, dn); - cy = 0; - } - - np += qn; - qp += qn; - - qn = nn - qn; - while (qn > dn) - { - mpn_sub_1 (np + dn, np + dn, qn, cy); - cy = mpn_dc_bdiv_qr_n (qp, np, dp, dn, dinv, tp); - qp += dn; - np += dn; - qn -= dn; - } - mpn_sub_1 (np + dn, np + dn, qn, cy); - mpn_dc_bdiv_q_n (qp, np, dp, dn, dinv, tp); - TMP_FREE; - return; - } - - if (BELOW_THRESHOLD (qn, DC_BDIV_Q_THRESHOLD)) - mpn_sb_bdiv_q (qp, np, 2 * qn, dp, qn, dinv); - else - mpn_dc_bdiv_q_n (qp, np, dp, qn, dinv, tp); - - TMP_FREE; -} diff --git a/contrib/gmp/mpn/generic/dc_div_qr.c b/contrib/gmp/mpn/generic/dc_div_qr.c deleted file mode 100644 index 41a46f1516..0000000000 --- a/contrib/gmp/mpn/generic/dc_div_qr.c +++ /dev/null @@ -1,203 +0,0 @@ -/* mpn_dc_div_qr -- recursive divide-and-conquer division for arbitrary size - operands. - - Contributed to the GNU project by Torbjörn Granlund. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. - -Copyright 2006, 2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" - - -mp_limb_t -mpn_dc_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, - mp_srcptr dip, mp_ptr tp) -{ - mp_size_t lo, hi; - mp_limb_t cy, qh, ql; - - lo = n >> 1; /* floor(n/2) */ - hi = n - lo; /* ceil(n/2) */ - - if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD)) - qh = mpn_sb_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dip); - else - qh = mpn_dc_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dip, tp); - - mpn_mul (tp, qp + lo, hi, dp, lo); - - cy = mpn_sub_n (np + lo, np + lo, tp, n); - if (qh != 0) - cy += mpn_sub_n (np + n, np + n, dp, lo); - - while (cy != 0) - { - qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1); - cy -= mpn_add_n (np + lo, np + lo, dp, n); - } - - if (BELOW_THRESHOLD (lo, DC_DIV_QR_THRESHOLD)) - ql = mpn_sb_div_qr (qp, np + hi, 2 * lo, dp + hi, lo, dip); - else - ql = mpn_dc_div_qr_n (qp, np + hi, dp + hi, lo, dip, tp); - - mpn_mul (tp, dp, hi, qp, lo); - - cy = mpn_sub_n (np, np, tp, n); - if (ql != 0) - cy += mpn_sub_n (np + lo, np + lo, dp, hi); - - while (cy != 0) - { - mpn_sub_1 (qp, qp, lo, 1); - cy -= mpn_add_n (np, np, dp, n); - } - - return qh; -} - -mp_limb_t -mpn_preinv_dc_div_qr (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_srcptr dip) -{ - mp_size_t qn; - mp_limb_t qh, cy; - mp_ptr tp; - TMP_DECL; - - TMP_MARK; - - tp = TMP_SALLOC_LIMBS (dn); - - qn = nn - dn; - qp += qn; - np += nn; - dp += dn; - - if (qn > dn) - { - /* Reduce qn mod dn without division, optimizing small operations. */ - do - qn -= dn; - while (qn > dn); - - qp -= qn; /* point at low limb of next quotient block */ - np -= qn; /* point in the middle of partial remainder */ - - /* Perform the typically smaller block first. */ - if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) - qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip); - else - qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp); - - if (qn != dn) - { - if (qn > dn - qn) - mpn_mul (tp, qp, qn, dp - dn, dn - qn); - else - mpn_mul (tp, dp - dn, dn - qn, qp, qn); - - cy = mpn_sub_n (np - dn, np - dn, tp, dn); - if (qh != 0) - cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); - - while (cy != 0) - { - qh -= mpn_sub_1 (qp, qp, qn, 1); - cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); - } - } - - qn = nn - dn - qn; - do - { - qp -= dn; - np -= dn; - mpn_dc_div_qr_n (qp, np - dn, dp - dn, dn, dip, tp); - qn -= dn; - } - while (qn > 0); - } - else - { - if (qn == 0) - { - qh = mpn_cmp (np - dn, dp - dn, dn) >= 0; - if (qh) - mpn_sub_n (np - dn, np - dn, dp - dn, dn); - TMP_FREE; - return qh; - } - - qp -= qn; /* point at low limb of next quotient block */ - np -= qn; /* point in the middle of partial remainder */ - - if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) - qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip); - else - qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp); - - if (qn != dn) - { - if (qn > dn - qn) - mpn_mul (tp, qp, qn, dp - dn, dn - qn); - else - mpn_mul (tp, dp - dn, dn - qn, qp, qn); - - cy = mpn_sub_n (np - dn, np - dn, tp, dn); - if (qh != 0) - cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); - - while (cy != 0) - { - qh -= mpn_sub_1 (qp, qp, qn, 1); - cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); - } - } - } - - TMP_FREE; - return qh; -} - -mp_limb_t -mpn_dc_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) -{ - mp_limb_t cy; - mp_limb_t xp[2], dip[2]; - - ASSERT (dn >= 2); - - cy = mpn_add_1 (xp, dp + dn - 2, 2, 1); - if (cy != 0) - dip[0] = dip[1] = 0; - else - { - mp_limb_t scratch[10]; /* FIXME */ - mpn_invert (dip, xp, 2, scratch); - } - - return mpn_preinv_dc_div_qr (qp, np, nn, dp, dn, dip); -} diff --git a/contrib/gmp/mpn/generic/dc_divappr_q.c b/contrib/gmp/mpn/generic/dc_divappr_q.c deleted file mode 100644 index 4474872388..0000000000 --- a/contrib/gmp/mpn/generic/dc_divappr_q.c +++ /dev/null @@ -1,196 +0,0 @@ -/* mpn_dc_divappr_q -- divide-and-conquer division, returning only approximate - quotient. The quotient retuened is either correct, or unity too large. - - Contributed to the GNU project by Torbjörn Granlund. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. - -Copyright 2006, 2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" - - -mp_limb_t -mpn_dc_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, - mp_srcptr dip, mp_ptr tp) -{ - mp_size_t lo, hi; - mp_limb_t cy, qh, ql; - - lo = n >> 1; /* floor(n/2) */ - hi = n - lo; /* ceil(n/2) */ - - if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD)) - qh = mpn_sb_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dip); - else - qh = mpn_dc_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dip, tp); - - mpn_mul (tp, qp + lo, hi, dp, lo); - - cy = mpn_sub_n (np + lo, np + lo, tp, n); - if (qh != 0) - cy += mpn_sub_n (np + n, np + n, dp, lo); - - while (cy != 0) - { - qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1); - cy -= mpn_add_n (np + lo, np + lo, dp, n); - } - - if (BELOW_THRESHOLD (lo, DC_DIVAPPR_Q_THRESHOLD)) - ql = mpn_sb_divappr_q (qp, np + hi, 2 * lo, dp + hi, lo, dip); - else - ql = mpn_dc_divappr_q_n (qp, np + hi, dp + hi, lo, dip, tp); - - if (UNLIKELY (ql != 0)) - { - mp_size_t i; - for (i = 0; i < lo; i++) - qp[i] = GMP_NUMB_MASK; - } - - return qh; -} - -mp_limb_t -mpn_preinv_dc_divappr_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_srcptr dip) -{ - mp_size_t qn; - mp_limb_t qh, cy, qsave; - mp_ptr tp; - TMP_DECL; - - TMP_MARK; - - tp = TMP_SALLOC_LIMBS (dn+1); - - qn = nn - dn; - qp += qn; - np += nn; - dp += dn; - - if (qn > dn) - { - qn++; /* pretend we'll need an extra limb */ - /* Reduce qn mod dn without division, optimizing small operations. */ - do - qn -= dn; - while (qn > dn); - - qp -= qn; /* point at low limb of next quotient block */ - np -= qn; /* point in the middle of partial remainder */ - - /* Perform the typically smaller block first. */ - if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) - qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip); - else - qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp); - - if (qn != dn) - { - if (qn > dn - qn) - mpn_mul (tp, qp, qn, dp - dn, dn - qn); - else - mpn_mul (tp, dp - dn, dn - qn, qp, qn); - - cy = mpn_sub_n (np - dn, np - dn, tp, dn); - if (qh != 0) - cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); - - while (cy != 0) - { - qh -= mpn_sub_1 (qp, qp, qn, 1); - cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); - } - } - - qn = nn - dn - qn + 1; - while (qn > dn) - { - qp -= dn; - np -= dn; - mpn_dc_div_qr_n (qp, np - dn, dp - dn, dn, dip, tp); - qn -= dn; - } - - /* Since we pretended we'd need an extra quotient limb before, we now - have made sure the code above left just dn-1=qn quotient limbs to - develop. Develop that plus a guard limb. */ - qn--; - qp -= qn; - np -= dn; - qsave = qp[qn]; - mpn_dc_divappr_q_n (qp, np - dn, dp - dn, dn, dip, tp); - MPN_COPY_INCR (qp, qp + 1, qn); - qp[qn] = qsave; - } - else - { - if (qn == 0) - { - qh = mpn_cmp (np - dn, dp - dn, dn) >= 0; - if (qh) - mpn_sub_n (np - dn, np - dn, dp - dn, dn); - TMP_FREE; - return qh; - } - - qp -= qn; /* point at low limb of next quotient block */ - np -= qn; /* point in the middle of partial remainder */ - - if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD)) - /* Full precision. Optimal? */ - qh = mpn_sb_divappr_q (qp, np - dn, nn, dp - dn, dn, dip); - else - { - /* Put quotient in tp, use qp as temporary, since qp lacks a limb. */ - qh = mpn_dc_divappr_q_n (tp, np - qn - 2, dp - (qn + 1), qn + 1, dip, qp); - MPN_COPY (qp, tp + 1, qn); - } - } - - TMP_FREE; - return qh; -} - -mp_limb_t -mpn_dc_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) -{ - mp_limb_t cy; - mp_limb_t xp[2], dip[2]; - - ASSERT (dn >= 2); - - cy = mpn_add_1 (xp, dp + dn - 2, 2, 1); - if (cy != 0) - dip[0] = dip[1] = 0; - else - { - mp_limb_t scratch[10]; /* FIXME */ - mpn_invert (dip, xp, 2, scratch); - } - - return mpn_preinv_dc_divappr_q (qp, np, nn, dp, dn, dip); -} diff --git a/contrib/gmp/mpn/generic/dc_divrem_n.c b/contrib/gmp/mpn/generic/dc_divrem_n.c deleted file mode 100644 index 61ddde72c3..0000000000 --- a/contrib/gmp/mpn/generic/dc_divrem_n.c +++ /dev/null @@ -1,121 +0,0 @@ -/* mpn_dc_divrem_n and auxilliary routines. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE - INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. - IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A - FUTURE GNU MP RELEASE. - - -Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. -Contributed by Paul Zimmermann. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" - -/* -[1] Fast Recursive Division, by Christoph Burnikel and Joachim Ziegler, - Technical report MPI-I-98-1-022, october 1998. - http://www.mpi-sb.mpg.de/~ziegler/TechRep.ps.gz -*/ - -static mp_limb_t mpn_dc_div_3_by_2 - __GMP_PROTO ((mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch)); -static mp_limb_t mpn_dc_div_2_by_1 - __GMP_PROTO ((mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch)); - -/* mpn_dc_divrem_n - Implements algorithm of page 8 in [1]: divides (np,2n) - by (dp,n) and puts the quotient in (qp,n), the remainder in (np,n). - Returns most significant limb of the quotient, which is 0 or 1. - Requires that the most significant bit of the divisor is set. */ - -mp_limb_t -mpn_dc_divrem_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n) -{ - mp_limb_t ret; - mp_ptr scratch; - TMP_DECL; - TMP_MARK; - - scratch = TMP_ALLOC_LIMBS (n); - ret = mpn_dc_div_2_by_1 (qp, np, dp, n, scratch); - - TMP_FREE; - return ret; -} - -static mp_limb_t -mpn_dc_div_2_by_1 (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch) -{ - mp_limb_t qhl, cc; - mp_size_t n2 = n/2; - - if (n % 2 != 0) - { - mp_ptr qp1 = qp + 1; - qhl = mpn_dc_div_3_by_2 (qp1 + n2, np + 2 + n2, dp + 1, n2, scratch); - qhl += mpn_add_1 (qp1 + n2, qp1 + n2, n2, - mpn_dc_div_3_by_2 (qp1, np + 2, dp + 1, n2, scratch)); - - cc = mpn_submul_1 (np + 1, qp1, n - 1, dp[0]); - cc = mpn_sub_1 (np + n, np + n, 1, cc); - if (qhl != 0) - cc += mpn_sub_1 (np + n, np + n, 1, dp[0]); - while (cc != 0) - { - qhl -= mpn_sub_1 (qp1, qp1, n - 1, (mp_limb_t) 1); - cc -= mpn_add_n (np + 1, np + 1, dp, n); - } - qhl += mpn_add_1 (qp1, qp1, n - 1, - mpn_sb_divrem_mn (qp, np, n + 1, dp, n)); - } - else - { - qhl = mpn_dc_div_3_by_2 (qp + n2, np + n2, dp, n2, scratch); - qhl += mpn_add_1 (qp + n2, qp + n2, n2, - mpn_dc_div_3_by_2 (qp, np, dp, n2, scratch)); - } - return qhl; -} - - -/* divides (np, 3n) by (dp, 2n) and puts the quotient in (qp, n), - the remainder in (np, 2n) */ - -static mp_limb_t -mpn_dc_div_3_by_2 (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch) -{ - mp_size_t twon = n + n; - mp_limb_t qhl, cc; - - if (n < DIV_DC_THRESHOLD) - qhl = mpn_sb_divrem_mn (qp, np + n, twon, dp + n, n); - else - qhl = mpn_dc_div_2_by_1 (qp, np + n, dp + n, n, scratch); - - mpn_mul_n (scratch, qp, dp, n); - cc = mpn_sub_n (np, np, scratch, twon); - - if (qhl != 0) - cc += mpn_sub_n (np + n, np + n, dp, n); - while (cc != 0) - { - qhl -= mpn_sub_1 (qp, qp, n, (mp_limb_t) 1); - cc -= mpn_add_n (np, np, dp, twon); - } - return qhl; -} diff --git a/contrib/gmp/mpn/generic/dcpi1_bdiv_q.c b/contrib/gmp/mpn/generic/dcpi1_bdiv_q.c new file mode 100644 index 0000000000..8c4a22a3ef --- /dev/null +++ b/contrib/gmp/mpn/generic/dcpi1_bdiv_q.c @@ -0,0 +1,150 @@ +/* mpn_dcpi1_bdiv_q -- divide-and-conquer Hensel division with precomputed + inverse, returning quotient. + + Contributed to the GNU project by Niels Möller and Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + + + +mp_size_t +mpn_dcpi1_bdiv_q_n_itch (mp_size_t n) +{ + /* NOTE: Depends on mullo_n interface */ + return n; +} + +/* Computes Q = N / D mod B^n, destroys N. + + N = {np,n} + D = {dp,n} +*/ + +void +mpn_dcpi1_bdiv_q_n (mp_ptr qp, + mp_ptr np, mp_srcptr dp, mp_size_t n, + mp_limb_t dinv, mp_ptr tp) +{ + while (ABOVE_THRESHOLD (n, DC_BDIV_Q_THRESHOLD)) + { + mp_size_t lo, hi; + mp_limb_t cy; + + lo = n >> 1; /* floor(n/2) */ + hi = n - lo; /* ceil(n/2) */ + + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, lo, dinv, tp); + + mpn_mullo_n (tp, qp, dp + hi, lo); + mpn_sub_n (np + hi, np + hi, tp, lo); + + if (lo < hi) + { + cy += mpn_submul_1 (np + lo, qp, lo, dp[lo]); + np[n - 1] -= cy; + } + qp += lo; + np += lo; + n -= lo; + } + mpn_sbpi1_bdiv_q (qp, np, n, dp, n, dinv); +} + +/* Computes Q = N / D mod B^nn, destroys N. + + N = {np,nn} + D = {dp,dn} +*/ + +void +mpn_dcpi1_bdiv_q (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) +{ + mp_size_t qn; + mp_limb_t cy; + mp_ptr tp; + TMP_DECL; + + TMP_MARK; + + ASSERT (dn >= 2); + ASSERT (nn - dn >= 0); + ASSERT (dp[0] & 1); + + tp = TMP_SALLOC_LIMBS (dn); + + qn = nn; + + if (qn > dn) + { + /* Reduce qn mod dn in a super-efficient manner. */ + do + qn -= dn; + while (qn > dn); + + /* Perform the typically smaller block first. */ + if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD)) + cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); + else + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp); + + if (qn != dn) + { + if (qn > dn - qn) + mpn_mul (tp, qp, qn, dp + qn, dn - qn); + else + mpn_mul (tp, dp + qn, dn - qn, qp, qn); + mpn_incr_u (tp + qn, cy); + + mpn_sub (np + qn, np + qn, nn - qn, tp, dn); + cy = 0; + } + + np += qn; + qp += qn; + + qn = nn - qn; + while (qn > dn) + { + mpn_sub_1 (np + dn, np + dn, qn, cy); + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp); + qp += dn; + np += dn; + qn -= dn; + } + mpn_dcpi1_bdiv_q_n (qp, np, dp, dn, dinv, tp); + } + else + { + if (BELOW_THRESHOLD (qn, DC_BDIV_Q_THRESHOLD)) + mpn_sbpi1_bdiv_q (qp, np, qn, dp, qn, dinv); + else + mpn_dcpi1_bdiv_q_n (qp, np, dp, qn, dinv, tp); + } + + TMP_FREE; +} diff --git a/contrib/gmp/mpn/generic/dc_bdiv_qr.c b/contrib/gmp/mpn/generic/dcpi1_bdiv_qr.c similarity index 68% rename from contrib/gmp/mpn/generic/dc_bdiv_qr.c rename to contrib/gmp/mpn/generic/dcpi1_bdiv_qr.c index 8b59bbd860..28cc82e6ff 100644 --- a/contrib/gmp/mpn/generic/dc_bdiv_qr.c +++ b/contrib/gmp/mpn/generic/dcpi1_bdiv_qr.c @@ -1,14 +1,13 @@ -/* mpn_dc_bdiv_qr -- divide-and-conquer Hensel division with precomputed +/* mpn_dcpi1_bdiv_qr -- divide-and-conquer Hensel division with precomputed inverse, returning quotient and remainder. - Contributed to the GNU project by Niels Möller and Torbjörn Granlund. + Contributed to the GNU project by Niels Möller and Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2006, 2007 Free Software Foundation, Inc. +Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -43,14 +42,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ d must be odd. dinv is (-d)^-1 mod 2^GMP_NUMB_BITS. */ mp_size_t -mpn_dc_bdiv_qr_n_itch (mp_size_t n) +mpn_dcpi1_bdiv_qr_n_itch (mp_size_t n) { return n; } mp_limb_t -mpn_dc_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, - mp_limb_t dinv, mp_ptr tp) +mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, + mp_limb_t dinv, mp_ptr tp) { mp_size_t lo, hi; mp_limb_t cy; @@ -60,9 +59,9 @@ mpn_dc_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, hi = n - lo; /* ceil(n/2) */ if (BELOW_THRESHOLD (lo, DC_BDIV_QR_THRESHOLD)) - cy = mpn_sb_bdiv_qr (qp, np, 2 * lo, dp, lo, dinv); + cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * lo, dp, lo, dinv); else - cy = mpn_dc_bdiv_qr_n (qp, np, dp, lo, dinv, tp); + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, lo, dinv, tp); mpn_mul (tp, dp + lo, hi, qp, lo); @@ -70,9 +69,9 @@ mpn_dc_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, rh = mpn_sub (np + lo, np + lo, n + hi, tp, n); if (BELOW_THRESHOLD (hi, DC_BDIV_QR_THRESHOLD)) - cy = mpn_sb_bdiv_qr (qp + lo, np + lo, 2 * hi, dp, hi, dinv); + cy = mpn_sbpi1_bdiv_qr (qp + lo, np + lo, 2 * hi, dp, hi, dinv); else - cy = mpn_dc_bdiv_qr_n (qp + lo, np + lo, dp, hi, dinv, tp); + cy = mpn_dcpi1_bdiv_qr_n (qp + lo, np + lo, dp, hi, dinv, tp); mpn_mul (tp, qp + lo, hi, dp + hi, lo); @@ -83,8 +82,8 @@ mpn_dc_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, } mp_limb_t -mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, - mp_limb_t dinv) +mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, mp_limb_t dinv) { mp_size_t qn; mp_limb_t rr, cy; @@ -93,6 +92,10 @@ mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, TMP_MARK; + ASSERT (dn >= 2); /* to adhere to mpn_sbpi1_div_qr's limits */ + ASSERT (nn - dn >= 1); /* to adhere to mpn_sbpi1_div_qr's limits */ + ASSERT (dp[0] & 1); + tp = TMP_SALLOC_LIMBS (dn); qn = nn - dn; @@ -106,9 +109,9 @@ mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, /* Perform the typically smaller block first. */ if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD)) - cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); + cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); else - cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp); + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp); rr = 0; if (qn != dn) @@ -130,7 +133,7 @@ mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, do { rr += mpn_sub_1 (np + dn, np + dn, qn, cy); - cy = mpn_dc_bdiv_qr_n (qp, np, dp, dn, dinv, tp); + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp); qp += dn; np += dn; qn -= dn; @@ -141,9 +144,9 @@ mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, } if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD)) - cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); + cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv); else - cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp); + cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp); rr = 0; if (qn != dn) diff --git a/contrib/gmp/mpn/generic/dc_div_q.c b/contrib/gmp/mpn/generic/dcpi1_div_q.c similarity index 51% rename from contrib/gmp/mpn/generic/dc_div_q.c rename to contrib/gmp/mpn/generic/dcpi1_div_q.c index 276ae4fba6..9e5cea5201 100644 --- a/contrib/gmp/mpn/generic/dc_div_q.c +++ b/contrib/gmp/mpn/generic/dcpi1_div_q.c @@ -1,13 +1,13 @@ -/* mpn_dc_div_q -- divide-and-conquer division, returning exact quotient only. +/* mpn_dc_div_q -- divide-and-conquer division, returning exact quotient + only. - Contributed to the GNU project by Torbjörn Granlund. + Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2006, 2007 Free Software Foundation, Inc. +Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -29,7 +29,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ mp_limb_t -mpn_dc_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) +mpn_dcpi1_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv) { mp_ptr tp, wp; mp_limb_t qh; @@ -38,6 +39,10 @@ mpn_dc_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) TMP_MARK; + ASSERT (dn >= 6); + ASSERT (nn - dn >= 3); + ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT); + tp = TMP_SALLOC_LIMBS (nn + 1); MPN_COPY (tp + 1, np, nn); tp[0] = 0; @@ -45,13 +50,27 @@ mpn_dc_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) qn = nn - dn; wp = TMP_SALLOC_LIMBS (qn + 1); - qh = mpn_dc_divappr_q (wp, tp, nn + 1, dp, dn); + qh = mpn_dcpi1_divappr_q (wp, tp, nn + 1, dp, dn, dinv); if (wp[0] == 0) - /* FIXME: Should multiply and subtract here, not recompute from scratch. */ - qh = mpn_dc_div_qr (qp, np, nn, dp, dn); + { + mp_limb_t cy; + + if (qn > dn) + mpn_mul (tp, wp + 1, qn, dp, dn); + else + mpn_mul (tp, dp, dn, wp + 1, qn); + + cy = (qh != 0) ? mpn_add_n (tp + qn, tp + qn, dp, dn) : 0; + + if (cy || mpn_cmp (tp, np, nn) > 0) /* At most is wrong by one, no cycle. */ + qh -= mpn_sub_1 (qp, wp + 1, qn, 1); + else /* Same as below */ + MPN_COPY (qp, wp + 1, qn); + } else MPN_COPY (qp, wp + 1, qn); + TMP_FREE; return qh; } diff --git a/contrib/gmp/mpn/generic/dcpi1_div_qr.c b/contrib/gmp/mpn/generic/dcpi1_div_qr.c new file mode 100644 index 0000000000..815173eb09 --- /dev/null +++ b/contrib/gmp/mpn/generic/dcpi1_div_qr.c @@ -0,0 +1,238 @@ +/* mpn_dcpi1_div_qr_n -- recursive divide-and-conquer division for arbitrary + size operands. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2006, 2007, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + + +mp_limb_t +mpn_dcpi1_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, + gmp_pi1_t *dinv, mp_ptr tp) +{ + mp_size_t lo, hi; + mp_limb_t cy, qh, ql; + + lo = n >> 1; /* floor(n/2) */ + hi = n - lo; /* ceil(n/2) */ + + if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD)) + qh = mpn_sbpi1_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dinv->inv32); + else + qh = mpn_dcpi1_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dinv, tp); + + mpn_mul (tp, qp + lo, hi, dp, lo); + + cy = mpn_sub_n (np + lo, np + lo, tp, n); + if (qh != 0) + cy += mpn_sub_n (np + n, np + n, dp, lo); + + while (cy != 0) + { + qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1); + cy -= mpn_add_n (np + lo, np + lo, dp, n); + } + + if (BELOW_THRESHOLD (lo, DC_DIV_QR_THRESHOLD)) + ql = mpn_sbpi1_div_qr (qp, np + hi, 2 * lo, dp + hi, lo, dinv->inv32); + else + ql = mpn_dcpi1_div_qr_n (qp, np + hi, dp + hi, lo, dinv, tp); + + mpn_mul (tp, dp, hi, qp, lo); + + cy = mpn_sub_n (np, np, tp, n); + if (ql != 0) + cy += mpn_sub_n (np + lo, np + lo, dp, hi); + + while (cy != 0) + { + mpn_sub_1 (qp, qp, lo, 1); + cy -= mpn_add_n (np, np, dp, n); + } + + return qh; +} + +mp_limb_t +mpn_dcpi1_div_qr (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + gmp_pi1_t *dinv) +{ + mp_size_t qn; + mp_limb_t qh, cy; + mp_ptr tp; + TMP_DECL; + + TMP_MARK; + + ASSERT (dn >= 6); /* to adhere to mpn_sbpi1_div_qr's limits */ + ASSERT (nn - dn >= 3); /* to adhere to mpn_sbpi1_div_qr's limits */ + ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT); + + tp = TMP_SALLOC_LIMBS (dn); + + qn = nn - dn; + qp += qn; + np += nn; + dp += dn; + + if (qn > dn) + { + /* Reduce qn mod dn without division, optimizing small operations. */ + do + qn -= dn; + while (qn > dn); + + qp -= qn; /* point at low limb of next quotient block */ + np -= qn; /* point in the middle of partial remainder */ + + /* Perform the typically smaller block first. */ + if (qn == 1) + { + mp_limb_t q, n2, n1, n0, d1, d0; + + /* Handle qh up front, for simplicity. */ + qh = mpn_cmp (np - dn + 1, dp - dn, dn) >= 0; + if (qh) + ASSERT_NOCARRY (mpn_sub_n (np - dn + 1, np - dn + 1, dp - dn, dn)); + + /* A single iteration of schoolbook: One 3/2 division, + followed by the bignum update and adjustment. */ + n2 = np[0]; + n1 = np[-1]; + n0 = np[-2]; + d1 = dp[-1]; + d0 = dp[-2]; + + ASSERT (n2 < d1 || (n2 == d1 && n1 <= d0)); + + if (UNLIKELY (n2 == d1) && n1 == d0) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np - dn, dp - dn, dn, q); + ASSERT (cy == n2); + } + else + { + udiv_qr_3by2 (q, n1, n0, n2, n1, n0, d1, d0, dinv->inv32); + + if (dn > 2) + { + mp_limb_t cy, cy1; + cy = mpn_submul_1 (np - dn, dp - dn, dn - 2, q); + + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 = (n1 - cy1) & GMP_NUMB_MASK; + np[-2] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp - dn, dn - 1); + qh -= (q == 0); + q = (q - 1) & GMP_NUMB_MASK; + } + } + else + np[-2] = n0; + + np[-1] = n1; + } + qp[0] = q; + } + else + { + /* Do a 2qn / qn division */ + if (qn == 2) + qh = mpn_divrem_2 (qp, 0L, np - 2, 4, dp - 2); /* FIXME: obsolete function. Use 5/3 division? */ + else if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) + qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32); + else + qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp); + + if (qn != dn) + { + if (qn > dn - qn) + mpn_mul (tp, qp, qn, dp - dn, dn - qn); + else + mpn_mul (tp, dp - dn, dn - qn, qp, qn); + + cy = mpn_sub_n (np - dn, np - dn, tp, dn); + if (qh != 0) + cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); + + while (cy != 0) + { + qh -= mpn_sub_1 (qp, qp, qn, 1); + cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); + } + } + } + + qn = nn - dn - qn; + do + { + qp -= dn; + np -= dn; + mpn_dcpi1_div_qr_n (qp, np - dn, dp - dn, dn, dinv, tp); + qn -= dn; + } + while (qn > 0); + } + else + { + qp -= qn; /* point at low limb of next quotient block */ + np -= qn; /* point in the middle of partial remainder */ + + if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) + qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32); + else + qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp); + + if (qn != dn) + { + if (qn > dn - qn) + mpn_mul (tp, qp, qn, dp - dn, dn - qn); + else + mpn_mul (tp, dp - dn, dn - qn, qp, qn); + + cy = mpn_sub_n (np - dn, np - dn, tp, dn); + if (qh != 0) + cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); + + while (cy != 0) + { + qh -= mpn_sub_1 (qp, qp, qn, 1); + cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); + } + } + } + + TMP_FREE; + return qh; +} diff --git a/contrib/gmp/mpn/generic/dcpi1_divappr_q.c b/contrib/gmp/mpn/generic/dcpi1_divappr_q.c new file mode 100644 index 0000000000..a0f79edfbb --- /dev/null +++ b/contrib/gmp/mpn/generic/dcpi1_divappr_q.c @@ -0,0 +1,246 @@ +/* mpn_dcpi1_divappr_q -- divide-and-conquer division, returning approximate + quotient. The quotient returned is either correct, or one too large. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + + +mp_limb_t +mpn_dcpi1_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, + gmp_pi1_t *dinv, mp_ptr tp) +{ + mp_size_t lo, hi; + mp_limb_t cy, qh, ql; + + lo = n >> 1; /* floor(n/2) */ + hi = n - lo; /* ceil(n/2) */ + + if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD)) + qh = mpn_sbpi1_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dinv->inv32); + else + qh = mpn_dcpi1_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dinv, tp); + + mpn_mul (tp, qp + lo, hi, dp, lo); + + cy = mpn_sub_n (np + lo, np + lo, tp, n); + if (qh != 0) + cy += mpn_sub_n (np + n, np + n, dp, lo); + + while (cy != 0) + { + qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1); + cy -= mpn_add_n (np + lo, np + lo, dp, n); + } + + if (BELOW_THRESHOLD (lo, DC_DIVAPPR_Q_THRESHOLD)) + ql = mpn_sbpi1_divappr_q (qp, np + hi, 2 * lo, dp + hi, lo, dinv->inv32); + else + ql = mpn_dcpi1_divappr_q_n (qp, np + hi, dp + hi, lo, dinv, tp); + + if (UNLIKELY (ql != 0)) + { + mp_size_t i; + for (i = 0; i < lo; i++) + qp[i] = GMP_NUMB_MASK; + } + + return qh; +} + +mp_limb_t +mpn_dcpi1_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv) +{ + mp_size_t qn; + mp_limb_t qh, cy, qsave; + mp_ptr tp; + TMP_DECL; + + TMP_MARK; + + ASSERT (dn >= 6); + ASSERT (nn > dn); + ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT); + + qn = nn - dn; + qp += qn; + np += nn; + dp += dn; + + if (qn >= dn) + { + qn++; /* pretend we'll need an extra limb */ + /* Reduce qn mod dn without division, optimizing small operations. */ + do + qn -= dn; + while (qn > dn); + + qp -= qn; /* point at low limb of next quotient block */ + np -= qn; /* point in the middle of partial remainder */ + + tp = TMP_SALLOC_LIMBS (dn); + + /* Perform the typically smaller block first. */ + if (qn == 1) + { + mp_limb_t q, n2, n1, n0, d1, d0; + + /* Handle qh up front, for simplicity. */ + qh = mpn_cmp (np - dn + 1, dp - dn, dn) >= 0; + if (qh) + ASSERT_NOCARRY (mpn_sub_n (np - dn + 1, np - dn + 1, dp - dn, dn)); + + /* A single iteration of schoolbook: One 3/2 division, + followed by the bignum update and adjustment. */ + n2 = np[0]; + n1 = np[-1]; + n0 = np[-2]; + d1 = dp[-1]; + d0 = dp[-2]; + + ASSERT (n2 < d1 || (n2 == d1 && n1 <= d0)); + + if (UNLIKELY (n2 == d1) && n1 == d0) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np - dn, dp - dn, dn, q); + ASSERT (cy == n2); + } + else + { + udiv_qr_3by2 (q, n1, n0, n2, n1, n0, d1, d0, dinv->inv32); + + if (dn > 2) + { + mp_limb_t cy, cy1; + cy = mpn_submul_1 (np - dn, dp - dn, dn - 2, q); + + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 = (n1 - cy1) & GMP_NUMB_MASK; + np[-2] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp - dn, dn - 1); + qh -= (q == 0); + q = (q - 1) & GMP_NUMB_MASK; + } + } + else + np[-2] = n0; + + np[-1] = n1; + } + qp[0] = q; + } + else + { + if (qn == 2) + qh = mpn_divrem_2 (qp, 0L, np - 2, 4, dp - 2); + else if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) + qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32); + else + qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp); + + if (qn != dn) + { + if (qn > dn - qn) + mpn_mul (tp, qp, qn, dp - dn, dn - qn); + else + mpn_mul (tp, dp - dn, dn - qn, qp, qn); + + cy = mpn_sub_n (np - dn, np - dn, tp, dn); + if (qh != 0) + cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn); + + while (cy != 0) + { + qh -= mpn_sub_1 (qp, qp, qn, 1); + cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn); + } + } + } + qn = nn - dn - qn + 1; + while (qn > dn) + { + qp -= dn; + np -= dn; + mpn_dcpi1_div_qr_n (qp, np - dn, dp - dn, dn, dinv, tp); + qn -= dn; + } + + /* Since we pretended we'd need an extra quotient limb before, we now + have made sure the code above left just dn-1=qn quotient limbs to + develop. Develop that plus a guard limb. */ + qn--; + qp -= qn; + np -= dn; + qsave = qp[qn]; + mpn_dcpi1_divappr_q_n (qp, np - dn, dp - dn, dn, dinv, tp); + MPN_COPY_INCR (qp, qp + 1, qn); + qp[qn] = qsave; + } + else /* (qn < dn) */ + { + mp_ptr q2p; +#if 0 /* not possible since we demand nn > dn */ + if (qn == 0) + { + qh = mpn_cmp (np - dn, dp - dn, dn) >= 0; + if (qh) + mpn_sub_n (np - dn, np - dn, dp - dn, dn); + TMP_FREE; + return qh; + } +#endif + + qp -= qn; /* point at low limb of next quotient block */ + np -= qn; /* point in the middle of partial remainder */ + + q2p = TMP_SALLOC_LIMBS (qn + 1); + /* Should we at all check DC_DIVAPPR_Q_THRESHOLD here, or reply on + callers not to be silly? */ + if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD)) + { + qh = mpn_sbpi1_divappr_q (q2p, np - qn - 2, 2 * (qn + 1), + dp - (qn + 1), qn + 1, dinv->inv32); + } + else + { + /* It is tempting to use qp for recursive scratch and put quotient in + tp, but the recursive scratch needs one limb too many. */ + tp = TMP_SALLOC_LIMBS (qn + 1); + qh = mpn_dcpi1_divappr_q_n (q2p, np - qn - 2, dp - (qn + 1), qn + 1, dinv, tp); + } + MPN_COPY (qp, q2p + 1, qn); + } + + TMP_FREE; + return qh; +} diff --git a/contrib/gmp/mpn/generic/div_q.c b/contrib/gmp/mpn/generic/div_q.c new file mode 100644 index 0000000000..b2a0fff8ea --- /dev/null +++ b/contrib/gmp/mpn/generic/div_q.c @@ -0,0 +1,312 @@ +/* mpn_div_q -- division for arbitrary size operands. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + + +/* Compute Q = N/D with truncation. + N = {np,nn} + D = {dp,dn} + Q = {qp,nn-dn+1} + T = {scratch,nn+1} is scratch space + N and D are both untouched by the computation. + N and T may overlap; pass the same space if N is irrelevant after the call, + but note that tp needs an extra limb. + + Operand requirements: + N >= D > 0 + dp[dn-1] != 0 + No overlap between the N, D, and Q areas. + + This division function does not clobber its input operands, since it is + intended to support average-O(qn) division, and for that to be effective, it + cannot put requirements on callers to copy a O(nn) operand. + + If a caller does not care about the value of {np,nn+1} after calling this + function, it should pass np also for the scratch argument. This function + will then save some time and space by avoiding allocation and copying. + (FIXME: Is this a good design? We only really save any copying for + already-normalised divisors, which should be rare. It also prevents us from + reasonably asking for all scratch space we need.) + + We write nn-dn+1 limbs for the quotient, but return void. Why not return + the most significant quotient limb? Look at the 4 main code blocks below + (consisting of an outer if-else where each arm contains an if-else). It is + tricky for the first code block, since the mpn_*_div_q calls will typically + generate all nn-dn+1 and return 0 or 1. I don't see how to fix that unless + we generate the most significant quotient limb here, before calling + mpn_*_div_q, or put the quotient in a temporary area. Since this is a + critical division case (the SB sub-case in particular) copying is not a good + idea. + + It might make sense to split the if-else parts of the (qn + FUDGE + >= dn) blocks into separate functions, since we could promise quite + different things to callers in these two cases. The 'then' case + benefits from np=scratch, and it could perhaps even tolerate qp=np, + saving some headache for many callers. + + FIXME: Scratch allocation leaves a lot to be desired. E.g., for the MU size + operands, we do not reuse the huge scratch for adjustments. This can be a + serious waste of memory for the largest operands. +*/ + +/* FUDGE determines when to try getting an approximate quotient from the upper + parts of the dividend and divisor, then adjust. N.B. FUDGE must be >= 2 + for the code to be correct. */ +#define FUDGE 5 /* FIXME: tune this */ + +#define DC_DIV_Q_THRESHOLD DC_DIVAPPR_Q_THRESHOLD +#define MU_DIV_Q_THRESHOLD MU_DIVAPPR_Q_THRESHOLD +#define MUPI_DIV_Q_THRESHOLD MUPI_DIVAPPR_Q_THRESHOLD +#ifndef MUPI_DIVAPPR_Q_THRESHOLD +#define MUPI_DIVAPPR_Q_THRESHOLD MUPI_DIV_QR_THRESHOLD +#endif + +void +mpn_div_q (mp_ptr qp, + mp_srcptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, mp_ptr scratch) +{ + mp_ptr new_dp, new_np, tp, rp; + mp_limb_t cy, dh, qh; + mp_size_t new_nn, qn; + gmp_pi1_t dinv; + int cnt; + TMP_DECL; + TMP_MARK; + + ASSERT (nn >= dn); + ASSERT (dn > 0); + ASSERT (dp[dn - 1] != 0); + ASSERT (! MPN_OVERLAP_P (qp, nn - dn + 1, np, nn)); + ASSERT (! MPN_OVERLAP_P (qp, nn - dn + 1, dp, dn)); + ASSERT (MPN_SAME_OR_SEPARATE_P (np, scratch, nn)); + + ASSERT_ALWAYS (FUDGE >= 2); + + if (dn == 1) + { + mpn_divrem_1 (qp, 0L, np, nn, dp[dn - 1]); + return; + } + + qn = nn - dn + 1; /* Quotient size, high limb might be zero */ + + if (qn + FUDGE >= dn) + { + /* |________________________| + |_______| */ + new_np = scratch; + + dh = dp[dn - 1]; + if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0)) + { + count_leading_zeros (cnt, dh); + + cy = mpn_lshift (new_np, np, nn, cnt); + new_np[nn] = cy; + new_nn = nn + (cy != 0); + + new_dp = TMP_ALLOC_LIMBS (dn); + mpn_lshift (new_dp, dp, dn, cnt); + + if (dn == 2) + { + qh = mpn_divrem_2 (qp, 0L, new_np, new_nn, new_dp); + } + else if (BELOW_THRESHOLD (dn, DC_DIV_Q_THRESHOLD) || + BELOW_THRESHOLD (new_nn - dn, DC_DIV_Q_THRESHOLD)) + { + invert_pi1 (dinv, new_dp[dn - 1], new_dp[dn - 2]); + qh = mpn_sbpi1_div_q (qp, new_np, new_nn, new_dp, dn, dinv.inv32); + } + else if (BELOW_THRESHOLD (dn, MUPI_DIV_Q_THRESHOLD) || /* fast condition */ + BELOW_THRESHOLD (nn, 2 * MU_DIV_Q_THRESHOLD) || /* fast condition */ + (double) (2 * (MU_DIV_Q_THRESHOLD - MUPI_DIV_Q_THRESHOLD)) * dn /* slow... */ + + (double) MUPI_DIV_Q_THRESHOLD * nn > (double) dn * nn) /* ...condition */ + { + invert_pi1 (dinv, new_dp[dn - 1], new_dp[dn - 2]); + qh = mpn_dcpi1_div_q (qp, new_np, new_nn, new_dp, dn, &dinv); + } + else + { + mp_size_t itch = mpn_mu_div_q_itch (new_nn, dn, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + qh = mpn_mu_div_q (qp, new_np, new_nn, new_dp, dn, scratch); + } + if (cy == 0) + qp[qn - 1] = qh; + else if (UNLIKELY (qh != 0)) + { + /* This happens only when the quotient is close to B^n and + mpn_*_divappr_q returned B^n. */ + mp_size_t i, n; + n = new_nn - dn; + for (i = 0; i < n; i++) + qp[i] = GMP_NUMB_MAX; + qh = 0; /* currently ignored */ + } + } + else /* divisor is already normalised */ + { + if (new_np != np) + MPN_COPY (new_np, np, nn); + + if (dn == 2) + { + qh = mpn_divrem_2 (qp, 0L, new_np, nn, dp); + } + else if (BELOW_THRESHOLD (dn, DC_DIV_Q_THRESHOLD) || + BELOW_THRESHOLD (nn - dn, DC_DIV_Q_THRESHOLD)) + { + invert_pi1 (dinv, dh, dp[dn - 2]); + qh = mpn_sbpi1_div_q (qp, new_np, nn, dp, dn, dinv.inv32); + } + else if (BELOW_THRESHOLD (dn, MUPI_DIV_Q_THRESHOLD) || /* fast condition */ + BELOW_THRESHOLD (nn, 2 * MU_DIV_Q_THRESHOLD) || /* fast condition */ + (double) (2 * (MU_DIV_Q_THRESHOLD - MUPI_DIV_Q_THRESHOLD)) * dn /* slow... */ + + (double) MUPI_DIV_Q_THRESHOLD * nn > (double) dn * nn) /* ...condition */ + { + invert_pi1 (dinv, dh, dp[dn - 2]); + qh = mpn_dcpi1_div_q (qp, new_np, nn, dp, dn, &dinv); + } + else + { + mp_size_t itch = mpn_mu_div_q_itch (nn, dn, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + qh = mpn_mu_div_q (qp, np, nn, dp, dn, scratch); + } + qp[nn - dn] = qh; + } + } + else + { + /* |________________________| + |_________________| */ + tp = TMP_ALLOC_LIMBS (qn + 1); + + new_np = scratch; + new_nn = 2 * qn + 1; + if (new_np == np) + /* We need {np,nn} to remain untouched until the final adjustment, so + we need to allocate separate space for new_np. */ + new_np = TMP_ALLOC_LIMBS (new_nn + 1); + + + dh = dp[dn - 1]; + if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0)) + { + count_leading_zeros (cnt, dh); + + cy = mpn_lshift (new_np, np + nn - new_nn, new_nn, cnt); + new_np[new_nn] = cy; + + new_nn += (cy != 0); + + new_dp = TMP_ALLOC_LIMBS (qn + 1); + mpn_lshift (new_dp, dp + dn - (qn + 1), qn + 1, cnt); + new_dp[0] |= dp[dn - (qn + 1) - 1] >> (GMP_NUMB_BITS - cnt); + + if (qn + 1 == 2) + { + qh = mpn_divrem_2 (tp, 0L, new_np, new_nn, new_dp); + } + else if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD - 1)) + { + invert_pi1 (dinv, new_dp[qn], new_dp[qn - 1]); + qh = mpn_sbpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, dinv.inv32); + } + else if (BELOW_THRESHOLD (qn, MU_DIVAPPR_Q_THRESHOLD - 1)) + { + invert_pi1 (dinv, new_dp[qn], new_dp[qn - 1]); + qh = mpn_dcpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, &dinv); + } + else + { + mp_size_t itch = mpn_mu_divappr_q_itch (new_nn, qn + 1, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + qh = mpn_mu_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, scratch); + } + if (cy == 0) + tp[qn] = qh; + else if (UNLIKELY (qh != 0)) + { + /* This happens only when the quotient is close to B^n and + mpn_*_divappr_q returned B^n. */ + mp_size_t i, n; + n = new_nn - (qn + 1); + for (i = 0; i < n; i++) + tp[i] = GMP_NUMB_MAX; + qh = 0; /* currently ignored */ + } + } + else /* divisor is already normalised */ + { + MPN_COPY (new_np, np + nn - new_nn, new_nn); /* pointless of MU will be used */ + + new_dp = (mp_ptr) dp + dn - (qn + 1); + + if (qn == 2 - 1) + { + qh = mpn_divrem_2 (tp, 0L, new_np, new_nn, new_dp); + } + else if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD - 1)) + { + invert_pi1 (dinv, dh, new_dp[qn - 1]); + qh = mpn_sbpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, dinv.inv32); + } + else if (BELOW_THRESHOLD (qn, MU_DIVAPPR_Q_THRESHOLD - 1)) + { + invert_pi1 (dinv, dh, new_dp[qn - 1]); + qh = mpn_dcpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, &dinv); + } + else + { + mp_size_t itch = mpn_mu_divappr_q_itch (new_nn, qn + 1, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + qh = mpn_mu_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, scratch); + } + tp[qn] = qh; + } + + MPN_COPY (qp, tp + 1, qn); + if (tp[0] <= 4) + { + mp_size_t rn; + + rp = TMP_ALLOC_LIMBS (dn + qn); + mpn_mul (rp, dp, dn, tp + 1, qn); + rn = dn + qn; + rn -= rp[rn - 1] == 0; + + if (rn > nn || mpn_cmp (np, rp, nn) < 0) + mpn_decr_u (qp, 1); + } + } + + TMP_FREE; +} diff --git a/contrib/gmp/mpn/generic/dive_1.c b/contrib/gmp/mpn/generic/dive_1.c index 27df57b80e..f246b091ce 100644 --- a/contrib/gmp/mpn/generic/dive_1.c +++ b/contrib/gmp/mpn/generic/dive_1.c @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Divide a={src,size} by d=divisor and store the quotient in q={dst,size}. q will only be correct if d divides a exactly. - A separate loop is used for shift==0 because n< 0); + ASSERT (nn >= dn); + ASSERT (dp[dn-1] > 0); + + while (dp[0] == 0) + { + ASSERT (np[0] == 0); + dp++; + np++; + dn--; + nn--; + } + + if (dn == 1) + { + MPN_DIVREM_OR_DIVEXACT_1 (qp, np, nn, dp[0]); + return; + } + + TMP_MARK; + + qn = nn + 1 - dn; + count_trailing_zeros (shift, dp[0]); + + if (shift > 0) + { + mp_size_t ss = (dn > qn) ? qn + 1 : dn; + + tp = TMP_ALLOC_LIMBS (ss); + mpn_rshift (tp, dp, ss, shift); + dp = tp; + + /* Since we have excluded dn == 1, we have nn > qn, and we need + to shift one limb beyond qn. */ + wp = TMP_ALLOC_LIMBS (qn + 1); + mpn_rshift (wp, np, qn + 1, shift); + } + else + { + wp = TMP_ALLOC_LIMBS (qn); + MPN_COPY (wp, np, qn); + } + + if (dn > qn) + dn = qn; + + tp = TMP_ALLOC_LIMBS (mpn_bdiv_q_itch (qn, dn)); + mpn_bdiv_q (qp, wp, qn, dp, dn, tp); + TMP_FREE; +} + +#else + /* We use the Jebelean's bidirectional exact division algorithm. This is somewhat naively implemented, with equal quotient parts done by 2-adic division and truncating division. Since 2-adic division is faster, it @@ -44,17 +111,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ * It makes the msb part 1 or 2 limbs larger than the lsb part, in spite of that the latter is faster. We should at least reverse this, but perhaps we should make the lsb part considerably larger. (How do we tune this?) - - Perhaps we could somehow use 2-adic division for both parts, not as now - truncating division for the upper part and 2-adic for the lower part. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - - mp_size_t mpn_divexact_itch (mp_size_t nn, mp_size_t dn) { @@ -76,7 +134,8 @@ mpn_divexact (mp_ptr qp, int cnt; mp_ptr xdp; mp_limb_t di; - mp_limb_t dip[2], xp[2], cy; + mp_limb_t cy; + gmp_pi1_t dinv; TMP_DECL; TMP_MARK; @@ -90,7 +149,7 @@ mpn_divexact (mp_ptr qp, MPN_COPY (tp, np, qn); binvert_limb (di, dp[0]); di = -di; dn = MIN (dn, qn); - mpn_sb_bdiv_q (qp, tp, qn, dp, dn, di); + mpn_sbpi1_bdiv_q (qp, tp, qn, dp, dn, di); TMP_FREE; return; } @@ -107,14 +166,14 @@ mpn_divexact (mp_ptr qp, MPN_COPY (tp, np, qn); binvert_limb (di, dp[0]); di = -di; dn = MIN (dn, qn); - mpn_sb_bdiv_q (qp, tp, qn, dp, dn, di); + mpn_sbpi1_bdiv_q (qp, tp, qn, dp, dn, di); } else if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD)) { tp = scratch; MPN_COPY (tp, np, qn); binvert_limb (di, dp[0]); di = -di; - mpn_dc_bdiv_q (qp, tp, qn, dp, dn, di); + mpn_dcpi1_bdiv_q (qp, tp, qn, dp, dn, di); } else { @@ -180,23 +239,14 @@ mpn_divexact (mp_ptr qp, MPN_COPY (tp, np + nn - nn1, nn1); } + invert_pi1 (dinv, xdp[qn1 - 1], xdp[qn1 - 2]); if (BELOW_THRESHOLD (qn1, DC_DIVAPPR_Q_THRESHOLD)) { - /* Compute divisor inverse. */ - cy = mpn_add_1 (xp, xdp + qn1 - 2, 2, 1); - if (cy != 0) - dip[0] = dip[1] = 0; - else - { - mp_limb_t scratch[10]; /* FIXME */ - mpn_invert (dip, xp, 2, scratch); - } - - qp[qn0 - 1 + nn1 - qn1] = mpn_sb_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, dip); + qp[qn0 - 1 + nn1 - qn1] = mpn_sbpi1_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, dinv.inv32); } else if (BELOW_THRESHOLD (qn1, MU_DIVAPPR_Q_THRESHOLD)) { - qp[qn0 - 1 + nn1 - qn1] = mpn_dc_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1); + qp[qn0 - 1 + nn1 - qn1] = mpn_dcpi1_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, &dinv); } else { @@ -215,12 +265,12 @@ mpn_divexact (mp_ptr qp, if (BELOW_THRESHOLD (qn0, DC_BDIV_Q_THRESHOLD)) { MPN_COPY (tp, np, qn0); - mpn_sb_bdiv_q (qp, tp, qn0, dp, qn0, di); + mpn_sbpi1_bdiv_q (qp, tp, qn0, dp, qn0, di); } else if (BELOW_THRESHOLD (qn0, MU_BDIV_Q_THRESHOLD)) { MPN_COPY (tp, np, qn0); - mpn_dc_bdiv_q (qp, tp, qn0, dp, qn0, di); + mpn_dcpi1_bdiv_q (qp, tp, qn0, dp, qn0, di); } else { @@ -232,3 +282,4 @@ mpn_divexact (mp_ptr qp, TMP_FREE; } +#endif diff --git a/contrib/gmp/mpn/generic/divis.c b/contrib/gmp/mpn/generic/divis.c index b05ecd8a78..a67abdbbdc 100644 --- a/contrib/gmp/mpn/generic/divis.c +++ b/contrib/gmp/mpn/generic/divis.c @@ -4,7 +4,7 @@ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES. -Copyright 2001, 2002, 2005 Free Software Foundation, Inc. +Copyright 2001, 2002, 2005, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -26,8 +26,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "longlong.h" -/* Determine whether {ap,asize} is divisible by {dp,dsize}. Must have both - operands normalized, meaning high limbs non-zero, except that asize==0 is +/* Determine whether {ap,an} is divisible by {dp,dn}. Must have both + operands normalized, meaning high limbs non-zero, except that an==0 is allowed. There usually won't be many low zero bits on d, but the checks for this @@ -36,14 +36,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Future: - This is currently not much faster than the user doing an mpz_tdiv_r - and testing for a zero remainder, but hopefully it can be improved. - - mpn_bdivmod is one possibility, but it only trades udiv_qrnnd's for - multiplies, it won't save crossproducts the way it can in mpz_divexact. - Definitely worthwhile on small operands for most processors, but a - sub-quadratic version will be wanted before it can be used on all sizes. - Getting the remainder limb by limb would make an early exit possible on finding a non-zero. This would probably have to be bdivmod style so there's no addback, but it would need a multi-precision inverse and so @@ -53,37 +45,30 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ just append a low zero limb to "a" rather than bit-shifting as mpn_tdiv_qr does internally, so long as it's already been checked that a has at least as many trailing zeros bits as d. Or equivalently, pass - qxn==1 to mpn_tdiv_qr, if/when it accepts that. - - When called from mpz_congruent_p, {ap,asize} is a temporary which can be - destroyed. Maybe it'd be possible to get into mpn_tdiv_qr at a lower - level to save copying it, or maybe that function could accept rp==ap. - - Could use __attribute__ ((regparm (2))) on i386, so the parameters - wouldn't need extra stack when called from mpz_divisible_p, but a - pre-release gcc 3 didn't generate particularly good register juggling in - that case, so this isn't done for now. */ + qxn==1 to mpn_tdiv_qr, if/when it accepts that. */ int -mpn_divisible_p (mp_srcptr ap, mp_size_t asize, - mp_srcptr dp, mp_size_t dsize) +mpn_divisible_p (mp_srcptr ap, mp_size_t an, + mp_srcptr dp, mp_size_t dn) { mp_limb_t alow, dlow, dmask; - mp_ptr qp, rp; + mp_ptr qp, rp, tp; mp_size_t i; + mp_limb_t di; + unsigned twos; TMP_DECL; - ASSERT (asize >= 0); - ASSERT (asize == 0 || ap[asize-1] != 0); - ASSERT (dsize >= 1); - ASSERT (dp[dsize-1] != 0); - ASSERT_MPN (ap, asize); - ASSERT_MPN (dp, dsize); + ASSERT (an >= 0); + ASSERT (an == 0 || ap[an-1] != 0); + ASSERT (dn >= 1); + ASSERT (dp[dn-1] != 0); + ASSERT_MPN (ap, an); + ASSERT_MPN (dp, dn); /* When a= 1); - dsize--; ASSERT (dsize >= 1); + /* a!=0 and d!=0 so won't get to n==0 */ + an--; ASSERT (an >= 1); + dn--; ASSERT (dn >= 1); ap++; dp++; } @@ -109,41 +94,88 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t asize, if ((alow & dmask) != 0) return 0; - if (dsize == 1) + if (dn == 1) { - if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD)) - return mpn_mod_1 (ap, asize, dlow) == 0; + if (ABOVE_THRESHOLD (an, BMOD_1_TO_MOD_1_THRESHOLD)) + return mpn_mod_1 (ap, an, dlow) == 0; - if ((dlow & 1) == 0) - { - unsigned twos; - count_trailing_zeros (twos, dlow); - dlow >>= twos; - } - return mpn_modexact_1_odd (ap, asize, dlow) == 0; + count_trailing_zeros (twos, dlow); + dlow >>= twos; + return mpn_modexact_1_odd (ap, an, dlow) == 0; } - if (dsize == 2) + if (dn == 2) { mp_limb_t dsecond = dp[1]; if (dsecond <= dmask) { - unsigned twos; count_trailing_zeros (twos, dlow); dlow = (dlow >> twos) | (dsecond << (GMP_NUMB_BITS-twos)); ASSERT_LIMB (dlow); - return MPN_MOD_OR_MODEXACT_1_ODD (ap, asize, dlow) == 0; + return MPN_MOD_OR_MODEXACT_1_ODD (ap, an, dlow) == 0; } } + /* Should we compute Q = A * D^(-1) mod B^k, + R = A - Q * D mod B^k + here, for some small values of k? Then check if R = 0 (mod B^k). */ + + /* We could also compute A' = A mod T and D' = D mod P, for some + P = 3 * 5 * 7 * 11 ..., and then check if any prime factor from P + dividing D' also divides A'. */ + TMP_MARK; - rp = TMP_ALLOC_LIMBS (asize+1); - qp = rp + dsize; + rp = TMP_ALLOC_LIMBS (an + 1); + qp = TMP_ALLOC_LIMBS (an - dn + 1); /* FIXME: Could we avoid this */ - mpn_tdiv_qr (qp, rp, (mp_size_t) 0, ap, asize, dp, dsize); + count_trailing_zeros (twos, dp[0]); + + if (twos != 0) + { + tp = TMP_ALLOC_LIMBS (dn); + ASSERT_NOCARRY (mpn_rshift (tp, dp, dn, twos)); + dp = tp; + + ASSERT_NOCARRY (mpn_rshift (rp, ap, an, twos)); + } + else + { + MPN_COPY (rp, ap, an); + } + if (rp[an - 1] >= dp[dn - 1]) + { + rp[an] = 0; + an++; + } + else if (an == dn) + { + TMP_FREE; + return 0; + } + + ASSERT (an > dn); /* requirement of functions below */ + + if (BELOW_THRESHOLD (dn, DC_BDIV_QR_THRESHOLD) || + BELOW_THRESHOLD (an - dn, DC_BDIV_QR_THRESHOLD)) + { + binvert_limb (di, dp[0]); + mpn_sbpi1_bdiv_qr (qp, rp, an, dp, dn, -di); + rp += an - dn; + } + else if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD)) + { + binvert_limb (di, dp[0]); + mpn_dcpi1_bdiv_qr (qp, rp, an, dp, dn, -di); + rp += an - dn; + } + else + { + tp = TMP_ALLOC_LIMBS (mpn_mu_bdiv_qr_itch (an, dn)); + mpn_mu_bdiv_qr (qp, rp, rp, an, dp, dn, tp); + } - /* test for {rp,dsize} zero or non-zero */ + /* test for {rp,dn} zero or non-zero */ i = 0; do { @@ -153,7 +185,7 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t asize, return 0; } } - while (++i < dsize); + while (++i < dn); TMP_FREE; return 1; diff --git a/contrib/gmp/mpn/generic/divrem.c b/contrib/gmp/mpn/generic/divrem.c index 999ffdd347..1fb45410d8 100644 --- a/contrib/gmp/mpn/generic/divrem.c +++ b/contrib/gmp/mpn/generic/divrem.c @@ -47,7 +47,7 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn, TMP_DECL; TMP_MARK; - q2p = (mp_ptr) TMP_ALLOC ((nn + qxn) * BYTES_PER_MP_LIMB); + q2p = TMP_ALLOC_LIMBS (nn + qxn); np[0] = mpn_divrem_1 (q2p, qxn, np, nn, dp[0]); qn = nn + qxn - 1; @@ -72,11 +72,11 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn, if (UNLIKELY (qxn != 0)) { mp_ptr n2p; - n2p = (mp_ptr) TMP_ALLOC ((nn + qxn) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (nn + qxn); MPN_ZERO (n2p, qxn); MPN_COPY (n2p + qxn, np, nn); - q2p = (mp_ptr) TMP_ALLOC ((nn - dn + qxn + 1) * BYTES_PER_MP_LIMB); - rp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB); + q2p = TMP_ALLOC_LIMBS (nn - dn + qxn + 1); + rp = TMP_ALLOC_LIMBS (dn); mpn_tdiv_qr (q2p, rp, 0L, n2p, nn + qxn, dp, dn); MPN_COPY (np, rp, dn); qn = nn - dn + qxn; @@ -85,8 +85,8 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn, } else { - q2p = (mp_ptr) TMP_ALLOC ((nn - dn + 1) * BYTES_PER_MP_LIMB); - rp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB); + q2p = TMP_ALLOC_LIMBS (nn - dn + 1); + rp = TMP_ALLOC_LIMBS (dn); mpn_tdiv_qr (q2p, rp, 0L, np, nn, dp, dn); MPN_COPY (np, rp, dn); /* overwrite np area with remainder */ qn = nn - dn; diff --git a/contrib/gmp/mpn/generic/fib2_ui.c b/contrib/gmp/mpn/generic/fib2_ui.c index a39d538262..ddf93faeda 100644 --- a/contrib/gmp/mpn/generic/fib2_ui.c +++ b/contrib/gmp/mpn/generic/fib2_ui.c @@ -4,7 +4,7 @@ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES. -Copyright 2001, 2002, 2005 Free Software Foundation, Inc. +Copyright 2001, 2002, 2005, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -24,8 +24,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" - /* change this to "#define TRACE(x) x" for diagnostics */ #define TRACE(x) @@ -52,20 +50,13 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ This property of F[4m+3] can be verified by induction on F[4m+3] = 7*F[4m-1] - F[4m-5], that formula being a standard lucas sequence identity U[i+j] = U[i]*V[j] - U[i-j]*Q^j. - - Enhancements: - - If there was an mpn_addlshift, it'd be possible to eliminate the yp - temporary, using xp=F[k]^2, fp=F[k-1]^2, f1p=xp+fp, fp+=4*fp, fp-=f1p, - fp+=2*(-1)^n, etc. */ +*/ mp_size_t mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n) { - mp_ptr xp, yp; mp_size_t size; unsigned long nfirst, mask; - TMP_DECL; TRACE (printf ("mpn_fib2_ui n=%lu\n", n)); @@ -85,15 +76,15 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n) if (mask != 1) { mp_size_t alloc; + mp_ptr xp; + TMP_DECL; TMP_MARK; alloc = MPN_FIB2_SIZE (n); - TMP_ALLOC_LIMBS_2 (xp,alloc, yp,alloc); + xp = TMP_ALLOC_LIMBS (alloc); do { - mp_limb_t c; - /* Here fp==F[k] and f1p==F[k-1], with k being the bits of n from n&mask upwards. @@ -114,45 +105,65 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n) /* f1p[size-1] might be zero, but this occurs rarely, so it's not worth bothering checking for it */ ASSERT (alloc >= 2*size); - mpn_sqr_n (xp, fp, size); - mpn_sqr_n (yp, f1p, size); + mpn_sqr (xp, fp, size); + mpn_sqr (fp, f1p, size); size *= 2; /* Shrink if possible. Since fp was normalized there'll be at most one high zero on xp (and if there is then there's one on yp too). */ - ASSERT (xp[size-1] != 0 || yp[size-1] == 0); + ASSERT (xp[size-1] != 0 || fp[size-1] == 0); size -= (xp[size-1] == 0); ASSERT (xp[size-1] != 0); /* only one xp high zero */ + /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2. */ + f1p[size] = mpn_add_n (f1p, xp, fp, size); + /* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k. n&mask is the low bit of our implied k. */ - c = mpn_lshift (fp, xp, size, 2); - fp[0] |= (n & mask ? 0 : 2); /* possible +2 */ - c -= mpn_sub_n (fp, fp, yp, size); - ASSERT (n & (mask << 1) ? fp[0] != 0 && fp[0] != 1 : 1); - fp[0] -= (n & mask ? 2 : 0); /* possible -2 */ +#if HAVE_NATIVE_mpn_rsblsh2_n || HAVE_NATIVE_mpn_rsblsh_n +#if HAVE_NATIVE_mpn_rsblsh2_n + fp[size] = mpn_rsblsh2_n (fp, fp, xp, size); +#else /* HAVE_NATIVE_mpn_rsblsh_n */ + fp[size] = mpn_rsblsh_n (fp, fp, xp, size, 2); +#endif + if ((n & mask) == 0) + MPN_INCR_U(fp, size + 1, 2); /* possible +2 */ + else + { + ASSERT (fp[0] >= 2); + fp[0] -= 2; /* possible -2 */ + } +#else + { + mp_limb_t c; + + c = mpn_lshift (xp, xp, size, 2); + xp[0] |= (n & mask ? 0 : 2); /* possible +2 */ + c -= mpn_sub_n (fp, xp, fp, size); + ASSERT (n & mask ? fp[0] != 0 && fp[0] != 1 : 1); + fp[0] -= (n & mask ? 2 : 0); /* possible -2 */ + fp[size] = c; + } +#endif ASSERT (alloc >= size+1); - xp[size] = 0; - yp[size] = 0; - fp[size] = c; - size += (c != 0); - - /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2. - F[2k-1]>= 1; /* Calculate F[2k] = F[2k+1] - F[2k-1], replacing the unwanted one of F[2k+1] and F[2k-1]. */ - ASSERT_NOCARRY (mpn_sub_n ((n & mask ? f1p : fp), fp, f1p, size)); - - /* Can have a high zero after replacing F[2k+1] with F[2k]. - f1p will have a high zero if fp does. */ - ASSERT (fp[size-1] != 0 || f1p[size-1] == 0); - size -= (fp[size-1] == 0); + if (n & mask) + ASSERT_NOCARRY (mpn_sub_n (f1p, fp, f1p, size)); + else { + ASSERT_NOCARRY (mpn_sub_n ( fp, fp, f1p, size)); + + /* Can have a high zero after replacing F[2k+1] with F[2k]. + f1p will have a high zero if fp does. */ + ASSERT (fp[size-1] != 0 || f1p[size-1] == 0); + size -= (fp[size-1] == 0); + } } while (mask != 1); diff --git a/contrib/gmp/mpn/generic/gcd_1.c b/contrib/gmp/mpn/generic/gcd_1.c index 73be15134c..ab16f4bb23 100644 --- a/contrib/gmp/mpn/generic/gcd_1.c +++ b/contrib/gmp/mpn/generic/gcd_1.c @@ -21,6 +21,17 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "longlong.h" +#ifndef GCD_1_METHOD +#define GCD_1_METHOD 2 +#endif + +#define USE_ZEROTAB 0 + +#if USE_ZEROTAB +static const unsigned char zerotab[16] = { + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 +}; +#endif /* Does not work for U == 0 or V == 0. It would be tough to make it work for V == 0 since gcd(x,0) = x, and U does not generally fit in an mp_limb_t. @@ -81,6 +92,10 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb) goto strip_u_maybe; } + ASSERT (ulimb & 1); + ASSERT (vlimb & 1); + +#if GCD_1_METHOD == 1 while (ulimb != vlimb) { ASSERT (ulimb & 1); @@ -109,6 +124,55 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb) while ((vlimb & 1) == 0); } } +#else +# if GCD_1_METHOD == 2 + + ulimb >>= 1; + vlimb >>= 1; + + while (ulimb != vlimb) + { + int c; + mp_limb_t t = ulimb - vlimb; + mp_limb_t vgtu = LIMB_HIGHBIT_TO_MASK (t); + + /* v <-- min (u, v) */ + vlimb += (vgtu & t); + + /* u <-- |u - v| */ + ulimb = (t ^ vgtu) - vgtu; + +#if USE_ZEROTAB + /* Number of trailing zeros is the same no matter if we look at + * t or ulimb, but using t gives more parallelism. */ + c = zerotab[t & 15]; + + while (UNLIKELY (c == 4)) + { + ulimb >>= 4; + if (0) + strip_u_maybe: + vlimb >>= 1; + + c = zerotab[ulimb & 15]; + } +#else + if (0) + { + strip_u_maybe: + vlimb >>= 1; + t = ulimb; + } + count_trailing_zeros (c, t); +#endif + ulimb >>= (c + 1); + } + + vlimb = (vlimb << 1) | 1; +# else +# error Unknown GCD_1_METHOD +# endif +#endif done: return vlimb << zero_bits; diff --git a/contrib/gmp/mpn/generic/gcdext.c b/contrib/gmp/mpn/generic/gcdext.c index 38487ae66d..d7078b3928 100644 --- a/contrib/gmp/mpn/generic/gcdext.c +++ b/contrib/gmp/mpn/generic/gcdext.c @@ -118,6 +118,7 @@ compute_v (mp_ptr vp, mpn_mul (tp, up, size, ap, an); size += an; + size -= tp[size - 1] == 0; ASSERT (gn <= size); @@ -146,21 +147,9 @@ compute_v (mp_ptr vp, vn = size + 1 - bn; ASSERT (vn <= n + 1); - /* FIXME: Use divexact. Or do the entire calculation mod 2^{n * - GMP_NUMB_BITS}. */ - mpn_tdiv_qr (vp, tp, 0, tp, size, bp, bn); + mpn_divexact (vp, tp, size, bp, bn); vn -= (vp[vn-1] == 0); - /* Remainder must be zero */ -#if WANT_ASSERT - { - mp_size_t i; - for (i = 0; i < bn; i++) - { - ASSERT (tp[i] == 0); - } - } -#endif return vn; } @@ -181,7 +170,8 @@ compute_v (mp_ptr vp, For the lehmer call after the loop, Let T denote GCDEXT_DC_THRESHOLD. For the gcdext_lehmer call, we need T each for u, a and b, and 4T+3 scratch space. Next, for compute_v, we need T - + 1 for v and 2T + 1 scratch space. In all, 7T + 3 is sufficient. + for u, T+1 for v and 2T + 1 scratch space. In all, 7T + 3 is + sufficient for both operations. */ diff --git a/contrib/gmp/mpn/generic/gcdext_1.c b/contrib/gmp/mpn/generic/gcdext_1.c index f1dd9ee963..3bb4d21df1 100644 --- a/contrib/gmp/mpn/generic/gcdext_1.c +++ b/contrib/gmp/mpn/generic/gcdext_1.c @@ -22,6 +22,242 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "longlong.h" +#ifndef GCDEXT_1_USE_BINARY +#define GCDEXT_1_USE_BINARY 0 +#endif + +#ifndef GCDEXT_1_BINARY_METHOD +#define GCDEXT_1_BINARY_METHOD 2 +#endif + +#ifndef USE_ZEROTAB +#define USE_ZEROTAB 1 +#endif + +#if GCDEXT_1_USE_BINARY + +#if USE_ZEROTAB +static unsigned char zerotab[0x40] = { + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 +}; +#endif + +mp_limb_t +mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp, + mp_limb_t u, mp_limb_t v) +{ + /* Maintain + + U = t1 u + t0 v + V = s1 u + s0 v + + where U, V are the inputs (without any shared power of two), + and the matris has determinant ± 2^{shift}. + */ + mp_limb_t s0 = 1; + mp_limb_t t0 = 0; + mp_limb_t s1 = 0; + mp_limb_t t1 = 1; + mp_limb_t ug; + mp_limb_t vg; + mp_limb_t ugh; + mp_limb_t vgh; + unsigned zero_bits; + unsigned shift; + unsigned i; +#if GCDEXT_1_BINARY_METHOD == 2 + mp_limb_t det_sign; +#endif + + ASSERT (u > 0); + ASSERT (v > 0); + + count_trailing_zeros (zero_bits, u | v); + u >>= zero_bits; + v >>= zero_bits; + + if ((u & 1) == 0) + { + count_trailing_zeros (shift, u); + u >>= shift; + t1 <<= shift; + } + else if ((v & 1) == 0) + { + count_trailing_zeros (shift, v); + v >>= shift; + s0 <<= shift; + } + else + shift = 0; + +#if GCDEXT_1_BINARY_METHOD == 1 + while (u != v) + { + unsigned count; + if (u > v) + { + u -= v; +#if USE_ZEROTAB + count = zerotab [u & 0x3f]; + u >>= count; + if (UNLIKELY (count == 6)) + { + unsigned c; + do + { + c = zerotab[u & 0x3f]; + u >>= c; + count += c; + } + while (c == 6); + } +#else + count_trailing_zeros (count, u); + u >>= count; +#endif + t0 += t1; t1 <<= count; + s0 += s1; s1 <<= count; + } + else + { + v -= u; +#if USE_ZEROTAB + count = zerotab [v & 0x3f]; + v >>= count; + if (UNLIKELY (count == 6)) + { + unsigned c; + do + { + c = zerotab[v & 0x3f]; + v >>= c; + count += c; + } + while (c == 6); + } +#else + count_trailing_zeros (count, v); + v >>= count; +#endif + t1 += t0; t0 <<= count; + s1 += s0; s0 <<= count; + } + shift += count; + } +#else +# if GCDEXT_1_BINARY_METHOD == 2 + u >>= 1; + v >>= 1; + + det_sign = 0; + + while (u != v) + { + unsigned count; + mp_limb_t d = u - v; + mp_limb_t vgtu = LIMB_HIGHBIT_TO_MASK (d); + mp_limb_t sx; + mp_limb_t tx; + + /* When v <= u (vgtu == 0), the updates are: + + (u; v) <-- ( (u - v) >> count; v) (det = +(1< 0, the updates are + + (u; v) <-- ( (v - u) >> count; u) (det = -(1<>= c; + c = zerotab[d & 0x3f]; + count += c; + } + while (c == 6); + } +#else + count_trailing_zeros (count, d); +#endif + det_sign ^= vgtu; + + tx = vgtu & (t0 - t1); + sx = vgtu & (s0 - s1); + t0 += t1; + s0 += s1; + t1 += tx; + s1 += sx; + + count++; + u >>= count; + t1 <<= count; + s1 <<= count; + shift += count; + } + u = (u << 1) + 1; +# else /* GCDEXT_1_BINARY_METHOD == 2 */ +# error Unknown GCDEXT_1_BINARY_METHOD +# endif +#endif + + /* Now u = v = g = gcd (u,v). Compute U/g and V/g */ + ug = t0 + t1; + vg = s0 + s1; + + ugh = ug/2 + (ug & 1); + vgh = vg/2 + (vg & 1); + + /* Now ±2^{shift} g = s0 U - t0 V. Get rid of the power of two, using + s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */ + for (i = 0; i < shift; i++) + { + mp_limb_t mask = - ( (s0 | t0) & 1); + + s0 /= 2; + t0 /= 2; + s0 += mask & vgh; + t0 += mask & ugh; + } + /* FIXME: Try simplifying this condition. */ + if ( (s0 > 1 && 2*s0 >= vg) || (t0 > 1 && 2*t0 >= ug) ) + { + s0 -= vg; + t0 -= ug; + } +#if GCDEXT_1_BINARY_METHOD == 2 + /* Conditional negation. */ + s0 = (s0 ^ det_sign) - det_sign; + t0 = (t0 ^ det_sign) - det_sign; +#endif + *sp = s0; + *tp = -t0; + + return u << zero_bits; +} + +#else /* !GCDEXT_1_USE_BINARY */ + /* FIXME: Takes two single-word limbs. It could be extended to a * function that accepts a bignum for the first input, and only @@ -79,3 +315,4 @@ mpn_gcdext_1 (mp_limb_signed_t *up, mp_limb_signed_t *vp, v1 -= q * v0; } } +#endif /* !GCDEXT_1_USE_BINARY */ diff --git a/contrib/gmp/mpn/generic/get_d.c b/contrib/gmp/mpn/generic/get_d.c index cf4ae86efc..fdb6e70562 100644 --- a/contrib/gmp/mpn/generic/get_d.c +++ b/contrib/gmp/mpn/generic/get_d.c @@ -4,7 +4,7 @@ CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES. -Copyright 2003, 2004 Free Software Foundation, Inc. +Copyright 2003, 2004, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -124,10 +124,10 @@ static volatile const long CONST_NEG_1022_SUB_53 = -1022 - 53; Other: For reference, note that HPPA 8000, 8200, 8500 and 8600 trap FCNV,UDW,DBL - to the kernel for values >= 2^63. This makes it slow, and worse the - Linux kernel (what versions?) apparently uses untested code in its trap - handling routines, and gets the sign wrong. We don't use such a limb to - double cast, neither in the IEEE or generic code. */ + to the kernel for values >= 2^63. This makes it slow, and worse the kernel + Linux (what versions?) apparently uses untested code in its trap handling + routines, and gets the sign wrong. We don't use such a limb-to-double + cast, neither in the IEEE or generic code. */ double diff --git a/contrib/gmp/mpn/generic/get_str.c b/contrib/gmp/mpn/generic/get_str.c index df007578cc..ac4fb52a95 100644 --- a/contrib/gmp/mpn/generic/get_str.c +++ b/contrib/gmp/mpn/generic/get_str.c @@ -382,7 +382,7 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un) int bit_pos; mp_size_t i; unsigned char *s = str; - unsigned long bits; + mp_bitcnt_t bits; n1 = up[un - 1]; count_leading_zeros (cnt, n1); @@ -391,11 +391,11 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un) R + bits_per_digit * n when input ends in nth least significant nibble. */ - bits = GMP_NUMB_BITS * un - cnt + GMP_NAIL_BITS; + bits = (mp_bitcnt_t) GMP_NUMB_BITS * un - cnt + GMP_NAIL_BITS; cnt = bits % bits_per_digit; if (cnt != 0) bits += bits_per_digit - cnt; - bit_pos = bits - (un - 1) * GMP_NUMB_BITS; + bit_pos = bits - (mp_bitcnt_t) (un - 1) * GMP_NUMB_BITS; /* Fast loop for bit output. */ i = un - 1; @@ -473,7 +473,7 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un) ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_get_str_powtab_alloc (un)); - mpn_sqr_n (t, p, n); + mpn_sqr (t, p, n); digits_in_base *= 2; n *= 2; n -= t[n - 1] == 0; diff --git a/contrib/gmp/mpn/generic/gmp-mparam.h b/contrib/gmp/mpn/generic/gmp-mparam.h index b22b96ef67..aab5fa510e 100644 --- a/contrib/gmp/mpn/generic/gmp-mparam.h +++ b/contrib/gmp/mpn/generic/gmp-mparam.h @@ -18,5 +18,5 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* Values for BITS_PER_MP_LIMB etc will be determined by ./configure and put +/* Values for GMP_LIMB_BITS etc will be determined by ./configure and put in config.h. */ diff --git a/contrib/gmp/mpn/generic/hgcd.c b/contrib/gmp/mpn/generic/hgcd.c index 5fc650bbd9..d25fdaa0ca 100644 --- a/contrib/gmp/mpn/generic/hgcd.c +++ b/contrib/gmp/mpn/generic/hgcd.c @@ -383,7 +383,7 @@ mpn_hgcd_lehmer (mp_ptr ap, mp_ptr bp, mp_size_t n, } } -/* Multiply M by M1 from the right. Needs 4*(M->n + M1->n) + 5 limbs +/* Multiply M by M1 from the right. Needs 3*(M->n + M1->n) + 5 limbs of temporary storage (see mpn_matrix22_mul_itch). */ void mpn_hgcd_matrix_mul (struct hgcd_matrix *M, const struct hgcd_matrix *M1, @@ -395,7 +395,13 @@ mpn_hgcd_matrix_mul (struct hgcd_matrix *M, const struct hgcd_matrix *M1, are > 0, no element can decrease. The new elements are of size M->n + M1->n, one limb more or less. The computation of the matrix product produces elements of size M->n + M1->n + 1. But - the true size, after normalization, may be three limbs smaller. */ + the true size, after normalization, may be three limbs smaller. + + The reason that the product has normalized size >= M->n + M1->n - + 2 is subtle. It depends on the fact that M and M1 can be factored + as products of (1,1; 0,1) and (1,0; 1,1), and that we can't have + M ending with a large power and M1 starting with a large power of + the same matrix. */ /* FIXME: Strassen multiplication gives only a small speedup. In FFT multiplication range, this function could be sped up quite a lot @@ -505,16 +511,15 @@ mpn_hgcd_matrix_adjust (struct hgcd_matrix *M, Let S(r) denote the required storage. For M1 we need 4 * (ceil(n1/2) + 1) = 4 * (ceil(n/4) + 1), for the hgcd_matrix_adjust call, we need n + 2, - and for the hgcd_matrix_mul, we may need 4 ceil(n/2) + 1. In total, - 4 * ceil(n/4) + 4 ceil(n/2) + 5 <= 12 ceil(n/4) + 5. + and for the hgcd_matrix_mul, we may need 3 ceil(n/2) + 8. In total, + 4 * ceil(n/4) + 3 ceil(n/2) + 12 <= 10 ceil(n/4) + 12. For the recursive call, we need S(n1) = S(ceil(n/2)). - S(n) <= 12*ceil(n/4) + 5 + S(ceil(n/2)) - <= 12*(ceil(n/4) + ... + ceil(n/2^(1+k))) + 5k + S(ceil(n/2^k)) - <= 12*(2 ceil(n/4) + k) + 5k + S(n/2^k) - <= 24 ceil(n/4) + 17k + S(n/2^k) - + S(n) <= 10*ceil(n/4) + 12 + S(ceil(n/2)) + <= 10*(ceil(n/4) + ... + ceil(n/2^(1+k))) + 12k + S(ceil(n/2^k)) + <= 10*(2 ceil(n/4) + k) + 12k + S(ceil(n/2^k)) + <= 20 ceil(n/4) + 22k + S(ceil(n/2^k)) */ mp_size_t @@ -532,7 +537,7 @@ mpn_hgcd_itch (mp_size_t n) count_leading_zeros (count, nscaled); k = GMP_LIMB_BITS - count; - return 24 * ((n+3) / 4) + 17 * k + return 20 * ((n+3) / 4) + 22 * k + MPN_HGCD_LEHMER_ITCH (HGCD_THRESHOLD); } @@ -607,7 +612,18 @@ mpn_hgcd (mp_ptr ap, mp_ptr bp, mp_size_t n, /* Needs 2 (p + M->n) <= 2 (2*s - n2 + 1 + n2 - s - 1) = 2*s <= 2*(floor(n/2) + 1) <= n + 2. */ n = mpn_hgcd_matrix_adjust (&M1, p + nn, ap, bp, p, tp + scratch); - /* Needs 4 ceil(n/2) + 1 */ + + /* We need a bound for of M->n + M1.n. Let n be the original + input size. Then + + ceil(n/2) - 1 >= size of product >= M.n + M1.n - 2 + + and it follows that + + M.n + M1.n <= ceil(n/2) + 1 + + Then 3*(M.n + M1.n) + 5 <= 3 * ceil(n/2) + 8 is the + amount of needed scratch space. */ mpn_hgcd_matrix_mul (M, &M1, tp + scratch); success = 1; } diff --git a/contrib/gmp/mpn/generic/invert.c b/contrib/gmp/mpn/generic/invert.c index e40d3611e6..dda2500943 100644 --- a/contrib/gmp/mpn/generic/invert.c +++ b/contrib/gmp/mpn/generic/invert.c @@ -1,6 +1,12 @@ -/* Compute {up,n}^(-1). +/* invert.c -- Compute floor((B^{2n}-1)/U) - B^n. -Copyright (C) 2007 Free Software Foundation, Inc. + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -17,44 +23,65 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#include +/* FIXME: Remove NULL and TMP_*, as soon as all the callers properly + allocate and pass the scratch to the function. */ +#include /* for NULL */ + #include "gmp.h" #include "gmp-impl.h" - -/* Formulas: - z = 2z-(zz)d - z = 2z-(zd)z - z = z(2-zd) - z = z-z*(zd-1) - z = z+z*(1-zd) -*/ - -mp_size_t -mpn_invert_itch (mp_size_t n) -{ - return 3 * n + 2; -} +#include "longlong.h" void mpn_invert (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch) { - mp_ptr np, rp; - mp_size_t i; - TMP_DECL; + ASSERT (n > 0); + ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT); + ASSERT (! MPN_OVERLAP_P (ip, n, dp, n)); + ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n))); + ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n))); + + if (n == 1) + invert_limb (*ip, *dp); + else { + TMP_DECL; - TMP_MARK; - if (scratch == NULL) - { + TMP_MARK; + if (scratch == NULL) scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (n)); - } - np = scratch; /* 2 * n limbs */ - rp = scratch + 2 * n; /* n + 2 limbs */ - for (i = n - 1; i >= 0; i--) - np[i] = ~CNST_LIMB(0); - mpn_com_n (np + n, dp, n); - mpn_tdiv_qr (rp, ip, 0L, np, 2 * n, dp, n); - MPN_COPY (ip, rp, n); + if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD)) + { + /* Maximum scratch needed by this branch: 2*n */ + mp_size_t i; + mp_ptr xp; - TMP_FREE; + xp = scratch; /* 2 * n limbs */ + for (i = n - 1; i >= 0; i--) + xp[i] = GMP_NUMB_MAX; + mpn_com (xp + n, dp, n); + if (n == 2) { + mpn_divrem_2 (ip, 0, xp, 4, dp); + } else { + gmp_pi1_t inv; + invert_pi1 (inv, dp[n-1], dp[n-2]); + /* FIXME: should we use dcpi1_div_q, for big sizes? */ + mpn_sbpi1_div_q (ip, xp, 2 * n, dp, n, inv.inv32); + } + } + else { /* Use approximated inverse; correct the result if needed. */ + mp_limb_t e; /* The possible error in the approximate inverse */ + + ASSERT ( mpn_invert_itch (n) >= mpn_invertappr_itch (n) ); + e = mpn_ni_invertappr (ip, dp, n, scratch); + + if (e) { /* Assume the error can only be "0" (no error) or "1". */ + /* Code to detect and correct the "off by one" approximation. */ + mpn_mul_n (scratch, ip, dp, n); + ASSERT_NOCARRY (mpn_add_n (scratch + n, scratch + n, dp, n)); + if (! mpn_add (scratch, scratch, 2*n, dp, n)) + MPN_INCR_U (ip, n, 1); /* The value was wrong, correct it. */ + } + } + TMP_FREE; + } } diff --git a/contrib/gmp/mpn/generic/invertappr.c b/contrib/gmp/mpn/generic/invertappr.c new file mode 100644 index 0000000000..8064956298 --- /dev/null +++ b/contrib/gmp/mpn/generic/invertappr.c @@ -0,0 +1,311 @@ +/* mpn_invertappr and helper functions. Compute I such that + floor((B^{2n}-1)/U - 1 <= I + B^n <= floor((B^{2n}-1)/U. + + Contributed to the GNU project by Marco Bodrato. + + The algorithm used here was inspired by ApproximateReciprocal from "Modern + Computer Arithmetic", by Richard P. Brent and Paul Zimmermann. Special + thanks to Paul Zimmermann for his very valuable suggestions on all the + theoretical aspects during the work on this code. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +/* FIXME: Remove NULL and TMP_*, as soon as all the callers properly + allocate and pass the scratch to the function. */ +#include /* for NULL */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +/* FIXME: The iterative version splits the operand in two slighty unbalanced + parts, the use of log_2 (or counting the bits) underestimate the maximum + number of iterations. */ + +/* This is intended for constant THRESHOLDs only, where the compiler + can completely fold the result. */ +#define LOG2C(n) \ + (((n) >= 0x1) + ((n) >= 0x2) + ((n) >= 0x4) + ((n) >= 0x8) + \ + ((n) >= 0x10) + ((n) >= 0x20) + ((n) >= 0x40) + ((n) >= 0x80) + \ + ((n) >= 0x100) + ((n) >= 0x200) + ((n) >= 0x400) + ((n) >= 0x800) + \ + ((n) >= 0x1000) + ((n) >= 0x2000) + ((n) >= 0x4000) + ((n) >= 0x8000)) + +#if TUNE_PROGRAM_BUILD +#define NPOWS \ + ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t))) +#define MAYBE_dcpi1_divappr 1 +#else +#define NPOWS \ + ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)) - LOG2C (INV_NEWTON_THRESHOLD)) +#define MAYBE_dcpi1_divappr \ + (INV_NEWTON_THRESHOLD < DC_DIVAPPR_Q_THRESHOLD) +#if (INV_NEWTON_THRESHOLD > INV_MULMOD_BNM1_THRESHOLD) && \ + (INV_APPR_THRESHOLD > INV_MULMOD_BNM1_THRESHOLD) +#undef INV_MULMOD_BNM1_THRESHOLD +#define INV_MULMOD_BNM1_THRESHOLD 0 /* always when Newton */ +#endif +#endif + +/* All the three functions mpn{,_bc,_ni}_invertappr (ip, dp, n, scratch), take + the strictly normalised value {dp,n} (i.e., most significant bit must be set) + as an input, and compute {ip,n}: the approximate reciprocal of {dp,n}. + + Let e = mpn*_invertappr (ip, dp, n, scratch) be the returned value; the + following conditions are satisfied by the output: + 0 <= e <= 1; + {dp,n}*(B^n+{ip,n}) < B^{2n} <= {dp,n}*(B^n+{ip,n}+1+e) . + I.e. e=0 means that the result {ip,n} equals the one given by mpn_invert. + e=1 means that the result _may_ be one less than expected. + + The _bc version returns e=1 most of the time. + The _ni version should return e=0 most of the time; only about 1% of + possible random input should give e=1. + + When the strict result is needed, i.e., e=0 in the relation above: + {dp,n}*(B^n+{ip,n}) < B^{2n} <= {dp,n}*(B^n+{ip,n}+1) ; + the function mpn_invert (ip, dp, n, scratch) should be used instead. */ + +/* Maximum scratch needed by this branch (at tp): 3*n + 2 */ +static mp_limb_t +mpn_bc_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr tp) +{ + mp_ptr xp; + + ASSERT (n > 0); + ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT); + ASSERT (! MPN_OVERLAP_P (ip, n, dp, n)); + ASSERT (! MPN_OVERLAP_P (ip, n, tp, mpn_invertappr_itch(n))); + ASSERT (! MPN_OVERLAP_P (dp, n, tp, mpn_invertappr_itch(n))); + + /* Compute a base value of r limbs. */ + if (n == 1) + invert_limb (*ip, *dp); + else { + mp_size_t i; + xp = tp + n + 2; /* 2 * n limbs */ + + for (i = n - 1; i >= 0; i--) + xp[i] = GMP_NUMB_MAX; + mpn_com (xp + n, dp, n); + + /* Now xp contains B^2n - {dp,n}*B^n - 1 */ + + /* FIXME: if mpn_*pi1_divappr_q handles n==2, use it! */ + if (n == 2) { + mpn_divrem_2 (ip, 0, xp, 4, dp); + } else { + gmp_pi1_t inv; + invert_pi1 (inv, dp[n-1], dp[n-2]); + if (! MAYBE_dcpi1_divappr + || BELOW_THRESHOLD (n, DC_DIVAPPR_Q_THRESHOLD)) + mpn_sbpi1_divappr_q (ip, xp, 2 * n, dp, n, inv.inv32); + else + mpn_dcpi1_divappr_q (ip, xp, 2 * n, dp, n, &inv); + MPN_DECR_U(ip, n, 1); + return 1; + } + } + return 0; +} + +/* mpn_ni_invertappr: computes the approximate reciprocal using Newton's + iterations (at least one). + + Inspired by Algorithm "ApproximateReciprocal", published in "Modern Computer + Arithmetic" by Richard P. Brent and Paul Zimmermann, algorithm 3.5, page 121 + in version 0.4 of the book. + + Some adaptations were introduced, to allow product mod B^m-1 and return the + value e. + + USE_MUL_N = 1 (default) introduces a correction in such a way that "the + value of B^{n+h}-T computed at step 8 cannot exceed B^n-1" (the book reads + "2B^n-1"). This correction should not require to modify the proof. + + We use a wrapped product modulo B^m-1. NOTE: is there any normalisation + problem for the [0] class? It shouldn't: we compute 2*|A*X_h - B^{n+h}| < + B^m-1. We may get [0] if and only if we get AX_h = B^{n+h}. This can + happen only if A=B^{n}/2, but this implies X_h = B^{h}*2-1 i.e., AX_h = + B^{n+h} - A, then we get into the "negative" branch, where X_h is not + incremented (because A < B^n). + + FIXME: the scratch for mulmod_bnm1 does not currently fit in the scratch, it + is allocated apart. */ + +#define USE_MUL_N 1 + +mp_limb_t +mpn_ni_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch) +{ + mp_limb_t cy; + mp_ptr xp; + mp_size_t rn, mn; + mp_size_t sizes[NPOWS], *sizp; + mp_ptr tp; + TMP_DECL; +#define rp scratch + + ASSERT (n > 2); + ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT); + ASSERT (! MPN_OVERLAP_P (ip, n, dp, n)); + ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n))); + ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n))); + + /* Compute the computation precisions from highest to lowest, leaving the + base case size in 'rn'. */ + sizp = sizes; + rn = n; + do { + *sizp = rn; + rn = ((rn) >> 1) + 1; + sizp ++; + } while (ABOVE_THRESHOLD (rn, INV_NEWTON_THRESHOLD)); + + /* We search the inverse of 0.{dp,n}, we compute it as 1.{ip,n} */ + dp += n; + ip += n; + + /* Compute a base value of rn limbs. */ + mpn_bc_invertappr (ip - rn, dp - rn, rn, scratch); + + TMP_MARK; + + if (ABOVE_THRESHOLD (n, INV_MULMOD_BNM1_THRESHOLD)) + { + mn = mpn_mulmod_bnm1_next_size (n + 1); + tp = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (mn, n, (n >> 1) + 1)); + } + /* Use Newton's iterations to get the desired precision.*/ + + /* define rp scratch; 2rn + 1 limbs <= 2(n>>1 + 1) + 1 <= n + 3 limbs */ + /* Maximum scratch needed by this branch <= 3*n + 2 */ + xp = scratch + n + 3; /* n + rn limbs */ + while (1) { + mp_limb_t method; + + n = *--sizp; + /* + v n v + +----+--+ + ^ rn ^ + */ + + /* Compute i_jd . */ + if (BELOW_THRESHOLD (n, INV_MULMOD_BNM1_THRESHOLD) + || ((mn = mpn_mulmod_bnm1_next_size (n + 1)) > (n + rn))) { + /* FIXME: We do only need {xp,n+1}*/ + mpn_mul (xp, dp - n, n, ip - rn, rn); + mpn_add_n (xp + rn, xp + rn, dp - n, n - rn + 1); + method = 1; /* Remember we used (truncated) product */ + /* We computed cy.{xp,rn+n} <- 1.{ip,rn} * 0.{dp,n} */ + } else { /* Use B^n-1 wraparound */ + mpn_mulmod_bnm1 (xp, mn, dp - n, n, ip - rn, rn, tp); + /* We computed {xp,mn} <- {ip,rn} * {dp,n} mod (B^mn-1) */ + /* We know that 2*|ip*dp + dp*B^rn - B^{rn+n}| < B^mn-1 */ + /* Add dp*B^rn mod (B^mn-1) */ + ASSERT (n >= mn - rn); + xp[mn] = 1 + mpn_add_n (xp + rn, xp + rn, dp - n, mn - rn); + cy = mpn_add_n (xp, xp, dp - (n - (mn - rn)), n - (mn - rn)); + MPN_INCR_U (xp + n - (mn - rn), mn + 1 - n + (mn - rn), cy); + ASSERT (n + rn >= mn); + /* Subtract B^{rn+n} */ + MPN_DECR_U (xp + rn + n - mn, 2*mn + 1 - rn - n, 1); + if (xp[mn]) + MPN_INCR_U (xp, mn, xp[mn] - 1); + else + MPN_DECR_U (xp, mn, 1); + method = 0; /* Remember we are working Mod B^m-1 */ + } + + if (xp[n] < 2) { /* "positive" residue class */ + cy = 1; + while (xp[n] || mpn_cmp (xp, dp - n, n)>0) { + xp[n] -= mpn_sub_n (xp, xp, dp - n, n); + cy ++; + } + MPN_DECR_U(ip - rn, rn, cy); + ASSERT (cy <= 4); /* at most 3 cycles for the while above */ + ASSERT_NOCARRY (mpn_sub_n (xp, dp - n, xp, n)); + ASSERT (xp[n] == 0); + } else { /* "negative" residue class */ + mpn_com (xp, xp, n + 1); + MPN_INCR_U(xp, n + 1, method); + ASSERT (xp[n] <= 1); +#if USE_MUL_N + if (xp[n]) { + MPN_INCR_U(ip - rn, rn, 1); + ASSERT_CARRY (mpn_sub_n (xp, xp, dp - n, n)); + } +#endif + } + + /* Compute x_ju_j. FIXME:We need {rp+rn,rn}, mulhi? */ +#if USE_MUL_N + mpn_mul_n (rp, xp + n - rn, ip - rn, rn); +#else + rp[2*rn] = 0; + mpn_mul (rp, xp + n - rn, rn + xp[n], ip - rn, rn); +#endif + /* We need _only_ the carry from the next addition */ + /* Anyway 2rn-n <= 2... we don't need to optimise. */ + cy = mpn_add_n (rp + rn, rp + rn, xp + n - rn, 2*rn - n); + cy = mpn_add_nc (ip - n, rp + 3*rn - n, xp + rn, n - rn, cy); + MPN_INCR_U (ip - rn, rn, cy + (1-USE_MUL_N)*(rp[2*rn] + xp[n])); + if (sizp == sizes) { /* Get out of the cycle */ + /* Check for possible carry propagation from below. */ + cy = rp[3*rn - n - 1] > GMP_NUMB_MAX - 7; /* Be conservative. */ +/* cy = mpn_add_1 (rp + rn, rp + rn, 2*rn - n, 4); */ + break; + } + rn = n; + } + TMP_FREE; + + return cy; +#undef rp +} + +mp_limb_t +mpn_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch) +{ + mp_limb_t res; + TMP_DECL; + + TMP_MARK; + + if (scratch == NULL) + scratch = TMP_ALLOC_LIMBS (mpn_invertappr_itch (n)); + + ASSERT (n > 0); + ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT); + ASSERT (! MPN_OVERLAP_P (ip, n, dp, n)); + ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n))); + ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n))); + + if (BELOW_THRESHOLD (n, INV_NEWTON_THRESHOLD)) + res = mpn_bc_invertappr (ip, dp, n, scratch); + else + res = mpn_ni_invertappr (ip, dp, n, scratch); + + TMP_FREE; + return res; +} diff --git a/contrib/gmp/mpn/generic/logops_n.c b/contrib/gmp/mpn/generic/logops_n.c new file mode 100644 index 0000000000..618efe5937 --- /dev/null +++ b/contrib/gmp/mpn/generic/logops_n.c @@ -0,0 +1,67 @@ +/* mpn_and_n, mpn_ior_n, etc -- mpn logical operations. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +#ifdef OPERATION_and_n +#define func __MPN(and_n) +#define call mpn_and_n +#endif + +#ifdef OPERATION_andn_n +#define func __MPN(andn_n) +#define call mpn_andn_n +#endif + +#ifdef OPERATION_nand_n +#define func __MPN(nand_n) +#define call mpn_nand_n +#endif + +#ifdef OPERATION_ior_n +#define func __MPN(ior_n) +#define call mpn_ior_n +#endif + +#ifdef OPERATION_iorn_n +#define func __MPN(iorn_n) +#define call mpn_iorn_n +#endif + +#ifdef OPERATION_nior_n +#define func __MPN(nior_n) +#define call mpn_nior_n +#endif + +#ifdef OPERATION_xor_n +#define func __MPN(xor_n) +#define call mpn_xor_n +#endif + +#ifdef OPERATION_xnor_n +#define func __MPN(xnor_n) +#define call mpn_xnor_n +#endif + +void +func (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) +{ + call (rp, up, vp, n); +} diff --git a/contrib/gmp/mpn/generic/lshiftc.c b/contrib/gmp/mpn/generic/lshiftc.c new file mode 100644 index 0000000000..80c1efe10a --- /dev/null +++ b/contrib/gmp/mpn/generic/lshiftc.c @@ -0,0 +1,63 @@ +/* mpn_lshiftc -- Shift left low level with complement. + +Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2009 Free Software Foundation, +Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +/* Shift U (pointed to by up and n limbs long) cnt bits to the left + and store the n least significant limbs of the result at rp. + Return the bits shifted out from the most significant limb. + + Argument constraints: + 1. 0 < cnt < GMP_NUMB_BITS. + 2. If the result is to be written over the input, rp must be >= up. +*/ + +mp_limb_t +mpn_lshiftc (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt) +{ + mp_limb_t high_limb, low_limb; + unsigned int tnc; + mp_size_t i; + mp_limb_t retval; + + ASSERT (n >= 1); + ASSERT (cnt >= 1); + ASSERT (cnt < GMP_NUMB_BITS); + ASSERT (MPN_SAME_OR_DECR_P (rp, up, n)); + + up += n; + rp += n; + + tnc = GMP_NUMB_BITS - cnt; + low_limb = *--up; + retval = low_limb >> tnc; + high_limb = (low_limb << cnt); + + for (i = n - 1; i != 0; i--) + { + low_limb = *--up; + *--rp = (~(high_limb | (low_limb >> tnc))) & GMP_NUMB_MASK; + high_limb = low_limb << cnt; + } + *--rp = (~high_limb) & GMP_NUMB_MASK; + + return retval; +} diff --git a/contrib/gmp/mpn/generic/matrix22_mul.c b/contrib/gmp/mpn/generic/matrix22_mul.c index f979385d9d..7e710d2a1d 100644 --- a/contrib/gmp/mpn/generic/matrix22_mul.c +++ b/contrib/gmp/mpn/generic/matrix22_mul.c @@ -1,10 +1,12 @@ /* matrix22_mul.c. + Contributed by Niels Möller and Marco Bodrato. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2003, 2004, 2005, 2008 Free Software Foundation, Inc. +Copyright 2003, 2004, 2005, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -70,143 +72,198 @@ mpn_matrix22_mul_itch (mp_size_t rn, mp_size_t mn) || BELOW_THRESHOLD (mn, MATRIX22_STRASSEN_THRESHOLD)) return 3*rn + 2*mn; else - return 4*(rn + mn) + 5; + return 3*(rn + mn) + 5; } /* Algorithm: / s0 \ / 1 0 0 0 \ / r0 \ - | s1 | | 0 1 0 0 | | r1 | - | s2 | | 0 0 1 1 | | r2 | - | s3 | = | -1 0 1 1 | \ r3 / - | s4 | | 1 0 -1 0 | - | s5 | | 1 1 -1 -1 | - \ s6 / \ 0 0 0 1 / + | s1 | | 0 1 0 1 | | r1 | + | s2 | | 0 0 -1 1 | | r2 | + | s3 | = | 0 1 -1 1 | \ r3 / + | s4 | | -1 1 -1 1 | + | s5 | | 0 1 0 0 | + \ s6 / \ 0 0 1 0 / / t0 \ / 1 0 0 0 \ / m0 \ - | t1 | | 0 0 1 0 | | m1 | - | t2 | | -1 1 0 0 | | m2 | - | t3 | = | 1 -1 0 1 | \ m3 / - | t4 | | 0 -1 0 1 | - | t5 | | 0 0 0 1 | - \ t6 / \ -1 1 1 -1 / - - / r0 \ / 1 1 0 0 0 0 0 \ / s0 * t0 \ - | r1 | = | 1 0 1 1 0 1 0 | | s1 * t1 | - | r2 | | 1 0 0 1 1 0 1 | | s2 * t2 | - \ r3 / \ 1 0 1 1 1 0 0 / | s3 * t3 | - | s4 * t4 | - | s5 * t5 | - \ s6 * t6 / + | t1 | | 0 1 0 1 | | m1 | + | t2 | | 0 0 -1 1 | | m2 | + | t3 | = | 0 1 -1 1 | \ m3 / + | t4 | | -1 1 -1 1 | + | t5 | | 0 1 0 0 | + \ t6 / \ 0 0 1 0 / + + Note: the two matrices above are the same, but s_i and t_i are used + in the same product, only for i<4, see "A Strassen-like Matrix + Multiplication suited for squaring and higher power computation" by + M. Bodrato, in Proceedings of ISSAC 2010. + + / r0 \ / 1 0 0 0 0 1 0 \ / s0*t0 \ + | r1 | = | 0 0 -1 1 -1 1 0 | | s1*t1 | + | r2 | | 0 1 0 -1 0 -1 -1 | | s2*t2 | + \ r3 / \ 0 1 1 -1 0 -1 0 / | s3*t3 | + | s4*t5 | + | s5*t6 | + \ s6*t4 / + + The scheduling uses two temporaries U0 and U1 to store products, and + two, S0 and T0, to store combinations of entries of the two + operands. */ /* Computes R = R * M. Elements are numbers R = (r0, r1; r2, r3). * * Resulting elements are of size up to rn + mn + 1. * - * Temporary storage: 4 rn + 4 mn + 5. */ + * Temporary storage: 3 rn + 3 mn + 5. */ void mpn_matrix22_mul_strassen (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t rn, mp_srcptr m0, mp_srcptr m1, mp_srcptr m2, mp_srcptr m3, mp_size_t mn, mp_ptr tp) { - mp_ptr s2, s3, t2, t3, u0, u1; - int r2s, r3s, s3s, t2s, t3s, u0s, u1s; - s2 = tp; tp += rn; - s3 = tp; tp += rn + 1; - t2 = tp; tp += mn; - t3 = tp; tp += mn + 1; + mp_ptr s0, t0, u0, u1; + int r1s, r3s, s0s, t0s, u1s; + s0 = tp; tp += rn + 1; + t0 = tp; tp += mn + 1; u0 = tp; tp += rn + mn + 1; u1 = tp; /* rn + mn + 2 */ - MUL (u0, r0, rn, m0, mn); /* 0 */ - MUL (u1, r1, rn, m2, mn); /* 1 */ - - MPN_COPY (s2, r3, rn); - - r3[rn] = mpn_add_n (r3, r3, r2, rn); - r0[rn] = 0; - s3s = abs_sub_n (s3, r3, r0, rn + 1); - t2s = abs_sub_n (t2, m1, m0, mn); - if (t2s) + MUL (u0, r1, rn, m2, mn); /* u5 = s5 * t6 */ + r3s = abs_sub_n (r3, r3, r2, rn); /* r3 - r2 */ + if (r3s) { - t3[mn] = mpn_add_n (t3, m3, t2, mn); - t3s = 0; + r1s = abs_sub_n (r1, r1, r3, rn); + r1[rn] = 0; } else { - t3s = abs_sub_n (t3, m3, t2, mn); - t3[mn] = 0; + r1[rn] = mpn_add_n (r1, r1, r3, rn); + r1s = 0; /* r1 - r2 + r3 */ } - - r2s = abs_sub_n (r2, r0, r2, rn); + if (r1s) + { + s0[rn] = mpn_add_n (s0, r1, r0, rn); + s0s = 0; + } + else if (r1[rn] != 0) + { + s0[rn] = r1[rn] - mpn_sub_n (s0, r1, r0, rn); + s0s = 1; /* s4 = -r0 + r1 - r2 + r3 */ + /* Reverse sign! */ + } + else + { + s0s = abs_sub_n (s0, r0, r1, rn); + s0[rn] = 0; + } + MUL (u1, r0, rn, m0, mn); /* u0 = s0 * t0 */ r0[rn+mn] = mpn_add_n (r0, u0, u1, rn + mn); + ASSERT (r0[rn+mn] < 2); /* u0 + u5 */ - MUL(u1, s3, rn+1, t3, mn+1); /* 3 */ - u1s = s3s ^ t3s; - ASSERT (u1[rn+mn+1] == 0); - ASSERT (u1[rn+mn] < 4); + t0s = abs_sub_n (t0, m3, m2, mn); + u1s = r3s^t0s^1; /* Reverse sign! */ + MUL (u1, r3, rn, t0, mn); /* u2 = s2 * t2 */ + u1[rn+mn] = 0; + if (t0s) + { + t0s = abs_sub_n (t0, m1, t0, mn); + t0[mn] = 0; + } + else + { + t0[mn] = mpn_add_n (t0, t0, m1, mn); + } - if (u1s) + /* FIXME: Could be simplified if we had space for rn + mn + 2 limbs + at r3. I'd expect that for matrices of random size, the high + words t0[mn] and r1[rn] are non-zero with a pretty small + probability. If that can be confirmed this should be done as an + unconditional rn x (mn+1) followed by an if (UNLIKELY (r1[rn])) + add_n. */ + if (t0[mn] != 0) { - u0[rn+mn] = 0; - u0s = abs_sub_n (u0, u0, u1, rn + mn + 1); + MUL (r3, r1, rn, t0, mn + 1); /* u3 = s3 * t3 */ + ASSERT (r1[rn] < 2); + if (r1[rn] != 0) + mpn_add_n (r3 + rn, r3 + rn, t0, mn + 1); } else { - u0[rn+mn] = u1[rn+mn] + mpn_add_n (u0, u0, u1, rn + mn); - u0s = 0; + MUL (r3, r1, rn + 1, t0, mn); } - MUL(u1, r3, rn + 1, t2, mn); /* 2 */ - u1s = t2s; - ASSERT (u1[rn+mn] < 2); - u1s = add_signed_n (u1, u0, u0s, u1, u1s, rn + mn + 1); + ASSERT (r3[rn+mn] < 4); - t2s = abs_sub_n (t2, m3, m1, mn); - if (s3s) + u0[rn+mn] = 0; + if (r1s^t0s) { - s3[rn] += mpn_add_n (s3, s3, r1, rn); - s3s = 0; + r3s = abs_sub_n (r3, u0, r3, rn + mn + 1); } - else if (s3[rn] > 0) + else { - s3[rn] -= mpn_sub_n (s3, s3, r1, rn); - s3s = 1; + ASSERT_NOCARRY (mpn_add_n (r3, r3, u0, rn + mn + 1)); + r3s = 0; /* u3 + u5 */ + } + + if (t0s) + { + t0[mn] = mpn_add_n (t0, t0, m0, mn); + } + else if (t0[mn] != 0) + { + t0[mn] -= mpn_sub_n (t0, t0, m0, mn); } else { - s3s = abs_sub_n (s3, r1, s3, rn); + t0s = abs_sub_n (t0, t0, m0, mn); } - MUL (r1, s3, rn+1, m3, mn); /* 5 */ - ASSERT_NOCARRY(add_signed_n (r1, r1, s3s, u1, u1s, rn + mn + 1)); - ASSERT (r1[rn + mn] < 2); - - MUL (r3, r2, rn, t2, mn); /* 4 */ - r3s = r2s ^ t2s; - r3[rn + mn] = 0; - u0s = add_signed_n (u0, u0, u0s, r3, r3s, rn + mn + 1); - ASSERT_NOCARRY (add_signed_n (r3, r3, r3s, u1, u1s, rn + mn + 1)); - ASSERT (r3[rn + mn] < 2); - - if (t3s) + MUL (u0, r2, rn, t0, mn + 1); /* u6 = s6 * t4 */ + ASSERT (u0[rn+mn] < 2); + if (r1s) + { + ASSERT_NOCARRY (mpn_sub_n (r1, r2, r1, rn)); + } + else { - t3[mn] += mpn_add_n (t3, m2, t3, mn); - t3s = 0; + r1[rn] += mpn_add_n (r1, r1, r2, rn); } - else if (t3[mn] > 0) + rn++; + t0s = add_signed_n (r2, r3, r3s, u0, t0s, rn + mn); + /* u3 + u5 + u6 */ + ASSERT (r2[rn+mn-1] < 4); + r3s = add_signed_n (r3, r3, r3s, u1, u1s, rn + mn); + /* -u2 + u3 + u5 */ + ASSERT (r3[rn+mn-1] < 3); + MUL (u0, s0, rn, m1, mn); /* u4 = s4 * t5 */ + ASSERT (u0[rn+mn-1] < 2); + t0[mn] = mpn_add_n (t0, m3, m1, mn); + MUL (u1, r1, rn, t0, mn + 1); /* u1 = s1 * t1 */ + mn += rn; + ASSERT (u1[mn-1] < 4); + ASSERT (u1[mn] == 0); + ASSERT_NOCARRY (add_signed_n (r1, r3, r3s, u0, s0s, mn)); + /* -u2 + u3 - u4 + u5 */ + ASSERT (r1[mn-1] < 2); + if (r3s) { - t3[mn] -= mpn_sub_n (t3, t3, m2, mn); - t3s = 1; + ASSERT_NOCARRY (mpn_add_n (r3, u1, r3, mn)); } else { - t3s = abs_sub_n (t3, m2, t3, mn); + ASSERT_NOCARRY (mpn_sub_n (r3, u1, r3, mn)); + /* u1 + u2 - u3 - u5 */ } - MUL (r2, s2, rn, t3, mn + 1); /* 6 */ - - ASSERT_NOCARRY (add_signed_n (r2, r2, t3s, u0, u0s, rn + mn + 1)); - ASSERT (r2[rn + mn] < 2); + ASSERT (r3[mn-1] < 2); + if (t0s) + { + ASSERT_NOCARRY (mpn_add_n (r2, u1, r2, mn)); + } + else + { + ASSERT_NOCARRY (mpn_sub_n (r2, u1, r2, mn)); + /* u1 - u3 - u5 - u6 */ + } + ASSERT (r2[mn-1] < 2); } void diff --git a/contrib/gmp/mpn/generic/mod_1.c b/contrib/gmp/mpn/generic/mod_1.c index 7c892814e1..c5bbaad276 100644 --- a/contrib/gmp/mpn/generic/mod_1.c +++ b/contrib/gmp/mpn/generic/mod_1.c @@ -42,16 +42,20 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MOD_1_UNNORM_THRESHOLD 0 #endif -#ifndef MOD_1_1_THRESHOLD -#define MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */ +#ifndef MOD_1U_TO_MOD_1_1_THRESHOLD +#define MOD_1U_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */ #endif -#ifndef MOD_1_2_THRESHOLD -#define MOD_1_2_THRESHOLD 10 +#ifndef MOD_1N_TO_MOD_1_1_THRESHOLD +#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */ #endif -#ifndef MOD_1_4_THRESHOLD -#define MOD_1_4_THRESHOLD 120 +#ifndef MOD_1_1_TO_MOD_1_2_THRESHOLD +#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10 +#endif + +#ifndef MOD_1_2_TO_MOD_1_4_THRESHOLD +#define MOD_1_2_TO_MOD_1_4_THRESHOLD 20 #endif @@ -207,29 +211,40 @@ mpn_mod_1 (mp_srcptr ap, mp_size_t n, mp_limb_t b) if (UNLIKELY ((b & GMP_NUMB_HIGHBIT) != 0)) { - /* The functions below do not handle this large divisor. */ - return mpn_mod_1_norm (ap, n, b); - } - else if (BELOW_THRESHOLD (n, MOD_1_1_THRESHOLD)) - { - return mpn_mod_1_unnorm (ap, n, b); - } - else if (BELOW_THRESHOLD (n, MOD_1_2_THRESHOLD)) - { - mp_limb_t pre[4]; - mpn_mod_1s_1p_cps (pre, b); - return mpn_mod_1s_1p (ap, n, b << pre[1], pre); - } - else if (BELOW_THRESHOLD (n, MOD_1_4_THRESHOLD) || UNLIKELY (b > GMP_NUMB_MASK / 4)) - { - mp_limb_t pre[5]; - mpn_mod_1s_2p_cps (pre, b); - return mpn_mod_1s_2p (ap, n, b << pre[1], pre); + if (BELOW_THRESHOLD (n, MOD_1N_TO_MOD_1_1_THRESHOLD)) + { + return mpn_mod_1_norm (ap, n, b); + } + else + { + mp_limb_t pre[4]; + mpn_mod_1_1p_cps (pre, b); + return mpn_mod_1_1p (ap, n, b, pre); + } } else { - mp_limb_t pre[7]; - mpn_mod_1s_4p_cps (pre, b); - return mpn_mod_1s_4p (ap, n, b << pre[1], pre); + if (BELOW_THRESHOLD (n, MOD_1U_TO_MOD_1_1_THRESHOLD)) + { + return mpn_mod_1_unnorm (ap, n, b); + } + else if (BELOW_THRESHOLD (n, MOD_1_1_TO_MOD_1_2_THRESHOLD)) + { + mp_limb_t pre[4]; + mpn_mod_1_1p_cps (pre, b); + return mpn_mod_1_1p (ap, n, b << pre[1], pre); + } + else if (BELOW_THRESHOLD (n, MOD_1_2_TO_MOD_1_4_THRESHOLD) || UNLIKELY (b > GMP_NUMB_MASK / 4)) + { + mp_limb_t pre[5]; + mpn_mod_1s_2p_cps (pre, b); + return mpn_mod_1s_2p (ap, n, b << pre[1], pre); + } + else + { + mp_limb_t pre[7]; + mpn_mod_1s_4p_cps (pre, b); + return mpn_mod_1s_4p (ap, n, b << pre[1], pre); + } } } diff --git a/contrib/gmp/mpn/generic/mod_1_1.c b/contrib/gmp/mpn/generic/mod_1_1.c index 27c7f8f1b6..c6a61eb6c5 100644 --- a/contrib/gmp/mpn/generic/mod_1_1.c +++ b/contrib/gmp/mpn/generic/mod_1_1.c @@ -1,8 +1,8 @@ -/* mpn_mod_1s_1p (ap, n, b, cps) +/* mpn_mod_1_1p (ap, n, b, cps) Divide (ap,,n) by b. Return the single-limb remainder. - Requires that b < B / 2. Contributed to the GNU project by Torbjorn Granlund. + Based on a suggestion by Peter L. Montgomery. THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST @@ -30,39 +30,40 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "longlong.h" void -mpn_mod_1s_1p_cps (mp_limb_t cps[4], mp_limb_t b) +mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b) { mp_limb_t bi; mp_limb_t B1modb, B2modb; int cnt; - ASSERT (b <= GMP_NUMB_MAX / 2); - count_leading_zeros (cnt, b); b <<= cnt; invert_limb (bi, b); - B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt)); + if (UNLIKELY (cnt == 0)) + B1modb = -b; + else + B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt)); ASSERT (B1modb <= b); /* NB: not fully reduced mod b */ udiv_rnd_preinv (B2modb, B1modb, b, bi); - B1modb >>= cnt; - B2modb >>= cnt; - cps[0] = bi; cps[1] = cnt; - cps[2] = B1modb; - cps[3] = B2modb; + cps[2] = B1modb >> cnt; + cps[3] = B2modb >> cnt; } mp_limb_t -mpn_mod_1s_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4]) +mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4]) { mp_limb_t rh, rl, bi, q, ph, pl, r; mp_limb_t B1modb, B2modb; mp_size_t i; int cnt; + mp_limb_t mask; + + ASSERT (n >= 2); /* fix tuneup.c if this is changed */ B1modb = bmodb[2]; B2modb = bmodb[3]; @@ -85,20 +86,14 @@ mpn_mod_1s_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4]) bi = bmodb[0]; cnt = bmodb[1]; -#if 1 - { - mp_limb_t mask; - r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)); - mask = -(mp_limb_t) (r >= b); - r -= mask & b; - } -#else - udiv_qrnnd_preinv (q, r, rh >> (GMP_LIMB_BITS - cnt), - (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)), b, bi); - ASSERT (q <= 1); /* optimize for small quotient? */ -#endif - - udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi); + + if (LIKELY (cnt != 0)) + rh = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)); + + mask = -(mp_limb_t) (rh >= b); + rh -= mask & b; + + udiv_qrnnd_preinv (q, r, rh, rl << cnt, b, bi); return r >> cnt; } diff --git a/contrib/gmp/mpn/generic/mod_1_2.c b/contrib/gmp/mpn/generic/mod_1_2.c index ffadd536de..c81b2026f7 100644 --- a/contrib/gmp/mpn/generic/mod_1_2.c +++ b/contrib/gmp/mpn/generic/mod_1_2.c @@ -36,7 +36,7 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b) mp_limb_t B1modb, B2modb, B3modb; int cnt; - ASSERT (b <= GMP_NUMB_MAX / 2); + ASSERT (b <= (~(mp_limb_t) 0) / 2); count_leading_zeros (cnt, b); @@ -53,6 +53,18 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b) cps[2] = B1modb >> cnt; cps[3] = B2modb >> cnt; cps[4] = B3modb >> cnt; + +#if WANT_ASSERT + { + int i; + b = cps[2]; + for (i = 3; i <= 4; i++) + { + b += cps[i]; + ASSERT (b >= cps[i]); + } + } +#endif } mp_limb_t @@ -63,15 +75,27 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5]) mp_size_t i; int cnt; + ASSERT (n >= 1); + B1modb = cps[2]; B2modb = cps[3]; B3modb = cps[4]; if ((n & 1) != 0) { - umul_ppmm (rh, rl, ap[n - 1], B2modb); + if (n == 1) + { + rl = ap[n - 1]; + bi = cps[0]; + cnt = cps[1]; + udiv_qrnnd_preinv (q, r, rl >> (GMP_LIMB_BITS - cnt), + rl << cnt, b, bi); + return r >> cnt; + } + umul_ppmm (ph, pl, ap[n - 2], B1modb); add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]); + umul_ppmm (rh, rl, ap[n - 1], B2modb); add_ssaaaa (rh, rl, rh, rl, ph, pl); n--; } diff --git a/contrib/gmp/mpn/generic/mod_1_3.c b/contrib/gmp/mpn/generic/mod_1_3.c index 77989fc0ae..c7c629963a 100644 --- a/contrib/gmp/mpn/generic/mod_1_3.c +++ b/contrib/gmp/mpn/generic/mod_1_3.c @@ -8,7 +8,7 @@ SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2008, 2009 Free Software Foundation, Inc. +Copyright 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -36,7 +36,7 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b) mp_limb_t B1modb, B2modb, B3modb, B4modb; int cnt; - ASSERT (b <= GMP_NUMB_MAX / 3); + ASSERT (b <= (~(mp_limb_t) 0) / 3); count_leading_zeros (cnt, b); @@ -55,6 +55,18 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b) cps[3] = B2modb >> cnt; cps[4] = B3modb >> cnt; cps[5] = B4modb >> cnt; + +#if WANT_ASSERT + { + int i; + b = cps[2]; + for (i = 3; i <= 5; i++) + { + b += cps[i]; + ASSERT (b >= cps[i]); + } + } +#endif } mp_limb_t @@ -65,17 +77,38 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6]) mp_size_t i; int cnt; + ASSERT (n >= 1); + B1modb = cps[2]; B2modb = cps[3]; B3modb = cps[4]; B4modb = cps[5]; - umul_ppmm (ph, pl, ap[n - 2], B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]); - umul_ppmm (ch, cl, ap[n - 1], B2modb); - add_ssaaaa (rh, rl, ph, pl, ch, cl); + /* We compute n mod 3 in a tricky way, which works except for when n is so + close to the maximum size that we don't need to support it. The final + cast to int is a workaround for HP cc. */ + switch ((int) ((mp_limb_t) n * MODLIMB_INVERSE_3 >> (GMP_NUMB_BITS - 2))) + { + case 0: + umul_ppmm (ph, pl, ap[n - 2], B1modb); + add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]); + umul_ppmm (rh, rl, ap[n - 1], B2modb); + add_ssaaaa (rh, rl, rh, rl, ph, pl); + n -= 3; + break; + case 2: /* n mod 3 = 1 */ + rh = 0; + rl = ap[n - 1]; + n -= 1; + break; + case 1: /* n mod 3 = 2 */ + umul_ppmm (ph, pl, ap[n - 1], B1modb); + add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]); + n -= 2; + break; + } - for (i = n - 6; i >= 0; i -= 3) + for (i = n - 3; i >= 0; i -= 3) { /* rr = ap[i] < B + ap[i+1] * (B mod b) <= (B-1)(b-1) @@ -96,21 +129,6 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6]) add_ssaaaa (rh, rl, rh, rl, ph, pl); } - if (i >= -2) - { - umul_ppmm (ph, pl, rl, B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 2]); - umul_ppmm (rh, rl, rh, B2modb); - add_ssaaaa (rh, rl, rh, rl, ph, pl); - if (i >= -1) - { - umul_ppmm (ph, pl, rl, B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[0]); - umul_ppmm (rh, rl, rh, B2modb); - add_ssaaaa (rh, rl, rh, rl, ph, pl); - } - } - bi = cps[0]; cnt = cps[1]; diff --git a/contrib/gmp/mpn/generic/mod_1_4.c b/contrib/gmp/mpn/generic/mod_1_4.c index 74893386a9..bde191b956 100644 --- a/contrib/gmp/mpn/generic/mod_1_4.c +++ b/contrib/gmp/mpn/generic/mod_1_4.c @@ -36,7 +36,7 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b) mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb; int cnt; - ASSERT (b <= GMP_NUMB_MAX / 4); + ASSERT (b <= (~(mp_limb_t) 0) / 4); count_leading_zeros (cnt, b); @@ -57,6 +57,18 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b) cps[4] = B3modb >> cnt; cps[5] = B4modb >> cnt; cps[6] = B5modb >> cnt; + +#if WANT_ASSERT + { + int i; + b = cps[2]; + for (i = 3; i <= 6; i++) + { + b += cps[i]; + ASSERT (b >= cps[i]); + } + } +#endif } mp_limb_t @@ -67,22 +79,45 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7]) mp_size_t i; int cnt; + ASSERT (n >= 1); + B1modb = cps[2]; B2modb = cps[3]; B3modb = cps[4]; B4modb = cps[5]; B5modb = cps[6]; - umul_ppmm (ph, pl, ap[n - 3], B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]); - - umul_ppmm (ch, cl, ap[n - 2], B2modb); - add_ssaaaa (ph, pl, ph, pl, ch, cl); - - umul_ppmm (ch, cl, ap[n - 1], B3modb); - add_ssaaaa (rh, rl, ph, pl, ch, cl); + switch (n & 3) + { + case 0: + umul_ppmm (ph, pl, ap[n - 3], B1modb); + add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]); + umul_ppmm (ch, cl, ap[n - 2], B2modb); + add_ssaaaa (ph, pl, ph, pl, ch, cl); + umul_ppmm (rh, rl, ap[n - 1], B3modb); + add_ssaaaa (rh, rl, rh, rl, ph, pl); + n -= 4; + break; + case 1: + rh = 0; + rl = ap[n - 1]; + n -= 1; + break; + case 2: + umul_ppmm (ph, pl, ap[n - 1], B1modb); + add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]); + n -= 2; + break; + case 3: + umul_ppmm (ph, pl, ap[n - 2], B1modb); + add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]); + umul_ppmm (rh, rl, ap[n - 1], B2modb); + add_ssaaaa (rh, rl, rh, rl, ph, pl); + n -= 3; + break; + } - for (i = n - 8; i >= 0; i -= 4) + for (i = n - 4; i >= 0; i -= 4) { /* rr = ap[i] < B + ap[i+1] * (B mod b) <= (B-1)(b-1) @@ -107,28 +142,6 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7]) add_ssaaaa (rh, rl, rh, rl, ph, pl); } - if (i >= -3) - { - umul_ppmm (ph, pl, rl, B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 3]); - umul_ppmm (rh, rl, rh, B2modb); - add_ssaaaa (rh, rl, rh, rl, ph, pl); - if (i >= -2) - { - umul_ppmm (ph, pl, rl, B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 2]); - umul_ppmm (rh, rl, rh, B2modb); - add_ssaaaa (rh, rl, rh, rl, ph, pl); - if (i >= -1) - { - umul_ppmm (ph, pl, rl, B1modb); - add_ssaaaa (ph, pl, ph, pl, 0, ap[0]); - umul_ppmm (rh, rl, rh, B2modb); - add_ssaaaa (rh, rl, rh, rl, ph, pl); - } - } - } - bi = cps[0]; cnt = cps[1]; diff --git a/contrib/gmp/mpn/generic/mode1o.c b/contrib/gmp/mpn/generic/mode1o.c index 064becdadf..e8978a4c57 100644 --- a/contrib/gmp/mpn/generic/mode1o.c +++ b/contrib/gmp/mpn/generic/mode1o.c @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ r*B^k + a - c == q*d - where B=2^BITS_PER_MP_LIMB, a is {src,size}, k is either size or size-1 + where B=2^GMP_LIMB_BITS, a is {src,size}, k is either size or size-1 (the caller won't know which), and q is the quotient (discarded). d must be odd, c can be any limb value. diff --git a/contrib/gmp/mpn/generic/mu_bdiv_q.c b/contrib/gmp/mpn/generic/mu_bdiv_q.c index 3b5f56d088..01df1e3a36 100644 --- a/contrib/gmp/mpn/generic/mu_bdiv_q.c +++ b/contrib/gmp/mpn/generic/mu_bdiv_q.c @@ -4,12 +4,11 @@ Contributed to the GNU project by Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -27,17 +26,11 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* We use the "misunderstanding algorithm" (MU), discovered by Paul Zimmermann - and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of - Jebelean's bidirectional exact division algorithm. - - The idea of this algorithm is to compute a smaller inverted value than used - in the standard Barrett algorithm, and thus save time in the Newton - iterations, and pay just a small price when using the inverted value for - developing quotient bits. - - Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the - "wrap around" trick. +/* + The idea of the algorithm used herein is to compute a smaller inverted value + than used in the standard Barrett algorithm, and thus save time in the + Newton iterations, and pay just a small price when using the inverted value + for developing quotient bits. This algorithm was presented at ICMS 2006. */ #include "gmp.h" @@ -49,11 +42,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Requirements: N >= D D >= 1 - N mod D = 0 D odd dn >= 2 nn >= 2 - scratch space as determined by mpn_divexact_itch(nn,dn). + scratch space as determined by mpn_mu_bdiv_q_itch(nn,dn). Write quotient to Q = {qp,nn}. @@ -69,10 +61,10 @@ mpn_mu_bdiv_q (mp_ptr qp, mp_srcptr dp, mp_size_t dn, mp_ptr scratch) { - mp_ptr ip; - mp_ptr rp; mp_size_t qn; mp_size_t in; + int cy, c0; + mp_size_t tn, wn; qn = nn; @@ -82,74 +74,52 @@ mpn_mu_bdiv_q (mp_ptr qp, if (qn > dn) { mp_size_t b; - mp_ptr tp; - mp_limb_t cy; - int k; - mp_size_t m, wn; - mp_size_t i; /* |_______________________| dividend |________| divisor */ +#define ip scratch /* in */ +#define rp (scratch + in) /* dn or rest >= binvert_itch(in) */ +#define tp (scratch + in + dn) /* dn+in or next_size(dn) */ +#define scratch_out (scratch + in + dn + tn) /* mulmod_bnm1_itch(next_size(dn)) */ + /* Compute an inverse size that is a nice partition of the quotient. */ b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ /* Some notes on allocation: - When in = dn, R dies when mpn_mullow returns, if in < dn the low in + When in = dn, R dies when mpn_mullo returns, if in < dn the low in limbs of R dies at that point. We could save memory by letting T live just under R, and let the upper part of T expand into R. These changes should reduce itch to perhaps 3dn. */ - ip = scratch; /* in limbs */ - rp = scratch + in; /* dn limbs */ - tp = scratch + in + dn; /* dn + in limbs FIXME: mpn_fft_next_size */ - scratch += in; /* Roughly 2in+1 limbs */ - - mpn_binvert (ip, dp, in, scratch); + mpn_binvert (ip, dp, in, rp); cy = 0; MPN_COPY (rp, np, dn); np += dn; - mpn_mullow_n (qp, rp, ip, in); + mpn_mullo_n (qp, rp, ip, in); qn -= in; - if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD)) - { - k = mpn_fft_best_k (dn, 0); - m = mpn_fft_next_size (dn, k); - wn = dn + in - m; /* number of wrapped limbs */ - ASSERT_ALWAYS (wn >= 0); /* could handle this below */ - } - while (qn > in) { -#if WANT_FFT - if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD)) + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */ + else { - /* The two multiplicands are dn and 'in' limbs, with dn >= in. - The relevant part of the result will typically partially wrap, - and that part will come out as subtracted to the right. The - unwrapped part, m-in limbs at the high end of tp, is the lower - part of the sought product. The wrapped part, at the low end - of tp, will be subtracted from the low part of the partial - remainder; we undo that operation with another subtraction. */ - int c0; - - mpn_mul_fft (tp, m, dp, dn, qp, in, k); - - c0 = mpn_sub_n (tp + m, rp, tp, wn); - - for (i = wn; c0 != 0 && i < in; i++) - c0 = tp[i] == GMP_NUMB_MASK; - mpn_incr_u (tp + in, c0); + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, rp, wn); + mpn_decr_u (tp + wn, c0); + } } - else -#endif - mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */ + qp += in; if (dn != in) { @@ -164,29 +134,28 @@ mpn_mu_bdiv_q (mp_ptr qp, /* Subtract tp[dn+in-1...dn] from dividend. */ cy = mpn_sub_nc (rp + dn - in, np, tp + dn, in, cy); np += in; - mpn_mullow_n (qp, rp, ip, in); + mpn_mullo_n (qp, rp, ip, in); qn -= in; } /* Generate last qn limbs. FIXME: It should be possible to limit precision here, since qn is typically somewhat smaller than dn. No big gains expected. */ -#if WANT_FFT - if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD)) - { - int c0; - mpn_mul_fft (tp, m, dp, dn, qp, in, k); - - c0 = mpn_sub_n (tp + m, rp, tp, wn); - - for (i = wn; c0 != 0 && i < in; i++) - c0 = tp[i] == GMP_NUMB_MASK; - mpn_incr_u (tp + in, c0); - } - else -#endif + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[qn+in-1...in] */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, rp, wn); + mpn_decr_u (tp + wn, c0); + } + } + qp += in; if (dn != in) { @@ -199,57 +168,93 @@ mpn_mu_bdiv_q (mp_ptr qp, } mpn_sub_nc (rp + dn - in, np, tp + dn, qn - (dn - in), cy); - mpn_mullow_n (qp, rp, ip, qn); - } + mpn_mullo_n (qp, rp, ip, qn); + +#undef ip +#undef rp +#undef tp +#undef scratch_out + } else { /* |_______________________| dividend |________________| divisor */ +#define ip scratch /* in */ +#define tp (scratch + in) /* qn+in or next_size(qn) or rest >= binvert_itch(in) */ +#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(qn)) */ + /* Compute half-sized inverse. */ in = qn - (qn >> 1); - ip = scratch; /* ceil(qn/2) limbs */ - rp = scratch + in; /* ceil(qn/2)+qn limbs */ - scratch += in; /* 2*ceil(qn/2)+2 */ + mpn_binvert (ip, dp, in, tp); - mpn_binvert (ip, dp, in, scratch); + mpn_mullo_n (qp, np, ip, in); /* low `in' quotient limbs */ - mpn_mullow_n (qp, np, ip, in); /* low `in' quotient limbs */ -#if WANT_FFT - if (ABOVE_THRESHOLD (qn, MUL_FFT_MODF_THRESHOLD)) + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, qn, qp, in); /* mulhigh */ + else { - int k; - mp_size_t m; - - k = mpn_fft_best_k (qn, 0); - m = mpn_fft_next_size (qn, k); - mpn_mul_fft (rp, m, dp, qn, qp, in, k); - if (mpn_cmp (np, rp, in) < 0) - mpn_incr_u (rp + in, 1); + tn = mpn_mulmod_bnm1_next_size (qn); + mpn_mulmod_bnm1 (tp, tn, dp, qn, qp, in, scratch_out); + wn = qn + in - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_cmp (tp, np, wn) < 0; + mpn_decr_u (tp + wn, c0); + } } - else -#endif - mpn_mul (rp, dp, qn, qp, in); /* mulhigh */ - mpn_sub_n (rp, np + in, rp + in, qn - in); - mpn_mullow_n (qp + in, rp, ip, qn - in); /* high qn-in quotient limbs */ + mpn_sub_n (tp, np + in, tp + in, qn - in); + mpn_mullo_n (qp + in, tp, ip, qn - in); /* high qn-in quotient limbs */ + +#undef ip +#undef tp +#undef scratch_out } } mp_size_t mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn) { - mp_size_t qn; + mp_size_t qn, in, tn, itch_binvert, itch_out, itches; + mp_size_t b; qn = nn; if (qn > dn) { - return 4 * dn; /* FIXME FIXME FIXME need mpn_fft_next_size */ + b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ + in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + { + tn = dn + in; + itch_out = 0; + } + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + itch_out = mpn_mulmod_bnm1_itch (tn, dn, in); + } + itch_binvert = mpn_binvert_itch (in); + itches = dn + tn + itch_out; + return in + MAX (itches, itch_binvert); } else { - return 2 * qn + 1 + 2; /* FIXME FIXME FIXME need mpn_fft_next_size */ + in = qn - (qn >> 1); + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + { + tn = qn + in; + itch_out = 0; + } + else + { + tn = mpn_mulmod_bnm1_next_size (qn); + itch_out = mpn_mulmod_bnm1_itch (tn, qn, in); + } + itch_binvert = mpn_binvert_itch (in); + itches = tn + itch_out; + return in + MAX (itches, itch_binvert); } } diff --git a/contrib/gmp/mpn/generic/mu_bdiv_qr.c b/contrib/gmp/mpn/generic/mu_bdiv_qr.c index e66b4a117e..312d011a14 100644 --- a/contrib/gmp/mpn/generic/mu_bdiv_qr.c +++ b/contrib/gmp/mpn/generic/mu_bdiv_qr.c @@ -1,12 +1,14 @@ -/* mpn_mu_bdiv_qr -- divide-and-conquer Hensel division using a variant of - Barrett's algorithm, returning quotient and remainder. +/* mpn_mu_bdiv_qr(qp,rp,np,nn,dp,dn,tp) -- Compute {np,nn} / {dp,dn} mod B^qn, + where qn = nn-dn, storing the result in {qp,qn}. Overlap allowed between Q + and N; all other overlap disallowed. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + Contributed to the GNU project by Torbjorn Granlund. -Copyright 2005, 2006, 2007 Free Software Foundation, Inc. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,29 +25,256 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#include "gmp.h" -#include "gmp-impl.h" +/* + The idea of the algorithm used herein is to compute a smaller inverted value + than used in the standard Barrett algorithm, and thus save time in the + Newton iterations, and pay just a small price when using the inverted value + for developing quotient bits. This algorithm was presented at ICMS 2006. +*/ -/* Computes Hensel binary division of {np, 2*n} by {dp, n}. - - Output: +#include "gmp.h" +#include "gmp-impl.h" - q = n * d^{-1} mod 2^{qn * GMP_NUMB_BITS}, - r = (n - q * d) * 2^{-qn * GMP_NUMB_BITS} +/* N = {np,nn} + D = {dp,dn} - Stores q at qp. Stores the n least significant limbs of r at the high half - of np, and returns the borrow from the subtraction n - q*d. + Requirements: N >= D + D >= 1 + D odd + dn >= 2 + nn >= 2 + scratch space as determined by mpn_mu_bdiv_qr_itch(nn,dn). - d must be odd. dinv is (-d)^-1 mod 2^GMP_NUMB_BITS. */ + Write quotient to Q = {qp,nn-dn}. -void + FIXME: When iterating, perhaps do the small step before loop, not after. + FIXME: Try to avoid the scalar divisions when computing inverse size. + FIXME: Trim allocation for (qn > dn) case, 3*dn might be possible. In + particular, when dn==in, tp and rp could use the same space. +*/ +mp_limb_t mpn_mu_bdiv_qr (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, mp_ptr scratch) { - ASSERT_ALWAYS (0); + mp_size_t qn; + mp_size_t in; + mp_limb_t cy, c0; + int k; + mp_size_t tn, wn; + mp_size_t i; + + qn = nn - dn; + + ASSERT (dn >= 2); + ASSERT (qn >= 2); + + if (qn > dn) + { + mp_size_t b; + + /* |_______________________| dividend + |________| divisor */ + +#define ip scratch /* in */ +#define tp (scratch + in) /* dn+in or next_size(dn) or rest >= binvert_itch(in) */ +#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(dn)) */ + + /* Compute an inverse size that is a nice partition of the quotient. */ + b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ + in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ + + /* Some notes on allocation: + + When in = dn, R dies when mpn_mullo returns, if in < dn the low in + limbs of R dies at that point. We could save memory by letting T live + just under R, and let the upper part of T expand into R. These changes + should reduce itch to perhaps 3dn. + */ + + mpn_binvert (ip, dp, in, tp); + + MPN_COPY (rp, np, dn); + np += dn; + cy = 0; + + while (qn > in) + { + mpn_mullo_n (qp, rp, ip, in); + + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, rp, wn); + mpn_decr_u (tp + wn, c0); + } + } + + qp += in; + qn -= in; + + if (dn != in) + { + /* Subtract tp[dn-1...in] from partial remainder. */ + cy += mpn_sub_n (rp, rp + in, tp + in, dn - in); + if (cy == 2) + { + mpn_incr_u (tp + dn, 1); + cy = 1; + } + } + /* Subtract tp[dn+in-1...dn] from dividend. */ + cy = mpn_sub_nc (rp + dn - in, np, tp + dn, in, cy); + np += in; + } + + /* Generate last qn limbs. */ + mpn_mullo_n (qp, rp, ip, qn); + + if (BELOW_THRESHOLD (qn, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, qn); /* mulhi, need tp[qn+in-1...in] */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, qn, scratch_out); + wn = dn + qn - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, rp, wn); + mpn_decr_u (tp + wn, c0); + } + } + + if (dn != qn) + { + cy += mpn_sub_n (rp, rp + qn, tp + qn, dn - qn); + if (cy == 2) + { + mpn_incr_u (tp + dn, 1); + cy = 1; + } + } + return mpn_sub_nc (rp + dn - qn, np, tp + dn, qn, cy); + +#undef ip +#undef tp +#undef scratch_out + } + else + { + /* |_______________________| dividend + |________________| divisor */ + +#define ip scratch /* in */ +#define tp (scratch + in) /* dn+in or next_size(dn) or rest >= binvert_itch(in) */ +#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(dn)) */ + + /* Compute half-sized inverse. */ + in = qn - (qn >> 1); + + mpn_binvert (ip, dp, in, tp); + + mpn_mullo_n (qp, np, ip, in); /* low `in' quotient limbs */ + + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, in); /* mulhigh */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, np, wn); + mpn_decr_u (tp + wn, c0); + } + } + + qp += in; + qn -= in; + + cy = mpn_sub_n (rp, np + in, tp + in, dn); + mpn_mullo_n (qp, rp, ip, qn); /* high qn quotient limbs */ + + if (BELOW_THRESHOLD (qn, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, qn); /* mulhigh */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, qn, scratch_out); + wn = dn + qn - tn; /* number of wrapped limbs */ + if (wn > 0) + { + c0 = mpn_sub_n (tp + tn, tp, rp, wn); + mpn_decr_u (tp + wn, c0); + } + } + + cy += mpn_sub_n (rp, rp + qn, tp + qn, dn - qn); + if (cy == 2) + { + mpn_incr_u (tp + dn, 1); + cy = 1; + } + return mpn_sub_nc (rp + dn - qn, np + dn + in, tp + dn, qn, cy); + +#undef ip +#undef tp +#undef scratch_out + } +} + +mp_size_t +mpn_mu_bdiv_qr_itch (mp_size_t nn, mp_size_t dn) +{ + mp_size_t qn, in, tn, itch_binvert, itch_out, itches; + mp_size_t b; + + qn = nn - dn; + + if (qn > dn) + { + b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ + in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + { + tn = dn + in; + itch_out = 0; + } + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + itch_out = mpn_mulmod_bnm1_itch (tn, dn, in); + } + itch_binvert = mpn_binvert_itch (in); + itches = tn + itch_out; + return in + MAX (itches, itch_binvert); + } + else + { + in = qn - (qn >> 1); + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + { + tn = dn + in; + itch_out = 0; + } + else + { + tn = mpn_mulmod_bnm1_next_size (dn); + itch_out = mpn_mulmod_bnm1_itch (tn, dn, in); + } + } + itch_binvert = mpn_binvert_itch (in); + itches = tn + itch_out; + return in + MAX (itches, itch_binvert); } diff --git a/contrib/gmp/mpn/generic/mu_div_q.c b/contrib/gmp/mpn/generic/mu_div_q.c index 150e8b77cd..86182ac151 100644 --- a/contrib/gmp/mpn/generic/mu_div_q.c +++ b/contrib/gmp/mpn/generic/mu_div_q.c @@ -1,13 +1,12 @@ -/* mpn_mu_div_q, mpn_preinv_mu_div_q. +/* mpn_mu_div_q. - Contributed to the GNU project by Torbjörn Granlund. + Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -25,6 +24,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +/* + The idea of the algorithm used herein is to compute a smaller inverted value + than used in the standard Barrett algorithm, and thus save time in the + Newton iterations, and pay just a small price when using the inverted value + for developing quotient bits. This algorithm was presented at ICMS 2006. +*/ + /* Things to work on: @@ -36,13 +42,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ simply call mpn_mu_divappr_q. Such a temporary allocation is unfortunately very large. - 2. Instead of falling back to mpn_mu_div_qr when we detect a possible - mpn_mu_divappr_q rounding problem, we could multiply and compare. + 2. We used to fall back to mpn_mu_div_qr when we detect a possible + mpn_mu_divappr_q rounding problem, now we multiply and compare. Unfortunately, since mpn_mu_divappr_q does not return the partial - remainder, this also doesn't become optimal. A mpn_mu_divappr_qr - could solve that. + remainder, this also doesn't become optimal. A mpn_mu_divappr_qr could + solve that. - 3. The allocations done here should be made from the scratch area. + 3. The allocations done here should be made from the scratch area, which + then would need to be amended. */ #include /* for NULL */ @@ -52,13 +59,13 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ mp_limb_t mpn_mu_div_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, + mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, mp_ptr scratch) { mp_ptr tp, rp, ip, this_ip; mp_size_t qn, in, this_in; - mp_limb_t cy; + mp_limb_t cy, qh; TMP_DECL; TMP_MARK; @@ -69,7 +76,8 @@ mpn_mu_div_q (mp_ptr qp, if (qn >= dn) /* nn >= 2*dn + 1 */ { - /* Find max inverse size needed by the two preinv calls. */ + /* Find max inverse size needed by the two preinv calls. FIXME: This is + not optimal, it underestimates the invariance. */ if (dn != qn) { mp_size_t in1, in2; @@ -89,7 +97,7 @@ mpn_mu_div_q (mp_ptr qp, { MPN_COPY (scratch + 1, dp, in); scratch[0] = 1; - mpn_invert (ip, scratch, in + 1, NULL); + mpn_invertappr (ip, scratch, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } else @@ -99,7 +107,7 @@ mpn_mu_div_q (mp_ptr qp, MPN_ZERO (ip, in); else { - mpn_invert (ip, scratch, in + 1, NULL); + mpn_invertappr (ip, scratch, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } } @@ -107,21 +115,28 @@ mpn_mu_div_q (mp_ptr qp, /* |_______________________| dividend |________| divisor */ rp = TMP_BALLOC_LIMBS (2 * dn + 1); - if (dn != qn) /* FIXME: perhaps mpn_mu_div_qr should DTRT */ - { - this_in = mpn_mu_div_qr_choose_in (qn - dn, dn, 0); - this_ip = ip + in - this_in; - mpn_preinv_mu_div_qr (tp + dn + 1, rp + dn + 1, np + dn, qn, dp, dn, - this_ip, this_in, scratch); - } - else - MPN_COPY (rp + dn + 1, np + dn, dn); + + this_in = mpn_mu_div_qr_choose_in (qn - dn, dn, 0); + this_ip = ip + in - this_in; + qh = mpn_preinv_mu_div_qr (tp + dn + 1, rp + dn + 1, np + dn, qn, dp, dn, + this_ip, this_in, scratch); MPN_COPY (rp + 1, np, dn); rp[0] = 0; this_in = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0); this_ip = ip + in - this_in; - mpn_preinv_mu_divappr_q (tp, rp, 2*dn + 1, dp, dn, this_ip, this_in, scratch); + cy = mpn_preinv_mu_divappr_q (tp, rp, 2 * dn + 1, dp, dn, + this_ip, this_in, scratch); + + if (UNLIKELY (cy != 0)) + { + /* Since the partial remainder fed to mpn_preinv_mu_divappr_q was + canonically reduced, replace the returned value of B^(qn-dn)+eps + by the largest possible value. */ + mp_size_t i; + for (i = 0; i < dn + 1; i++) + tp[i] = GMP_NUMB_MAX; + } /* The max error of mpn_mu_divappr_q is +4. If the low quotient limb is greater than the max error, we cannot trust the quotient. */ @@ -131,27 +146,77 @@ mpn_mu_div_q (mp_ptr qp, } else { - /* Fall back to plain mpn_mu_div_qr. */ - mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch); + mp_limb_t cy; + mp_ptr pp; + + /* FIXME: can we use already allocated space? */ + pp = TMP_BALLOC_LIMBS (nn); + mpn_mul (pp, tp + 1, qn, dp, dn); + + cy = (qh != 0) ? mpn_add_n (pp + qn, pp + qn, dp, dn) : 0; + + if (cy || mpn_cmp (pp, np, nn) > 0) /* At most is wrong by one, no cycle. */ + qh -= mpn_sub_1 (qp, tp + 1, qn, 1); + else /* Same as above */ + MPN_COPY (qp, tp + 1, qn); } } else { /* |_______________________| dividend |________________| divisor */ - mpn_mu_divappr_q (tp, np + nn - (2*qn + 2), 2*qn + 2, dp + dn - (qn + 1), qn + 1, scratch); - if (tp[0] > 4) + /* FIXME: When nn = 2dn-1, qn becomes dn-1, and the numerator size passed + here becomes 2dn, i.e., more than nn. This shouldn't hurt, since only + the most significant dn-1 limbs will actually be read, but it is not + pretty. */ + + qh = mpn_mu_divappr_q (tp, np + nn - (2 * qn + 2), 2 * qn + 2, + dp + dn - (qn + 1), qn + 1, scratch); + + /* The max error of mpn_mu_divappr_q is +4, but we get an additional + error from the divisor truncation. */ + if (tp[0] > 6) { MPN_COPY (qp, tp + 1, qn); } else { - rp = TMP_BALLOC_LIMBS (dn); - mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch); + mp_limb_t cy; + + /* FIXME: a shorter product should be enough; we may use already + allocated space... */ + rp = TMP_BALLOC_LIMBS (nn); + mpn_mul (rp, dp, dn, tp + 1, qn); + + cy = (qh != 0) ? mpn_add_n (rp + qn, rp + qn, dp, dn) : 0; + + if (cy || mpn_cmp (rp, np, nn) > 0) /* At most is wrong by one, no cycle. */ + qh -= mpn_sub_1 (qp, tp + 1, qn, 1); + else /* Same as above */ + MPN_COPY (qp, tp + 1, qn); } } TMP_FREE; - return 0; + return qh; +} + +mp_size_t +mpn_mu_div_q_itch (mp_size_t nn, mp_size_t dn, int mua_k) +{ + mp_size_t qn, itch1, itch2; + + qn = nn - dn; + if (qn >= dn) + { + itch1 = mpn_mu_div_qr_itch (qn, dn, mua_k); + itch2 = mpn_mu_divappr_q_itch (2 * dn + 1, dn, mua_k); + return MAX (itch1, itch2); + } + else + { + itch1 = mpn_mu_divappr_q_itch (2 * qn + 2, qn + 1, mua_k); + return itch1; + } } diff --git a/contrib/gmp/mpn/generic/mu_div_qr.c b/contrib/gmp/mpn/generic/mu_div_qr.c index 9049e5907a..34a2abb5e0 100644 --- a/contrib/gmp/mpn/generic/mu_div_qr.c +++ b/contrib/gmp/mpn/generic/mu_div_qr.c @@ -7,12 +7,11 @@ Contributed to the GNU project by Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -30,64 +29,34 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* We use the "misunderstanding algorithm" (MUA), discovered by Paul Zimmermann - and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of - Jebelean's bidirectional exact division algorithm. - - The idea of this algorithm is to compute a smaller inverted value than used - in the standard Barrett algorithm, and thus save time in the Newton - iterations, and pay just a small price when using the inverted value for - developing quotient bits. - - Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the - "wrap around" trick. Based on the GMP divexact code and inspired by code - contributed to GMP by Karl Hasselstroem. +/* + The idea of the algorithm used herein is to compute a smaller inverted value + than used in the standard Barrett algorithm, and thus save time in the + Newton iterations, and pay just a small price when using the inverted value + for developing quotient bits. This algorithm was presented at ICMS 2006. */ - -/* CAUTION: This code and the code in mu_divappr_q.c should be edited in lockstep. +/* CAUTION: This code and the code in mu_divappr_q.c should be edited in sync. Things to work on: - * Passing k isn't a great interface. Either 'in' should be passed, or - determined by the code. - - * The current mpn_mu_div_qr_itch isn't exactly scientifically written. - Scratch space buffer overruns are not unlikely before some analysis is - applied. Since scratch requirements are expected to change, such an - analysis will have to wait til things settle. - - * This isn't optimal when the remainder isn't needed, since the final - multiplication could be made special and take O(1) time on average, in that - case. This is particularly bad when qn << dn. At some level, code as in - GMP 4 mpn_tdiv_qr should be used, effectively dividing the leading 2qn - dividend limbs by the qn divisor limbs. - * This isn't optimal when the quotient isn't needed, as it might take a lot - of space. The computation is always needed, though, so there is not time - to save with special code. + of space. The computation is always needed, though, so there is no time to + save with special code. * The itch/scratch scheme isn't perhaps such a good idea as it once seemed, - demonstrated by the fact that the mpn_inv function's scratch needs means - that we need to keep a large allocation long after it is needed. Things - are worse as mpn_mul_fft does not accept any scratch parameter, which means - we'll have a large memory hole while in mpn_mul_fft. In general, a peak - scratch need in the beginning of a function isn't well-handled by the - itch/scratch scheme. - - * Some ideas from comments in divexact.c apply to this code too. + demonstrated by the fact that the mpn_invertappr function's scratch needs + mean that we need to keep a large allocation long after it is needed. + Things are worse as mpn_mul_fft does not accept any scratch parameter, + which means we'll have a large memory hole while in mpn_mul_fft. In + general, a peak scratch need in the beginning of a function isn't + well-handled by the itch/scratch scheme. */ -/* the NOSTAT stuff handles properly the case where files are concatenated */ -#ifdef NOSTAT -#undef STAT -#endif - #ifdef STAT #undef STAT #define STAT(x) x #else -#define NOSTAT #define STAT(x) #endif @@ -96,65 +65,98 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" -/* In case k=0 (automatic choice), we distinguish 3 cases: - (a) dn < qn: in = ceil(qn / ceil(qn/dn)) - (b) dn/3 < qn <= dn: in = ceil(qn / 2) - (c) qn < dn/3: in = qn - In all cases we have in <= dn. - */ -mp_size_t -mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k) +/* FIXME: The MU_DIV_QR_SKEW_THRESHOLD was not analysed properly. It gives a + speedup according to old measurements, but does the decision mechanism + really make sense? It seem like the quotient between dn and qn might be + what we really should be checking. */ +#ifndef MU_DIV_QR_SKEW_THRESHOLD +#define MU_DIV_QR_SKEW_THRESHOLD 100 +#endif + +#ifdef CHECK /* FIXME: Enable in minithres */ +#undef MU_DIV_QR_SKEW_THRESHOLD +#define MU_DIV_QR_SKEW_THRESHOLD 1 +#endif + + +static mp_limb_t mpn_mu_div_qr2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr); + + +mp_limb_t +mpn_mu_div_qr (mp_ptr qp, + mp_ptr rp, + mp_srcptr np, + mp_size_t nn, + mp_srcptr dp, + mp_size_t dn, + mp_ptr scratch) { - mp_size_t in; + mp_size_t qn; + mp_limb_t cy, qh; - if (k == 0) + qn = nn - dn; + if (qn + MU_DIV_QR_SKEW_THRESHOLD < dn) { - mp_size_t b; - if (qn > dn) - { - /* Compute an inverse size that is a nice partition of the quotient. */ - b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ - in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ - } - else if (3 * qn > dn) - { - in = (qn - 1) / 2 + 1; /* b = 2 */ - } + /* |______________|_ign_first__| dividend nn + |_______|_ign_first__| divisor dn + + |______| quotient (prel) qn + + |___________________| quotient * ignored-divisor-part dn-1 + */ + + /* Compute a preliminary quotient and a partial remainder by dividing the + most significant limbs of each operand. */ + qh = mpn_mu_div_qr2 (qp, rp + nn - (2 * qn + 1), + np + nn - (2 * qn + 1), 2 * qn + 1, + dp + dn - (qn + 1), qn + 1, + scratch); + + /* Multiply the quotient by the divisor limbs ignored above. */ + if (dn - (qn + 1) > qn) + mpn_mul (scratch, dp, dn - (qn + 1), qp, qn); /* prod is dn-1 limbs */ + else + mpn_mul (scratch, qp, qn, dp, dn - (qn + 1)); /* prod is dn-1 limbs */ + + if (qh) + cy = mpn_add_n (scratch + qn, scratch + qn, dp, dn - (qn + 1)); else + cy = 0; + scratch[dn - 1] = cy; + + cy = mpn_sub_n (rp, np, scratch, nn - (2 * qn + 1)); + cy = mpn_sub_nc (rp + nn - (2 * qn + 1), + rp + nn - (2 * qn + 1), + scratch + nn - (2 * qn + 1), + qn + 1, cy); + if (cy) { - in = (qn - 1) / 1 + 1; /* b = 1 */ + qh -= mpn_sub_1 (qp, qp, qn, 1); + mpn_add_n (rp, rp, dp, dn); } } else { - mp_size_t xn; - xn = MIN (dn, qn); - in = (xn - 1) / k + 1; + qh = mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch); } - return in; + return qh; } static mp_limb_t mpn_mu_div_qr2 (mp_ptr qp, mp_ptr rp, - mp_ptr np, + mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, mp_ptr scratch) { mp_size_t qn, in; - mp_limb_t cy; + mp_limb_t cy, qh; mp_ptr ip, tp; - /* FIXME: We should probably not handle tiny operands, but do it for now. */ - if (dn == 1) - { - rp[0] = mpn_divrem_1 (scratch, 0L, np, nn, dp[0]); - MPN_COPY (qp, scratch, nn - 1); - return scratch[nn - 1]; - } + ASSERT (dn > 1); qn = nn - dn; @@ -165,7 +167,7 @@ mpn_mu_div_qr2 (mp_ptr qp, #if 1 /* This alternative inverse computation method gets slightly more accurate results. FIXMEs: (1) Temp allocation needs not analysed (2) itch function - not adapted (3) mpn_invert scratch needs not met. */ + not adapted (3) mpn_invertappr scratch needs not met. */ ip = scratch; tp = scratch + in + 1; @@ -174,7 +176,7 @@ mpn_mu_div_qr2 (mp_ptr qp, { MPN_COPY (tp + 1, dp, in); tp[0] = 1; - mpn_invert (ip, tp, in + 1, NULL); + mpn_invertappr (ip, tp, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } else @@ -184,7 +186,7 @@ mpn_mu_div_qr2 (mp_ptr qp, MPN_ZERO (ip, in); else { - mpn_invert (ip, tp, in + 1, NULL); + mpn_invertappr (ip, tp, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } } @@ -200,11 +202,11 @@ mpn_mu_div_qr2 (mp_ptr qp, { tp[in + 1] = 0; MPN_COPY (tp + in + 2, dp, in); - mpn_invert (tp, tp + in + 1, in + 1, NULL); + mpn_invertappr (tp, tp + in + 1, in + 1, NULL); } else { - mpn_invert (tp, dp + dn - (in + 1), in + 1, NULL); + mpn_invertappr (tp, dp + dn - (in + 1), in + 1, NULL); } cy = mpn_sub_1 (tp, tp, in + 1, GMP_NUMB_HIGHBIT); if (UNLIKELY (cy != 0)) @@ -212,24 +214,15 @@ mpn_mu_div_qr2 (mp_ptr qp, MPN_COPY (ip, tp + 1, in); #endif -/* We can't really handle qh = 1 like this since we'd here clobber N, which is - not allowed in the way we've defined this function's API. */ -#if 0 - qh = mpn_cmp (np + qn, dp, dn) >= 0; - if (qh != 0) - mpn_sub_n (np + qn, np + qn, dp, dn); -#endif - - mpn_preinv_mu_div_qr (qp, rp, np, nn, dp, dn, ip, in, scratch + in); + qh = mpn_preinv_mu_div_qr (qp, rp, np, nn, dp, dn, ip, in, scratch + in); -/* return qh; */ - return 0; + return qh; } -void +mp_limb_t mpn_preinv_mu_div_qr (mp_ptr qp, mp_ptr rp, - mp_ptr np, + mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, @@ -238,24 +231,26 @@ mpn_preinv_mu_div_qr (mp_ptr qp, mp_ptr scratch) { mp_size_t qn; - mp_limb_t cy; - mp_ptr tp; + mp_limb_t cy, cx, qh; mp_limb_t r; + mp_size_t tn, wn; - qn = nn - dn; - - if (qn == 0) - { - MPN_COPY (rp, np, dn); - return; - } +#define tp scratch +#define scratch_out (scratch + tn) - tp = scratch; + qn = nn - dn; np += qn; qp += qn; - MPN_COPY (rp, np, dn); + qh = mpn_cmp (np, dp, dn) >= 0; + if (qh != 0) + mpn_sub_n (rp, np, dp, dn); + else + MPN_COPY (rp, np, dn); + + if (qn == 0) + return qh; /* Degenerate use. Should we allow this? */ while (qn > 0) { @@ -271,36 +266,30 @@ mpn_preinv_mu_div_qr (mp_ptr qp, by the upper part of the partial remainder R. */ mpn_mul_n (tp, rp + dn - in, ip, in); /* mulhi */ cy = mpn_add_n (qp, tp + in, rp + dn - in, in); /* I's msb implicit */ - ASSERT_ALWAYS (cy == 0); /* FIXME */ + ASSERT_ALWAYS (cy == 0); + + qn -= in; /* Compute the product of the quotient block and the divisor D, to be subtracted from the partial remainder combined with new limbs from the - dividend N. We only really need the low dn limbs. */ -#if WANT_FFT - if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD)) - { - /* Use the wrap-around trick. */ - mp_size_t m, wn; - int k; - - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - wn = dn + in - m; /* number of wrapped limbs */ - - mpn_mul_fft (tp, m, dp, dn, qp, in, k); + dividend N. We only really need the low dn+1 limbs. */ + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn + 1); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ if (wn > 0) { - cy = mpn_add_n (tp, tp, rp + dn - wn, wn); - mpn_incr_u (tp + wn, cy); - - cy = mpn_cmp (rp + dn - in, tp + dn, m - dn) < 0; - mpn_decr_u (tp, cy); + cy = mpn_sub_n (tp, tp, rp + dn - wn, wn); + cy = mpn_sub_1 (tp + wn, tp + wn, tn - wn, cy); + cx = mpn_cmp (rp + dn - in, tp + dn, tn - dn) < 0; + ASSERT_ALWAYS (cx >= cy); + mpn_incr_u (tp, cx - cy); } } - else -#endif - mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */ r = rp[dn - in] - tp[dn]; @@ -352,112 +341,65 @@ mpn_preinv_mu_div_qr (mp_ptr qp, printf ("\n"); } ); - - qn -= in; } -} - -#define THRES 100 /* FIXME: somewhat arbitrary */ -#ifdef CHECK -#undef THRES -#define THRES 1 -#endif + return qh; +} -mp_limb_t -mpn_mu_div_qr (mp_ptr qp, - mp_ptr rp, - mp_ptr np, - mp_size_t nn, - mp_srcptr dp, - mp_size_t dn, - mp_ptr scratch) +/* In case k=0 (automatic choice), we distinguish 3 cases: + (a) dn < qn: in = ceil(qn / ceil(qn/dn)) + (b) dn/3 < qn <= dn: in = ceil(qn / 2) + (c) qn < dn/3: in = qn + In all cases we have in <= dn. + */ +mp_size_t +mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k) { - mp_size_t qn; + mp_size_t in; - qn = nn - dn; - if (qn + THRES < dn) + if (k == 0) { - /* |______________|________| dividend nn - |_______|________| divisor dn - - |______| quotient (prel) qn - - |_______________| quotient * ignored-part-of(divisor) dn-1 - */ - - mp_limb_t cy, x; - - if (mpn_cmp (np + nn - (qn + 1), dp + dn - (qn + 1), qn + 1) >= 0) + mp_size_t b; + if (qn > dn) { - /* Quotient is 111...111, could optimize this rare case at some point. */ - mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch); - return 0; + /* Compute an inverse size that is a nice partition of the quotient. */ + b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ + in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ + } + else if (3 * qn > dn) + { + in = (qn - 1) / 2 + 1; /* b = 2 */ } - - /* Compute a preliminary quotient and a partial remainder by dividing the - most significant limbs of each operand. */ - mpn_mu_div_qr2 (qp, rp + nn - (2 * qn + 1), - np + nn - (2 * qn + 1), 2 * qn + 1, - dp + dn - (qn + 1), qn + 1, - scratch); - - /* Multiply the quotient by the divisor limbs ignored above. */ - if (dn - (qn + 1) > qn) - mpn_mul (scratch, dp, dn - (qn + 1), qp, qn); /* prod is dn-1 limbs */ else - mpn_mul (scratch, qp, qn, dp, dn - (qn + 1)); /* prod is dn-1 limbs */ - - cy = mpn_sub_n (rp, np, scratch, nn - (2 * qn + 1)); - cy = mpn_sub_nc (rp + nn - (2 * qn + 1), - rp + nn - (2 * qn + 1), - scratch + nn - (2 * qn + 1), - qn, cy); - x = rp[dn - 1]; - rp[dn - 1] = x - cy; - if (cy > x) { - mpn_decr_u (qp, 1); - mpn_add_n (rp, rp, dp, dn); + in = (qn - 1) / 1 + 1; /* b = 1 */ } } else { - return mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch); + mp_size_t xn; + xn = MIN (dn, qn); + in = (xn - 1) / k + 1; } - return 0; /* FIXME */ + return in; } mp_size_t mpn_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, int mua_k) { - mp_size_t qn, m; - int k; + mp_size_t itch_local = mpn_mulmod_bnm1_next_size (dn + 1); + mp_size_t in = mpn_mu_div_qr_choose_in (nn - dn, dn, mua_k); + mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in); - /* FIXME: This isn't very carefully written, and might grossly overestimate - the amount of scratch needed, and might perhaps also underestimate it, - leading to potential buffer overruns. In particular k=0 might lead to - gross overestimates. */ + return in + itch_local + itch_out; +} - if (dn == 1) - return nn; +mp_size_t +mpn_preinv_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, mp_size_t in) +{ + mp_size_t itch_local = mpn_mulmod_bnm1_next_size (dn + 1); + mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in); - qn = nn - dn; - if (qn >= dn) - { - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - return (mua_k <= 1 - ? 6 * dn - : m + 2 * dn); - } - else - { - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - return (mua_k <= 1 - ? m + 4 * qn - : m + 2 * qn); - } + return itch_local + itch_out; } diff --git a/contrib/gmp/mpn/generic/mu_divappr_q.c b/contrib/gmp/mpn/generic/mu_divappr_q.c index 0a0434399f..0e9afa3c69 100644 --- a/contrib/gmp/mpn/generic/mu_divappr_q.c +++ b/contrib/gmp/mpn/generic/mu_divappr_q.c @@ -7,12 +7,11 @@ Contributed to the GNU project by Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -30,64 +29,30 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* We use the "misunderstanding algorithm" (MUA), discovered by Paul Zimmermann - and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of - Jebelean's bidirectional exact division algorithm. - - The idea of this algorithm is to compute a smaller inverted value than used - in the standard Barrett algorithm, and thus save time in the Newton - iterations, and pay just a small price when using the inverted value for - developing quotient bits. - - Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the - "wrap around" trick. Based on the GMP divexact code and inspired by code - contributed to GMP by Karl Hasselstroem. +/* + The idea of the algorithm used herein is to compute a smaller inverted value + than used in the standard Barrett algorithm, and thus save time in the + Newton iterations, and pay just a small price when using the inverted value + for developing quotient bits. This algorithm was presented at ICMS 2006. */ - -/* CAUTION: This code and the code in mu_div_qr.c should be edited in lockstep. +/* CAUTION: This code and the code in mu_div_qr.c should be edited in sync. Things to work on: - * Passing k isn't a great interface. Either 'in' should be passed, or - determined by the code. - - * The current mpn_mu_div_qr_itch isn't exactly scientifically written. - Scratch space buffer overruns are not unlikely before some analysis is - applied. Since scratch requirements are expected to change, such an - analysis will have to wait til things settle. - - * This isn't optimal when the remainder isn't needed, since the final - multiplication could be made special and take O(1) time on average, in that - case. This is particularly bad when qn << dn. At some level, code as in - GMP 4 mpn_tdiv_qr should be used, effectively dividing the leading 2qn - dividend limbs by the qn divisor limbs. - - * This isn't optimal when the quotient isn't needed, as it might take a lot - of space. The computation is always needed, though, so there is not time - to save with special code. - * The itch/scratch scheme isn't perhaps such a good idea as it once seemed, - demonstrated by the fact that the mpn_inv function's scratch needs means - that we need to keep a large allocation long after it is needed. Things - are worse as mpn_mul_fft does not accept any scratch parameter, which means - we'll have a large memory hole while in mpn_mul_fft. In general, a peak - scratch need in the beginning of a function isn't well-handled by the - itch/scratch scheme. - - * Some ideas from comments in divexact.c apply to this code too. + demonstrated by the fact that the mpn_invertappr function's scratch needs + mean that we need to keep a large allocation long after it is needed. + Things are worse as mpn_mul_fft does not accept any scratch parameter, + which means we'll have a large memory hole while in mpn_mul_fft. In + general, a peak scratch need in the beginning of a function isn't + well-handled by the itch/scratch scheme. */ -/* the NOSTAT stuff handles properly the case where files are concatenated */ -#ifdef NOSTAT -#undef STAT -#endif - #ifdef STAT #undef STAT #define STAT(x) x #else -#define NOSTAT #define STAT(x) #endif @@ -96,68 +61,22 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" -/* In case k=0 (automatic choice), we distinguish 3 cases: - (a) dn < qn: in = ceil(qn / ceil(qn/dn)) - (b) dn/3 < qn <= dn: in = ceil(qn / 2) - (c) qn < dn/3: in = qn - In all cases we have in <= dn. - */ -mp_size_t -mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k) -{ - mp_size_t in; - - if (k == 0) - { - mp_size_t b; - if (qn > dn) - { - /* Compute an inverse size that is a nice partition of the quotient. */ - b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ - in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ - } - else if (3 * qn > dn) - { - in = (qn - 1) / 2 + 1; /* b = 2 */ - } - else - { - in = (qn - 1) / 1 + 1; /* b = 1 */ - } - } - else - { - mp_size_t xn; - xn = MIN (dn, qn); - in = (xn - 1) / k + 1; - } - - return in; -} - mp_limb_t mpn_mu_divappr_q (mp_ptr qp, - mp_ptr np, + mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, mp_ptr scratch) { mp_size_t qn, in; - mp_limb_t cy; + mp_limb_t cy, qh; mp_ptr ip, tp; - /* FIXME: We should probably not handle tiny operands, but do it for now. */ - if (dn == 1) - { - mpn_divrem_1 (scratch, 0L, np, nn, dp[0]); - MPN_COPY (qp, scratch, nn - 1); - return scratch[nn - 1]; - } + ASSERT (dn > 1); qn = nn - dn; -#if 1 /* If Q is smaller than D, truncate operands. */ if (qn + 1 < dn) { @@ -165,18 +84,7 @@ mpn_mu_divappr_q (mp_ptr qp, nn -= dn - (qn + 1); dp += dn - (qn + 1); dn = qn + 1; - - /* Since D is cut here, we can have a carry in N'/D' even if we don't - have it for N/D. */ - if (mpn_cmp (np + nn - (qn + 1), dp, qn + 1) >= 0) - { /* quotient is 111...111 */ - mp_size_t i; - for (i = 0; i <= qn; i ++) - qp[i] = ~ (mp_limb_t) 0; - return 0; - } } -#endif /* Compute the inverse size. */ in = mpn_mu_divappr_q_choose_in (qn, dn, 0); @@ -185,7 +93,7 @@ mpn_mu_divappr_q (mp_ptr qp, #if 1 /* This alternative inverse computation method gets slightly more accurate results. FIXMEs: (1) Temp allocation needs not analysed (2) itch function - not adapted (3) mpn_invert scratch needs not met. */ + not adapted (3) mpn_invertappr scratch needs not met. */ ip = scratch; tp = scratch + in + 1; @@ -194,7 +102,7 @@ mpn_mu_divappr_q (mp_ptr qp, { MPN_COPY (tp + 1, dp, in); tp[0] = 1; - mpn_invert (ip, tp, in + 1, NULL); + mpn_invertappr (ip, tp, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } else @@ -204,7 +112,7 @@ mpn_mu_divappr_q (mp_ptr qp, MPN_ZERO (ip, in); else { - mpn_invert (ip, tp, in + 1, NULL); + mpn_invertappr (ip, tp, in + 1, NULL); MPN_COPY_INCR (ip, ip + 1, in); } } @@ -220,11 +128,11 @@ mpn_mu_divappr_q (mp_ptr qp, { tp[in + 1] = 0; MPN_COPY (tp + in + 2, dp, in); - mpn_invert (tp, tp + in + 1, in + 1, NULL); + mpn_invertappr (tp, tp + in + 1, in + 1, NULL); } else { - mpn_invert (tp, dp + dn - (in + 1), in + 1, NULL); + mpn_invertappr (tp, dp + dn - (in + 1), in + 1, NULL); } cy = mpn_sub_1 (tp, tp, in + 1, GMP_NUMB_HIGHBIT); if (UNLIKELY (cy != 0)) @@ -232,23 +140,14 @@ mpn_mu_divappr_q (mp_ptr qp, MPN_COPY (ip, tp + 1, in); #endif -/* We can't really handle qh = 1 like this since we'd here clobber N, which is - not allowed in the way we've defined this function's API. */ -#if 0 - qh = mpn_cmp (np + qn, dp, dn) >= 0; - if (qh != 0) - mpn_sub_n (np + qn, np + qn, dp, dn); -#endif - - mpn_preinv_mu_divappr_q (qp, np, nn, dp, dn, ip, in, scratch + in); + qh = mpn_preinv_mu_divappr_q (qp, np, nn, dp, dn, ip, in, scratch + in); -/* return qh; */ - return 0; + return qh; } -void +mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr qp, - mp_ptr np, + mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, @@ -256,24 +155,28 @@ mpn_preinv_mu_divappr_q (mp_ptr qp, mp_size_t in, mp_ptr scratch) { - mp_ptr rp; mp_size_t qn; - mp_limb_t cy; - mp_ptr tp; + mp_limb_t cy, cx, qh; mp_limb_t r; + mp_size_t tn, wn; - qn = nn - dn; - - if (qn == 0) - return; +#define rp scratch +#define tp (scratch + dn) +#define scratch_out (scratch + dn + tn) - rp = scratch; - tp = scratch + dn; + qn = nn - dn; np += qn; qp += qn; - MPN_COPY (rp, np, dn); + qh = mpn_cmp (np, dp, dn) >= 0; + if (qh != 0) + mpn_sub_n (rp, np, dp, dn); + else + MPN_COPY (rp, np, dn); + + if (qn == 0) + return qh; /* Degenerate use. Should we allow this? */ while (qn > 0) { @@ -289,7 +192,7 @@ mpn_preinv_mu_divappr_q (mp_ptr qp, by the upper part of the partial remainder R. */ mpn_mul_n (tp, rp + dn - in, ip, in); /* mulhi */ cy = mpn_add_n (qp, tp + in, rp + dn - in, in); /* I's msb implicit */ - ASSERT_ALWAYS (cy == 0); /* FIXME */ + ASSERT_ALWAYS (cy == 0); qn -= in; if (qn == 0) @@ -298,31 +201,23 @@ mpn_preinv_mu_divappr_q (mp_ptr qp, /* Compute the product of the quotient block and the divisor D, to be subtracted from the partial remainder combined with new limbs from the dividend N. We only really need the low dn limbs. */ -#if WANT_FFT - if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD)) - { - /* Use the wrap-around trick. */ - mp_size_t m, wn; - int k; - - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - wn = dn + in - m; /* number of wrapped limbs */ - - mpn_mul_fft (tp, m, dp, dn, qp, in, k); + if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD)) + mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */ + else + { + tn = mpn_mulmod_bnm1_next_size (dn + 1); + mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out); + wn = dn + in - tn; /* number of wrapped limbs */ if (wn > 0) { - cy = mpn_add_n (tp, tp, rp + dn - wn, wn); - mpn_incr_u (tp + wn, cy); - - cy = mpn_cmp (rp + dn - in, tp + dn, m - dn) < 0; - mpn_decr_u (tp, cy); + cy = mpn_sub_n (tp, tp, rp + dn - wn, wn); + cy = mpn_sub_1 (tp + wn, tp + wn, tn - wn, cy); + cx = mpn_cmp (rp + dn - in, tp + dn, tn - dn) < 0; + ASSERT_ALWAYS (cx >= cy); + mpn_incr_u (tp, cx - cy); } } - else -#endif - mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */ r = rp[dn - in] - tp[dn]; @@ -378,45 +273,80 @@ mpn_preinv_mu_divappr_q (mp_ptr qp, /* FIXME: We should perhaps be somewhat more elegant in our rounding of the quotient. For now, just make sure the returned quotient is >= the real - quotient. */ + quotient; add 3 with saturating arithmetic. */ qn = nn - dn; - cy = mpn_add_1 (qp, qp, qn, 3); + cy += mpn_add_1 (qp, qp, qn, 3); if (cy != 0) { - MPN_ZERO (qp, qn); - mpn_sub_1 (qp, qp, qn, 1); + if (qh != 0) + { + /* Return a quotient of just 1-bits, with qh set. */ + mp_size_t i; + for (i = 0; i < qn; i++) + qp[i] = GMP_NUMB_MAX; + } + else + { + /* Propagate carry into qh. */ + qh = 1; + } } + + return qh; } +/* In case k=0 (automatic choice), we distinguish 3 cases: + (a) dn < qn: in = ceil(qn / ceil(qn/dn)) + (b) dn/3 < qn <= dn: in = ceil(qn / 2) + (c) qn < dn/3: in = qn + In all cases we have in <= dn. + */ mp_size_t -mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k) +mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k) { - mp_size_t qn, m; - int k; - - /* FIXME: This isn't very carefully written, and might grossly overestimate - the amount of scratch needed, and might perhaps also underestimate it, - leading to potential buffer overruns. In particular k=0 might lead to - gross overestimates. */ - - if (dn == 1) - return nn; + mp_size_t in; - qn = nn - dn; - if (qn >= dn) + if (k == 0) { - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - return dn + (mua_k <= 1 - ? 6 * dn - : m + 2 * dn); + mp_size_t b; + if (qn > dn) + { + /* Compute an inverse size that is a nice partition of the quotient. */ + b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */ + in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */ + } + else if (3 * qn > dn) + { + in = (qn - 1) / 2 + 1; /* b = 2 */ + } + else + { + in = (qn - 1) / 1 + 1; /* b = 1 */ + } } else { - k = mpn_fft_best_k (dn + 1, 0); - m = mpn_fft_next_size (dn + 1, k); - return dn + (mua_k <= 1 - ? m + 4 * qn - : m + 2 * qn); + mp_size_t xn; + xn = MIN (dn, qn); + in = (xn - 1) / k + 1; + } + + return in; +} + +mp_size_t +mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k) +{ + mp_size_t qn, in, itch_local, itch_out; + + qn = nn - dn; + if (qn + 1 < dn) + { + dn = qn + 1; } + in = mpn_mu_divappr_q_choose_in (qn, dn, mua_k); + + itch_local = mpn_mulmod_bnm1_next_size (dn + 1); + itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in); + return in + dn + itch_local + itch_out; } diff --git a/contrib/gmp/mpn/generic/mul.c b/contrib/gmp/mpn/generic/mul.c index 489e1f524f..c176b45a27 100644 --- a/contrib/gmp/mpn/generic/mul.c +++ b/contrib/gmp/mpn/generic/mul.c @@ -3,7 +3,7 @@ Contributed to the GNU project by Torbjorn Granlund. Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005, -2006, 2007 Free Software Foundation, Inc. +2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -28,6 +28,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MUL_BASECASE_MAX_UN 500 #endif +#define TOOM33_OK(an,bn) (6 + 2 * an < 3 * bn) +#define TOOM44_OK(an,bn) (12 + 3 * an < 4 * bn) + /* Multiply the natural numbers u (pointed to by UP, with UN limbs) and v (pointed to by VP, with VN limbs), and store the result at PRODP. The result is UN + VN limbs. Return the most significant limb of the result. @@ -40,6 +43,34 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ 2. PRODP != UP and PRODP != VP, i.e. the destination must be distinct from the multiplier and the multiplicand. */ +/* + * The cutoff lines in the toomX2 and toomX3 code are now exactly between the + ideal lines of the surrounding algorithms. Is that optimal? + + * The toomX3 code now uses a structure similar to the one of toomX2, except + that it loops longer in the unbalanced case. The result is that the + remaining area might have un < vn. Should we fix the toomX2 code in a + similar way? + + * The toomX3 code is used for the largest non-FFT unbalanced operands. It + therefore calls mpn_mul recursively for certain cases. + + * Allocate static temp space using THRESHOLD variables (except for toom44 + when !WANT_FFT). That way, we can typically have no TMP_ALLOC at all. + + * We sort ToomX2 algorithms together, assuming the toom22, toom32, toom42 + have the same vn threshold. This is not true, we should actually use + mul_basecase for slightly larger operands for toom32 than for toom22, and + even larger for toom42. + + * That problem is even more prevalent for toomX3. We therefore use special + THRESHOLD variables there. + + * Is our ITCH allocation correct? +*/ + +#define ITCH (16*vn + 100) + mp_limb_t mpn_mul (mp_ptr prodp, mp_srcptr up, mp_size_t un, @@ -53,13 +84,11 @@ mpn_mul (mp_ptr prodp, if (un == vn) { if (up == vp) - mpn_sqr_n (prodp, up, un); + mpn_sqr (prodp, up, un); else mpn_mul_n (prodp, up, vp, un); - return prodp[2 * un - 1]; } - - if (vn < MUL_KARATSUBA_THRESHOLD) + else if (vn < MUL_TOOM22_THRESHOLD) { /* plain schoolbook multiplication */ /* Unless un is very large, or else if have an applicable mpn_mul_N, @@ -98,9 +127,9 @@ mpn_mul (mp_ptr prodp, The parts marked with X are the parts whose sums are copied into the temporary buffer. */ - mp_limb_t tp[MUL_KARATSUBA_THRESHOLD_LIMIT]; + mp_limb_t tp[MUL_TOOM22_THRESHOLD_LIMIT]; mp_limb_t cy; - ASSERT (MUL_KARATSUBA_THRESHOLD <= MUL_KARATSUBA_THRESHOLD_LIMIT); + ASSERT (MUL_TOOM22_THRESHOLD <= MUL_TOOM22_THRESHOLD_LIMIT); mpn_mul_basecase (prodp, up, MUL_BASECASE_MAX_UN, vp, vn); prodp += MUL_BASECASE_MAX_UN; @@ -111,7 +140,7 @@ mpn_mul (mp_ptr prodp, { mpn_mul_basecase (prodp, up, MUL_BASECASE_MAX_UN, vp, vn); cy = mpn_add_n (prodp, prodp, tp, vn); /* add back preserved triangle */ - mpn_incr_u (prodp + vn, cy); /* safe? */ + mpn_incr_u (prodp + vn, cy); prodp += MUL_BASECASE_MAX_UN; MPN_COPY (tp, prodp, vn); /* preserve high triangle */ up += MUL_BASECASE_MAX_UN; @@ -123,100 +152,233 @@ mpn_mul (mp_ptr prodp, } else { - ASSERT_ALWAYS (un > 0); + ASSERT (un > 0); mpn_mul_basecase (prodp, vp, vn, up, un); } cy = mpn_add_n (prodp, prodp, tp, vn); /* add back preserved triangle */ - mpn_incr_u (prodp + vn, cy); /* safe? */ + mpn_incr_u (prodp + vn, cy); } - return prodp[un + vn - 1]; } + else if (BELOW_THRESHOLD (vn, MUL_TOOM33_THRESHOLD)) + { + /* Use ToomX2 variants */ + mp_ptr scratch; + TMP_SDECL; TMP_SMARK; + + scratch = TMP_SALLOC_LIMBS (ITCH); + + /* FIXME: This condition (repeated in the loop below) leaves from a vn*vn + square to a (3vn-1)*vn rectangle. Leaving such a rectangle is hardly + wise; we would get better balance by slightly moving the bound. We + will sometimes end up with un < vn, like the the X3 arm below. */ + if (un >= 3 * vn) + { + mp_limb_t cy; + mp_ptr ws; + + /* The maximum ws usage is for the mpn_mul result. */ + ws = TMP_SALLOC_LIMBS (4 * vn); + + mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch); + un -= 2 * vn; + up += 2 * vn; + prodp += 2 * vn; + + while (un >= 3 * vn) + { + mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch); + un -= 2 * vn; + up += 2 * vn; + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, 2 * vn); + mpn_incr_u (prodp + vn, cy); + prodp += 2 * vn; + } - if (ABOVE_THRESHOLD ((un + vn) >> 1, MUL_FFT_THRESHOLD) && - ABOVE_THRESHOLD (vn, MUL_FFT_THRESHOLD / 3)) /* FIXME */ + /* vn <= un < 3vn */ + + if (4 * un < 5 * vn) + mpn_toom22_mul (ws, up, un, vp, vn, scratch); + else if (4 * un < 7 * vn) + mpn_toom32_mul (ws, up, un, vp, vn, scratch); + else + mpn_toom42_mul (ws, up, un, vp, vn, scratch); + + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, un); + mpn_incr_u (prodp + vn, cy); + } + else + { + if (4 * un < 5 * vn) + mpn_toom22_mul (prodp, up, un, vp, vn, scratch); + else if (4 * un < 7 * vn) + mpn_toom32_mul (prodp, up, un, vp, vn, scratch); + else + mpn_toom42_mul (prodp, up, un, vp, vn, scratch); + } + TMP_SFREE; + } + else if (BELOW_THRESHOLD ((un + vn) >> 1, MUL_FFT_THRESHOLD) || + BELOW_THRESHOLD (3 * vn, MUL_FFT_THRESHOLD)) { - mpn_mul_fft_full (prodp, up, un, vp, vn); - return prodp[un + vn - 1]; + /* Handle the largest operands that are not in the FFT range. The 2nd + condition makes very unbalanced operands avoid the FFT code (except + perhaps as coefficient products of the Toom code. */ + + if (BELOW_THRESHOLD (vn, MUL_TOOM44_THRESHOLD) || !TOOM44_OK (un, vn)) + { + /* Use ToomX3 variants */ + mp_ptr scratch; + TMP_SDECL; TMP_SMARK; + + scratch = TMP_SALLOC_LIMBS (ITCH); + + if (2 * un >= 5 * vn) + { + mp_limb_t cy; + mp_ptr ws; + + /* The maximum ws usage is for the mpn_mul result. */ + ws = TMP_SALLOC_LIMBS (7 * vn >> 1); + + if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD)) + mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch); + else + mpn_toom63_mul (prodp, up, 2 * vn, vp, vn, scratch); + un -= 2 * vn; + up += 2 * vn; + prodp += 2 * vn; + + while (2 * un >= 5 * vn) /* un >= 2.5vn */ + { + if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD)) + mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch); + else + mpn_toom63_mul (ws, up, 2 * vn, vp, vn, scratch); + un -= 2 * vn; + up += 2 * vn; + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, 2 * vn); + mpn_incr_u (prodp + vn, cy); + prodp += 2 * vn; + } + + /* vn / 2 <= un < 2.5vn */ + + if (un < vn) + mpn_mul (ws, vp, vn, up, un); + else + mpn_mul (ws, up, un, vp, vn); + + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, un); + mpn_incr_u (prodp + vn, cy); + } + else + { + if (6 * un < 7 * vn) + mpn_toom33_mul (prodp, up, un, vp, vn, scratch); + else if (2 * un < 3 * vn) + { + if (BELOW_THRESHOLD (vn, MUL_TOOM32_TO_TOOM43_THRESHOLD)) + mpn_toom32_mul (prodp, up, un, vp, vn, scratch); + else + mpn_toom43_mul (prodp, up, un, vp, vn, scratch); + } + else if (6 * un < 11 * vn) + { + if (4 * un < 7 * vn) + { + if (BELOW_THRESHOLD (vn, MUL_TOOM32_TO_TOOM53_THRESHOLD)) + mpn_toom32_mul (prodp, up, un, vp, vn, scratch); + else + mpn_toom53_mul (prodp, up, un, vp, vn, scratch); + } + else + { + if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM53_THRESHOLD)) + mpn_toom42_mul (prodp, up, un, vp, vn, scratch); + else + mpn_toom53_mul (prodp, up, un, vp, vn, scratch); + } + } + else + { + if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD)) + mpn_toom42_mul (prodp, up, un, vp, vn, scratch); + else + mpn_toom63_mul (prodp, up, un, vp, vn, scratch); + } + } + TMP_SFREE; + } + else + { + mp_ptr scratch; + TMP_DECL; TMP_MARK; + + if (BELOW_THRESHOLD (vn, MUL_TOOM6H_THRESHOLD)) + { + scratch = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (un, vn)); + mpn_toom44_mul (prodp, up, un, vp, vn, scratch); + } + else if (BELOW_THRESHOLD (vn, MUL_TOOM8H_THRESHOLD)) + { + scratch = TMP_ALLOC_LIMBS (mpn_toom6h_mul_itch (un, vn)); + mpn_toom6h_mul (prodp, up, un, vp, vn, scratch); + } + else + { + scratch = TMP_ALLOC_LIMBS (mpn_toom8h_mul_itch (un, vn)); + mpn_toom8h_mul (prodp, up, un, vp, vn, scratch); + } + TMP_FREE; + } } + else + { + if (un >= 8 * vn) + { + mp_limb_t cy; + mp_ptr ws; + TMP_DECL; TMP_MARK; - { - mp_ptr ws; - mp_ptr scratch; -#if WANT_ASSERT - mp_ptr ssssp; -#endif - TMP_DECL; - TMP_MARK; - -#define WSALL (4 * vn) - ws = TMP_SALLOC_LIMBS (WSALL + 1); - -#define ITCH ((un + vn) * 4 + 100) - scratch = TMP_ALLOC_LIMBS (ITCH + 1); -#if WANT_ASSERT - ssssp = scratch + ITCH; - ws[WSALL] = 0xbabecafe; - ssssp[0] = 0xbeef; -#endif + /* The maximum ws usage is for the mpn_mul result. */ + ws = TMP_BALLOC_LIMBS (9 * vn >> 1); - if (un >= 3 * vn) - { - mp_limb_t cy; - - mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch); - un -= 2 * vn; - up += 2 * vn; - prodp += 2 * vn; - - while (un >= 3 * vn) - { - mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch); - un -= 2 * vn; - up += 2 * vn; - cy = mpn_add_n (prodp, prodp, ws, vn); - MPN_COPY (prodp + vn, ws + vn, 2 * vn); - mpn_incr_u (prodp + vn, cy); - prodp += 2 * vn; - } - - if (5 * un > 9 * vn) - { - mpn_toom42_mul (ws, up, un, vp, vn, scratch); - cy = mpn_add_n (prodp, prodp, ws, vn); - MPN_COPY (prodp + vn, ws + vn, un); - mpn_incr_u (prodp + vn, cy); - } - else if (9 * un > 10 * vn) - { - mpn_toom32_mul (ws, up, un, vp, vn, scratch); - cy = mpn_add_n (prodp, prodp, ws, vn); - MPN_COPY (prodp + vn, ws + vn, un); - mpn_incr_u (prodp + vn, cy); - } - else - { - mpn_toom22_mul (ws, up, un, vp, vn, scratch); - cy = mpn_add_n (prodp, prodp, ws, vn); - MPN_COPY (prodp + vn, ws + vn, un); - mpn_incr_u (prodp + vn, cy); - } - - ASSERT (ws[WSALL] == 0xbabecafe); - ASSERT (ssssp[0] == 0xbeef); - TMP_FREE; - return prodp[un + vn - 1]; - } - - if (un * 5 > vn * 9) - mpn_toom42_mul (prodp, up, un, vp, vn, scratch); - else if (9 * un > 10 * vn) - mpn_toom32_mul (prodp, up, un, vp, vn, scratch); - else - mpn_toom22_mul (prodp, up, un, vp, vn, scratch); - - ASSERT (ws[WSALL] == 0xbabecafe); - ASSERT (ssssp[0] == 0xbeef); - TMP_FREE; - return prodp[un + vn - 1]; - } + mpn_fft_mul (prodp, up, 3 * vn, vp, vn); + un -= 3 * vn; + up += 3 * vn; + prodp += 3 * vn; + + while (2 * un >= 7 * vn) /* un >= 3.5vn */ + { + mpn_fft_mul (ws, up, 3 * vn, vp, vn); + un -= 3 * vn; + up += 3 * vn; + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, 3 * vn); + mpn_incr_u (prodp + vn, cy); + prodp += 3 * vn; + } + + /* vn / 2 <= un < 3.5vn */ + + if (un < vn) + mpn_mul (ws, vp, vn, up, un); + else + mpn_mul (ws, up, un, vp, vn); + + cy = mpn_add_n (prodp, prodp, ws, vn); + MPN_COPY (prodp + vn, ws + vn, un); + mpn_incr_u (prodp + vn, cy); + + TMP_FREE; + } + else + mpn_fft_mul (prodp, up, un, vp, vn); + } + + return prodp[un + vn - 1]; /* historic */ } diff --git a/contrib/gmp/mpn/generic/mul_basecase.c b/contrib/gmp/mpn/generic/mul_basecase.c index 4f02545d57..726bd6741f 100644 --- a/contrib/gmp/mpn/generic/mul_basecase.c +++ b/contrib/gmp/mpn/generic/mul_basecase.c @@ -33,7 +33,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Note that prodp gets usize+vsize limbs stored, even if the actual result only needs usize+vsize-1. - There's no good reason to call here with vsize>=MUL_KARATSUBA_THRESHOLD. + There's no good reason to call here with vsize>=MUL_TOOM22_THRESHOLD. Currently this is allowed, but it might not be in the future. This is the most critical code for multiplication. All multiplies rely diff --git a/contrib/gmp/mpn/generic/mul_fft.c b/contrib/gmp/mpn/generic/mul_fft.c index 836a89a001..798f83df1c 100644 --- a/contrib/gmp/mpn/generic/mul_fft.c +++ b/contrib/gmp/mpn/generic/mul_fft.c @@ -6,8 +6,8 @@ SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -Free Software Foundation, Inc. +Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -60,76 +60,79 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" #ifdef WANT_ADDSUB -#include "generic/addsub_n.c" -#define HAVE_NATIVE_mpn_addsub_n 1 +#include "generic/add_n_sub_n.c" +#define HAVE_NATIVE_mpn_add_n_sub_n 1 #endif static mp_limb_t mpn_mul_fft_internal -__GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, int, int, mp_ptr *, mp_ptr *, - mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_size_t, int **, mp_ptr, - int)); +__GMP_PROTO ((mp_ptr, mp_size_t, int, mp_ptr *, mp_ptr *, + mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_size_t, int **, mp_ptr, int)); +static void mpn_mul_fft_decompose +__GMP_PROTO ((mp_ptr, mp_ptr *, int, int, mp_srcptr, mp_size_t, int, int, mp_ptr)); /* Find the best k to use for a mod 2^(m*GMP_NUMB_BITS)+1 FFT for m >= n. - sqr==0 if for a multiply, sqr==1 for a square. - Don't declare it static since it is needed by tuneup. -*/ -#ifdef MUL_FFT_TABLE2 + We have sqr=0 if for a multiply, sqr=1 for a square. + There are three generations of this code; we keep the old ones as long as + some gmp-mparam.h is not updated. */ + + +/*****************************************************************************/ + +#if TUNE_PROGRAM_BUILD || (defined (MUL_FFT_TABLE3) && defined (SQR_FFT_TABLE3)) -#if defined (MUL_FFT_TABLE2_SIZE) && defined (SQR_FFT_TABLE2_SIZE) -#if MUL_FFT_TABLE2_SIZE > SQR_FFT_TABLE2_SIZE -#define FFT_TABLE2_SIZE MUL_FFT_TABLE2_SIZE +#ifndef FFT_TABLE3_SIZE /* When tuning, this is define in gmp-impl.h */ +#if defined (MUL_FFT_TABLE3_SIZE) && defined (SQR_FFT_TABLE3_SIZE) +#if MUL_FFT_TABLE3_SIZE > SQR_FFT_TABLE3_SIZE +#define FFT_TABLE3_SIZE MUL_FFT_TABLE3_SIZE #else -#define FFT_TABLE2_SIZE SQR_FFT_TABLE2_SIZE +#define FFT_TABLE3_SIZE SQR_FFT_TABLE3_SIZE #endif #endif - -#ifndef FFT_TABLE2_SIZE -#define FFT_TABLE2_SIZE 200 #endif -/* FIXME: The format of this should change to need less space. - Perhaps put n and k in the same 32-bit word, with n shifted-down - (k-2) steps, and k using the 4-5 lowest bits. That's possible since - n-1 is highly divisible. - Alternatively, separate n and k out into separate arrays. */ -struct nk { - unsigned int n:27; - unsigned int k:5; -}; +#ifndef FFT_TABLE3_SIZE +#define FFT_TABLE3_SIZE 200 +#endif -static struct nk mpn_fft_table2[2][FFT_TABLE2_SIZE] = +FFT_TABLE_ATTRS struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE] = { - MUL_FFT_TABLE2, - SQR_FFT_TABLE2 + MUL_FFT_TABLE3, + SQR_FFT_TABLE3 }; int mpn_fft_best_k (mp_size_t n, int sqr) { - struct nk *tab; + FFT_TABLE_ATTRS struct fft_table_nk *fft_tab, *tab; + mp_size_t tab_n, thres; int last_k; - last_k = 4; - for (tab = mpn_fft_table2[sqr] + 1; ; tab++) + fft_tab = mpn_fft_table3[sqr]; + last_k = fft_tab->k; + for (tab = fft_tab + 1; ; tab++) { - if (n < tab->n) + tab_n = tab->n; + thres = tab_n << last_k; + if (n <= thres) break; last_k = tab->k; } return last_k; } + +#define MPN_FFT_BEST_READY 1 #endif -#if !defined (MUL_FFT_TABLE2) || TUNE_PROGRAM_BUILD +/*****************************************************************************/ + +#if ! defined (MPN_FFT_BEST_READY) FFT_TABLE_ATTRS mp_size_t mpn_fft_table[2][MPN_FFT_TABLE_SIZE] = { MUL_FFT_TABLE, SQR_FFT_TABLE }; -#endif -#if !defined (MUL_FFT_TABLE2) int mpn_fft_best_k (mp_size_t n, int sqr) { @@ -147,6 +150,9 @@ mpn_fft_best_k (mp_size_t n, int sqr) } #endif +/*****************************************************************************/ + + /* Returns smallest possible number of limbs >= pl for a fft of size 2^k, i.e. smallest multiple of 2^k >= pl. @@ -180,65 +186,26 @@ mpn_fft_initl (int **l, int k) } } -/* Shift {up, n} of cnt bits to the left, store the complemented result - in {rp, n}, and output the shifted bits (not complemented). - Same as: - cc = mpn_lshift (rp, up, n, cnt); - mpn_com_n (rp, rp, n); - return cc; - - Assumes n >= 1, 1 < cnt < GMP_NUMB_BITS, rp >= up. -*/ -#ifndef HAVE_NATIVE_mpn_lshiftc -#undef mpn_lshiftc -static mp_limb_t -mpn_lshiftc (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt) -{ - mp_limb_t high_limb, low_limb; - unsigned int tnc; - mp_size_t i; - mp_limb_t retval; - up += n; - rp += n; - - tnc = GMP_NUMB_BITS - cnt; - low_limb = *--up; - retval = low_limb >> tnc; - high_limb = (low_limb << cnt); - - for (i = n - 1; i != 0; i--) - { - low_limb = *--up; - *--rp = (~(high_limb | (low_limb >> tnc))) & GMP_NUMB_MASK; - high_limb = low_limb << cnt; - } - *--rp = (~high_limb) & GMP_NUMB_MASK; - - return retval; -} -#endif - -/* r <- a*2^e mod 2^(n*GMP_NUMB_BITS)+1 with a = {a, n+1} +/* r <- a*2^d mod 2^(n*GMP_NUMB_BITS)+1 with a = {a, n+1} Assumes a is semi-normalized, i.e. a[n] <= 1. r and a must have n+1 limbs, and not overlap. */ static void mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n) { - int sh, negate; + int sh; mp_limb_t cc, rd; sh = d % GMP_NUMB_BITS; d /= GMP_NUMB_BITS; - negate = d >= n; - if (negate) - d -= n; - if (negate) + if (d >= n) /* negate */ { /* r[0..d-1] <-- lshift(a[n-d]..a[n-1], sh) r[d..n-1] <-- -lshift(a[0]..a[n-d-1], sh) */ + + d -= n; if (sh != 0) { /* no out shift below since a[n] <= 1 */ @@ -250,7 +217,7 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n) { MPN_COPY (r, a + n - d, d); rd = a[n]; - mpn_com_n (r + d, a, n - d); + mpn_com (r + d, a, n - d); cc = 0; } @@ -263,54 +230,52 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n) cc++; mpn_incr_u (r, cc); - rd ++; + rd++; /* rd might overflow when sh=GMP_NUMB_BITS-1 */ cc = (rd == 0) ? 1 : rd; r = r + d + (rd == 0); mpn_incr_u (r, cc); - - return; - } - - /* if negate=0, - r[0..d-1] <-- -lshift(a[n-d]..a[n-1], sh) - r[d..n-1] <-- lshift(a[0]..a[n-d-1], sh) - */ - if (sh != 0) - { - /* no out bits below since a[n] <= 1 */ - mpn_lshiftc (r, a + n - d, d + 1, sh); - rd = ~r[d]; - /* {r, d+1} = {a+n-d, d+1} << sh */ - cc = mpn_lshift (r + d, a, n - d, sh); /* {r+d, n-d} = {a, n-d}<= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD)) { int k, K2, nprime2, Nprime2, M2, maxLK, l, Mp2; - int **_fft_l; + int **fft_l; mp_ptr *Ap, *Bp, A, B, T; k = mpn_fft_best_k (n, sqr); @@ -497,23 +462,30 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K) Ap = TMP_ALLOC_MP_PTRS (K2); Bp = TMP_ALLOC_MP_PTRS (K2); - A = TMP_ALLOC_LIMBS (2 * K2 * (nprime2 + 1)); + A = TMP_ALLOC_LIMBS (2 * (nprime2 + 1) << k); T = TMP_ALLOC_LIMBS (2 * (nprime2 + 1)); - B = A + K2 * (nprime2 + 1); - _fft_l = TMP_ALLOC_TYPE (k + 1, int *); + B = A + ((nprime2 + 1) << k); + fft_l = TMP_ALLOC_TYPE (k + 1, int *); for (i = 0; i <= k; i++) - _fft_l[i] = TMP_ALLOC_TYPE (1< %d times %dx%d (%1.2f)\n", n, n, K2, nprime2, nprime2, 2.0*(double)n/nprime2/K2)); for (i = 0; i < K; i++, ap++, bp++) { + mp_limb_t cy; mpn_fft_normalize (*ap, n); if (!sqr) mpn_fft_normalize (*bp, n); - mpn_mul_fft_internal (*ap, *ap, *bp, n, k, K2, Ap, Bp, A, B, nprime2, - l, Mp2, _fft_l, T, 1); + + mpn_mul_fft_decompose (A, Ap, K2, nprime2, *ap, (l << k) + 1, l, Mp2, T); + if (!sqr) + mpn_mul_fft_decompose (B, Bp, K2, nprime2, *bp, (l << k) + 1, l, Mp2, T); + + cy = mpn_mul_fft_internal (*ap, n, k, Ap, Bp, A, B, nprime2, + l, Mp2, fft_l, T, sqr); + (*ap)[n] = cy; } } else @@ -529,7 +501,7 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K) a = *ap++; b = *bp++; if (sqr) - mpn_sqr_n (tp, a, n); + mpn_sqr (tp, a, n); else mpn_mul_n (tp, b, a, n); if (a[n] != 0) @@ -562,8 +534,8 @@ mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp) if (K == 2) { mp_limb_t cy; -#if HAVE_NATIVE_mpn_addsub_n - cy = mpn_addsub_n (Ap[0], Ap[1], Ap[0], Ap[1], n + 1) & 1; +#if HAVE_NATIVE_mpn_add_n_sub_n + cy = mpn_add_n_sub_n (Ap[0], Ap[1], Ap[0], Ap[1], n + 1) & 1; #else MPN_COPY (tp, Ap[0], n + 1); mpn_add_n (Ap[0], Ap[0], Ap[1], n + 1); @@ -594,15 +566,14 @@ mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp) } -/* A <- A/2^k mod 2^(n*GMP_NUMB_BITS)+1 */ +/* R <- A/2^k mod 2^(n*GMP_NUMB_BITS)+1 */ static void mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, int k, mp_size_t n) { int i; ASSERT (r != a); - i = 2 * n * GMP_NUMB_BITS; - i = (i - k) % i; /* FIXME: This % looks superfluous */ + i = 2 * n * GMP_NUMB_BITS - k; mpn_fft_mul_2exp_modF (r, a, i, n); /* 1/2^k = 2^(2nL-k) mod 2^(n*GMP_NUMB_BITS)+1 */ /* normalize so that R < 2^(n*GMP_NUMB_BITS)+1 */ @@ -730,48 +701,30 @@ mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, int K, int nprime, mp_srcptr n, } /* op <- n*m mod 2^N+1 with fft of size 2^k where N=pl*GMP_NUMB_BITS - n and m have respectively nl and ml limbs - op must have space for pl+1 limbs if rec=1 (and pl limbs if rec=0). + op is pl limbs, its high bit is returned. One must have pl = mpn_fft_next_size (pl, k). T must have space for 2 * (nprime + 1) limbs. - - If rec=0, then store only the pl low bits of the result, and return - the out carry. */ static mp_limb_t -mpn_mul_fft_internal (mp_ptr op, mp_srcptr n, mp_srcptr m, mp_size_t pl, - int k, int K, - mp_ptr *Ap, mp_ptr *Bp, - mp_ptr A, mp_ptr B, +mpn_mul_fft_internal (mp_ptr op, mp_size_t pl, int k, + mp_ptr *Ap, mp_ptr *Bp, mp_ptr A, mp_ptr B, mp_size_t nprime, mp_size_t l, mp_size_t Mp, - int **_fft_l, - mp_ptr T, int rec) + int **fft_l, mp_ptr T, int sqr) { - int i, sqr, pla, lo, sh, j; + int K, i, pla, lo, sh, j; mp_ptr p; mp_limb_t cc; - sqr = n == m; - - TRACE (printf ("pl=%ld k=%d K=%d np=%ld l=%ld Mp=%ld rec=%d sqr=%d\n", - pl,k,K,nprime,l,Mp,rec,sqr)); - - /* decomposition of inputs into arrays Ap[i] and Bp[i] */ - if (rec) - { - mpn_mul_fft_decompose (A, Ap, K, nprime, n, K * l + 1, l, Mp, T); - if (!sqr) - mpn_mul_fft_decompose (B, Bp, K, nprime, m, K * l + 1, l, Mp, T); - } + K = 1 << k; /* direct fft's */ - mpn_fft_fft (Ap, K, _fft_l + k, 2 * Mp, nprime, 1, T); + mpn_fft_fft (Ap, K, fft_l + k, 2 * Mp, nprime, 1, T); if (!sqr) - mpn_fft_fft (Bp, K, _fft_l + k, 2 * Mp, nprime, 1, T); + mpn_fft_fft (Bp, K, fft_l + k, 2 * Mp, nprime, 1, T); /* term to term multiplications */ - mpn_fft_mul_modF_K (Ap, (sqr) ? Ap : Bp, nprime, K); + mpn_fft_mul_modF_K (Ap, sqr ? Ap : Bp, nprime, K); /* inverse fft's */ mpn_fft_fftinv (Ap, K, 2 * Mp, nprime, T); @@ -835,11 +788,7 @@ mpn_mul_fft_internal (mp_ptr op, mp_srcptr n, mp_srcptr m, mp_size_t pl, /* here p < 2^(2M) [K 2^(M(K-1)) + (K-1) 2^(M(K-2)) + ... ] < K 2^(2M) [2^(M(K-1)) + 2^(M(K-2)) + ... ] < K 2^(2M) 2^(M(K-1))*2 = 2^(M*K+M+k+1) */ - i = mpn_fft_norm_modF (op, pl, p, pla); - if (rec) /* store the carry out */ - op[pl] = i; - - return i; + return mpn_fft_norm_modF (op, pl, p, pla); } /* return the lcm of a and 2^k */ @@ -866,7 +815,7 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl, int K, maxLK, i; mp_size_t N, Nprime, nprime, M, Mp, l; mp_ptr *Ap, *Bp, A, T, B; - int **_fft_l; + int **fft_l; int sqr = (n == m && nl == ml); mp_limb_t h; TMP_DECL; @@ -876,10 +825,10 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl, TMP_MARK; N = pl * GMP_NUMB_BITS; - _fft_l = TMP_ALLOC_TYPE (k + 1, int *); + fft_l = TMP_ALLOC_TYPE (k + 1, int *); for (i = 0; i <= k; i++) - _fft_l[i] = TMP_ALLOC_TYPE (1 << i, int); - mpn_fft_initl (_fft_l, k); + fft_l[i] = TMP_ALLOC_TYPE (1 << i, int); + mpn_fft_initl (fft_l, k); K = 1 << k; M = N >> k; /* N = 2^k M */ l = 1 + (M - 1) / GMP_NUMB_BITS; @@ -914,25 +863,29 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl, pl, pl, K, nprime, nprime, 2.0 * (double) N / Nprime / K); printf (" temp space %ld\n", 2 * K * (nprime + 1))); - A = __GMP_ALLOCATE_FUNC_LIMBS (2 * K * (nprime + 1)); - B = A + K * (nprime + 1); + A = TMP_ALLOC_LIMBS (K * (nprime + 1)); Ap = TMP_ALLOC_MP_PTRS (K); - Bp = TMP_ALLOC_MP_PTRS (K); - - /* special decomposition for main call */ - /* nl is the number of significant limbs in n */ mpn_mul_fft_decompose (A, Ap, K, nprime, n, nl, l, Mp, T); - if (n != m) - mpn_mul_fft_decompose (B, Bp, K, nprime, m, ml, l, Mp, T); - - h = mpn_mul_fft_internal (op, n, m, pl, k, K, Ap, Bp, A, B, nprime, l, Mp, _fft_l, T, 0); + if (sqr) + { + mp_size_t pla; + pla = l * (K - 1) + nprime + 1; /* number of required limbs for p */ + B = TMP_ALLOC_LIMBS (pla); + Bp = TMP_ALLOC_MP_PTRS (K); + } + else + { + B = TMP_ALLOC_LIMBS (K * (nprime + 1)); + Bp = TMP_ALLOC_MP_PTRS (K); + mpn_mul_fft_decompose (B, Bp, K, nprime, m, ml, l, Mp, T); + } + h = mpn_mul_fft_internal (op, pl, k, Ap, Bp, A, B, nprime, l, Mp, fft_l, T, sqr); TMP_FREE; - __GMP_FREE_FUNC_LIMBS (A, 2 * K * (nprime + 1)); - return h; } +#if WANT_OLD_FFT_FULL /* multiply {n, nl} by {m, ml}, and put the result in {op, nl+ml} */ void mpn_mul_fft_full (mp_ptr op, @@ -960,7 +913,7 @@ mpn_mul_fft_full (mp_ptr op, pl2 = (2 * pl - 1) / 5; /* ceil (2pl/5) - 1 */ do { - pl2 ++; + pl2++; k2 = mpn_fft_best_k (pl2, sqr); /* best fft size for pl2 limbs */ pl2 = mpn_fft_next_size (pl2, k2); pl3 = 3 * pl2 / 2; /* since k>=FFT_FIRST_K=4, pl2 is a multiple of 2^4, @@ -974,23 +927,23 @@ mpn_mul_fft_full (mp_ptr op, ASSERT_ALWAYS(pl3 <= pl); cc = mpn_mul_fft (op, pl3, n, nl, m, ml, k3); /* mu */ - ASSERT_ALWAYS(cc == 0); + ASSERT(cc == 0); pad_op = __GMP_ALLOCATE_FUNC_LIMBS (pl2); cc = mpn_mul_fft (pad_op, pl2, n, nl, m, ml, k2); /* lambda */ cc = -cc + mpn_sub_n (pad_op, pad_op, op, pl2); /* lambda - low(mu) */ /* 0 <= cc <= 1 */ - ASSERT_ALWAYS(0 <= cc && cc <= 1); + ASSERT(0 <= cc && cc <= 1); l = pl3 - pl2; /* l = pl2 / 2 since pl3 = 3/2 * pl2 */ c2 = mpn_add_n (pad_op, pad_op, op + pl2, l); cc = mpn_add_1 (pad_op + l, pad_op + l, l, (mp_limb_t) c2) - cc; - ASSERT_ALWAYS(-1 <= cc && cc <= 1); + ASSERT(-1 <= cc && cc <= 1); if (cc < 0) cc = mpn_add_1 (pad_op, pad_op, pl2, (mp_limb_t) -cc); - ASSERT_ALWAYS(0 <= cc && cc <= 1); + ASSERT(0 <= cc && cc <= 1); /* now lambda-mu = {pad_op, pl2} - cc mod 2^(pl2*GMP_NUMB_BITS)+1 */ oldcc = cc; -#if HAVE_NATIVE_mpn_addsub_n - c2 = mpn_addsub_n (pad_op + l, pad_op, pad_op, pad_op + l, l); +#if HAVE_NATIVE_mpn_add_n_sub_n + c2 = mpn_add_n_sub_n (pad_op + l, pad_op, pad_op, pad_op + l, l); /* c2 & 1 is the borrow, c2 & 2 is the carry */ cc += c2 >> 1; /* carry out from high <- low + high */ c2 = c2 & 1; /* borrow out from low <- low - high */ @@ -1036,3 +989,4 @@ mpn_mul_fft_full (mp_ptr op, /* since the final result has at most pl limbs, no carry out below */ mpn_add_1 (op + pl2, op + pl2, pl - pl2, (mp_limb_t) c2); } +#endif diff --git a/contrib/gmp/mpn/generic/mul_n.c b/contrib/gmp/mpn/generic/mul_n.c index 4aa25f9b58..80cfb08f99 100644 --- a/contrib/gmp/mpn/generic/mul_n.c +++ b/contrib/gmp/mpn/generic/mul_n.c @@ -1,12 +1,7 @@ -/* mpn_mul_n and helper function -- Multiply/square natural numbers. - - THE HELPER FUNCTIONS IN THIS FILE (meaning everything except mpn_mul_n) ARE - INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH - DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE - OR DISAPPEAR IN A FUTURE GNU MP RELEASE. +/* mpn_mul_n -- multiply natural numbers. Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -2005 Free Software Foundation, Inc. +2005, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -27,669 +22,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "longlong.h" - -/* Multiplies using 3 half-sized mults and so on recursively. - * p[0..2*n-1] := product of a[0..n-1] and b[0..n-1]. - * No overlap of p[...] with a[...] or b[...]. - * ws is workspace. - */ - -void -mpn_kara_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n, mp_ptr ws) -{ - mp_limb_t w, w0, w1; - mp_size_t n2; - mp_srcptr x, y; - mp_size_t i; - int sign; - - n2 = n >> 1; - ASSERT (n2 > 0); - - if ((n & 1) != 0) - { - /* Odd length. */ - mp_size_t n1, n3, nm1; - - n3 = n - n2; - - sign = 0; - w = a[n2]; - if (w != 0) - w -= mpn_sub_n (p, a, a + n3, n2); - else - { - i = n2; - do - { - --i; - w0 = a[i]; - w1 = a[n3 + i]; - } - while (w0 == w1 && i != 0); - if (w0 < w1) - { - x = a + n3; - y = a; - sign = ~0; - } - else - { - x = a; - y = a + n3; - } - mpn_sub_n (p, x, y, n2); - } - p[n2] = w; - - w = b[n2]; - if (w != 0) - w -= mpn_sub_n (p + n3, b, b + n3, n2); - else - { - i = n2; - do - { - --i; - w0 = b[i]; - w1 = b[n3 + i]; - } - while (w0 == w1 && i != 0); - if (w0 < w1) - { - x = b + n3; - y = b; - sign = ~sign; - } - else - { - x = b; - y = b + n3; - } - mpn_sub_n (p + n3, x, y, n2); - } - p[n] = w; - - n1 = n + 1; - if (n2 < MUL_KARATSUBA_THRESHOLD) - { - if (n3 < MUL_KARATSUBA_THRESHOLD) - { - mpn_mul_basecase (ws, p, n3, p + n3, n3); - mpn_mul_basecase (p, a, n3, b, n3); - } - else - { - mpn_kara_mul_n (ws, p, p + n3, n3, ws + n1); - mpn_kara_mul_n (p, a, b, n3, ws + n1); - } - mpn_mul_basecase (p + n1, a + n3, n2, b + n3, n2); - } - else - { - mpn_kara_mul_n (ws, p, p + n3, n3, ws + n1); - mpn_kara_mul_n (p, a, b, n3, ws + n1); - mpn_kara_mul_n (p + n1, a + n3, b + n3, n2, ws + n1); - } - - if (sign) - mpn_add_n (ws, p, ws, n1); - else - mpn_sub_n (ws, p, ws, n1); - - nm1 = n - 1; - if (mpn_add_n (ws, p + n1, ws, nm1)) - { - mp_limb_t x = (ws[nm1] + 1) & GMP_NUMB_MASK; - ws[nm1] = x; - if (x == 0) - ws[n] = (ws[n] + 1) & GMP_NUMB_MASK; - } - if (mpn_add_n (p + n3, p + n3, ws, n1)) - { - mpn_incr_u (p + n1 + n3, 1); - } - } - else - { - /* Even length. */ - i = n2; - do - { - --i; - w0 = a[i]; - w1 = a[n2 + i]; - } - while (w0 == w1 && i != 0); - sign = 0; - if (w0 < w1) - { - x = a + n2; - y = a; - sign = ~0; - } - else - { - x = a; - y = a + n2; - } - mpn_sub_n (p, x, y, n2); - - i = n2; - do - { - --i; - w0 = b[i]; - w1 = b[n2 + i]; - } - while (w0 == w1 && i != 0); - if (w0 < w1) - { - x = b + n2; - y = b; - sign = ~sign; - } - else - { - x = b; - y = b + n2; - } - mpn_sub_n (p + n2, x, y, n2); - - /* Pointwise products. */ - if (n2 < MUL_KARATSUBA_THRESHOLD) - { - mpn_mul_basecase (ws, p, n2, p + n2, n2); - mpn_mul_basecase (p, a, n2, b, n2); - mpn_mul_basecase (p + n, a + n2, n2, b + n2, n2); - } - else - { - mpn_kara_mul_n (ws, p, p + n2, n2, ws + n); - mpn_kara_mul_n (p, a, b, n2, ws + n); - mpn_kara_mul_n (p + n, a + n2, b + n2, n2, ws + n); - } - - /* Interpolate. */ - if (sign) - w = mpn_add_n (ws, p, ws, n); - else - w = -mpn_sub_n (ws, p, ws, n); - w += mpn_add_n (ws, p + n, ws, n); - w += mpn_add_n (p + n2, p + n2, ws, n); - MPN_INCR_U (p + n2 + n, 2 * n - (n2 + n), w); - } -} - -void -mpn_kara_sqr_n (mp_ptr p, mp_srcptr a, mp_size_t n, mp_ptr ws) -{ - mp_limb_t w, w0, w1; - mp_size_t n2; - mp_srcptr x, y; - mp_size_t i; - - n2 = n >> 1; - ASSERT (n2 > 0); - - if ((n & 1) != 0) - { - /* Odd length. */ - mp_size_t n1, n3, nm1; - - n3 = n - n2; - - w = a[n2]; - if (w != 0) - w -= mpn_sub_n (p, a, a + n3, n2); - else - { - i = n2; - do - { - --i; - w0 = a[i]; - w1 = a[n3 + i]; - } - while (w0 == w1 && i != 0); - if (w0 < w1) - { - x = a + n3; - y = a; - } - else - { - x = a; - y = a + n3; - } - mpn_sub_n (p, x, y, n2); - } - p[n2] = w; - - n1 = n + 1; - - /* n2 is always either n3 or n3-1 so maybe the two sets of tests here - could be combined. But that's not important, since the tests will - take a miniscule amount of time compared to the function calls. */ - if (BELOW_THRESHOLD (n3, SQR_BASECASE_THRESHOLD)) - { - mpn_mul_basecase (ws, p, n3, p, n3); - mpn_mul_basecase (p, a, n3, a, n3); - } - else if (BELOW_THRESHOLD (n3, SQR_KARATSUBA_THRESHOLD)) - { - mpn_sqr_basecase (ws, p, n3); - mpn_sqr_basecase (p, a, n3); - } - else - { - mpn_kara_sqr_n (ws, p, n3, ws + n1); /* (x-y)^2 */ - mpn_kara_sqr_n (p, a, n3, ws + n1); /* x^2 */ - } - if (BELOW_THRESHOLD (n2, SQR_BASECASE_THRESHOLD)) - mpn_mul_basecase (p + n1, a + n3, n2, a + n3, n2); - else if (BELOW_THRESHOLD (n2, SQR_KARATSUBA_THRESHOLD)) - mpn_sqr_basecase (p + n1, a + n3, n2); - else - mpn_kara_sqr_n (p + n1, a + n3, n2, ws + n1); /* y^2 */ - - /* Since x^2+y^2-(x-y)^2 = 2xy >= 0 there's no need to track the - borrow from mpn_sub_n. If it occurs then it'll be cancelled by a - carry from ws[n]. Further, since 2xy fits in n1 limbs there won't - be any carry out of ws[n] other than cancelling that borrow. */ - - mpn_sub_n (ws, p, ws, n1); /* x^2-(x-y)^2 */ - - nm1 = n - 1; - if (mpn_add_n (ws, p + n1, ws, nm1)) /* x^2+y^2-(x-y)^2 = 2xy */ - { - mp_limb_t x = (ws[nm1] + 1) & GMP_NUMB_MASK; - ws[nm1] = x; - if (x == 0) - ws[n] = (ws[n] + 1) & GMP_NUMB_MASK; - } - if (mpn_add_n (p + n3, p + n3, ws, n1)) - { - mpn_incr_u (p + n1 + n3, 1); - } - } - else - { - /* Even length. */ - i = n2; - do - { - --i; - w0 = a[i]; - w1 = a[n2 + i]; - } - while (w0 == w1 && i != 0); - if (w0 < w1) - { - x = a + n2; - y = a; - } - else - { - x = a; - y = a + n2; - } - mpn_sub_n (p, x, y, n2); - - /* Pointwise products. */ - if (BELOW_THRESHOLD (n2, SQR_BASECASE_THRESHOLD)) - { - mpn_mul_basecase (ws, p, n2, p, n2); - mpn_mul_basecase (p, a, n2, a, n2); - mpn_mul_basecase (p + n, a + n2, n2, a + n2, n2); - } - else if (BELOW_THRESHOLD (n2, SQR_KARATSUBA_THRESHOLD)) - { - mpn_sqr_basecase (ws, p, n2); - mpn_sqr_basecase (p, a, n2); - mpn_sqr_basecase (p + n, a + n2, n2); - } - else - { - mpn_kara_sqr_n (ws, p, n2, ws + n); - mpn_kara_sqr_n (p, a, n2, ws + n); - mpn_kara_sqr_n (p + n, a + n2, n2, ws + n); - } - - /* Interpolate. */ - w = -mpn_sub_n (ws, p, ws, n); - w += mpn_add_n (ws, p + n, ws, n); - w += mpn_add_n (p + n2, p + n2, ws, n); - MPN_INCR_U (p + n2 + n, 2 * n - (n2 + n), w); - } -} - -/****************************************************************************** - * * - * Toom 3-way multiplication and squaring * - * * - *****************************************************************************/ - -/* Starts from: - {v0,2k} (stored in {c,2k}) - {vm1,2k+1} (which sign is sa, and absolute value is stored in {vm1,2k+1}) - {v1,2k+1} (stored in {c+2k,2k+1}) - {v2,2k+1} - {vinf,twor} (stored in {c+4k,twor}, except the first limb, saved in vinf0) - - ws is temporary space, and should have at least twor limbs. - - put in {c, 2n} where n = 2k+twor the value of {v0,2k} (already in place) - + B^k * {tm1, 2k+1} - + B^(2k) * {t1, 2k+1} - + B^(3k) * {t2, 2k+1} - + B^(4k) * {vinf,twor} (high twor-1 limbs already in place) - where {t1, 2k+1} = ({v1, 2k+1} + sa * {vm1, 2k+1}- 2*{v0,2k})/2-*{vinf,twor} - {t2, 2k+1} = (3*({v1,2k+1}-{v0,2k})-sa*{vm1,2k+1}+{v2,2k+1})/6-2*{vinf,twor} - {tm1,2k+1} = ({v1,2k+1}-sa*{vm1,2k+1}/2-{t2,2k+1} - - Exact sequence described in a comment in mpn_toom3_mul_n. - mpn_toom3_mul_n() and mpn_toom3_sqr_n() implement steps 1-2. - mpn_toom_interpolate_5pts() implements steps 3-4. - - Reference: What About Toom-Cook Matrices Optimality? Marco Bodrato - and Alberto Zanoni, October 19, 2006, http://bodrato.it/papers/#CIVV2006 - - ************* saved note **************** - Think about: - - The evaluated point a-b+c stands a good chance of having a zero carry - limb, a+b+c would have a 1/4 chance, and 4*a+2*b+c a 1/8 chance, roughly. - Perhaps this could be tested and stripped. Doing so before recursing - would be better than stripping at the start of mpn_toom3_mul_n/sqr_n, - since then the recursion could be based on the new size. Although in - truth the kara vs toom3 crossover is never so exact that one limb either - way makes a difference. - - A small value like 1 or 2 for the carry could perhaps also be handled - with an add_n or addlsh1_n. Would that be faster than an extra limb on a - (recursed) multiply/square? -*/ - -#define TOOM3_MUL_REC(p, a, b, n, ws) \ - do { \ - if (MUL_TOOM3_THRESHOLD / 3 < MUL_KARATSUBA_THRESHOLD \ - && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ - mpn_mul_basecase (p, a, n, b, n); \ - else if (BELOW_THRESHOLD (n, MUL_TOOM3_THRESHOLD)) \ - mpn_kara_mul_n (p, a, b, n, ws); \ - else \ - mpn_toom3_mul_n (p, a, b, n, ws); \ - } while (0) - -#define TOOM3_SQR_REC(p, a, n, ws) \ - do { \ - if (SQR_TOOM3_THRESHOLD / 3 < SQR_BASECASE_THRESHOLD \ - && BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD)) \ - mpn_mul_basecase (p, a, n, a, n); \ - else if (SQR_TOOM3_THRESHOLD / 3 < SQR_KARATSUBA_THRESHOLD \ - && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \ - mpn_sqr_basecase (p, a, n); \ - else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \ - mpn_kara_sqr_n (p, a, n, ws); \ - else \ - mpn_toom3_sqr_n (p, a, n, ws); \ - } while (0) - -/* The necessary temporary space T(n) satisfies T(n)=0 for n < THRESHOLD, - and T(n) <= max(2n+2, 6k+3, 4k+3+T(k+1)) otherwise, where k = ceil(n/3). - - Assuming T(n) >= 2n, 6k+3 <= 4k+3+T(k+1). - Similarly, 2n+2 <= 6k+2 <= 4k+3+T(k+1). - - With T(n) = 2n+S(n), this simplifies to S(n) <= 9 + S(k+1). - Since THRESHOLD >= 17, we have n/(k+1) >= 19/8 - thus S(n) <= S(n/(19/8)) + 9 thus S(n) <= 9*log(n)/log(19/8) <= 8*log2(n). -*/ - -void -mpn_toom3_mul_n (mp_ptr c, mp_srcptr a, mp_srcptr b, mp_size_t n, mp_ptr t) -{ - mp_size_t k, k1, kk1, r, twok, twor; - mp_limb_t cy, cc, saved, vinf0; - mp_ptr trec; - int sa, sb; - mp_ptr c1, c2, c3, c4, c5; - - ASSERT(GMP_NUMB_BITS >= 6); - ASSERT(n >= 17); /* so that r <> 0 and 5k+3 <= 2n */ - - /* - The algorithm is the following: - - 0. k = ceil(n/3), r = n - 2k, B = 2^(GMP_NUMB_BITS), t = B^k - 1. split a and b in three parts each a0, a1, a2 and b0, b1, b2 - with a0, a1, b0, b1 of k limbs, and a2, b2 of r limbs - 2. Evaluation: vm1 may be negative, the other can not. - v0 <- a0*b0 - v1 <- (a0+a1+a2)*(b0+b1+b2) - v2 <- (a0+2*a1+4*a2)*(b0+2*b1+4*b2) - vm1 <- (a0-a1+a2)*(b0-b1+b2) - vinf <- a2*b2 - 3. Interpolation: every result is positive, all divisions are exact - t2 <- (v2 - vm1)/3 - tm1 <- (v1 - vm1)/2 - t1 <- (v1 - v0) - t2 <- (t2 - t1)/2 - t1 <- (t1 - tm1 - vinf) - t2 <- (t2 - 2*vinf) - tm1 <- (tm1 - t2) - 4. result is c0+c1*t+c2*t^2+c3*t^3+c4*t^4 where - c0 <- v0 - c1 <- tm1 - c2 <- t1 - c3 <- t2 - c4 <- vinf - */ - - k = (n + 2) / 3; /* ceil(n/3) */ - twok = 2 * k; - k1 = k + 1; - kk1 = k + k1; - r = n - twok; /* last chunk */ - twor = 2 * r; - - c1 = c + k; - c2 = c1 + k; - c3 = c2 + k; - c4 = c3 + k; - c5 = c4 + k; - - trec = t + 4 * k + 3; /* trec = v2 + (2k+2) */ - - /* put a0+a2 in {c, k+1}, and b0+b2 in {c+4k+2, k+1}; - put a0+a1+a2 in {t, k+1} and b0+b1+b2 in {t+k+1,k+1} - [????requires 5k+3 <= 2n, ie. n >= 9] */ - cy = mpn_add_n (c, a, a + twok, r); - cc = mpn_add_n (c4 + 2, b, b + twok, r); - if (r < k) - { - __GMPN_ADD_1 (cy, c + r, a + r, k - r, cy); - __GMPN_ADD_1 (cc, c4 + 2 + r, b + r, k - r, cc); - } - - /* Put in {t, k+1} the sum - * (a_0+a_2) - stored in {c, k+1} - - * + - * a_1 - stored in {a+k, k} */ - t[k] = (c1[0] = cy) + mpn_add_n (t, c, a + k, k); - /* ^ ^ - * carry of a_0 + a_2 carry of (a_0+a_2) + a_1 - - */ - - /* Put in {t+k+1, k+1} the sum of the two values - * (b_0+b_2) - stored in {c1+1, k+1} - - * + - * b_1 - stored in {b+k, k} */ - t[kk1] = (c5[3] = cc) + mpn_add_n (t + k1, c4 + 2, b + k, k); - /* ^ ^ - * carry of b_0 + b_2 carry of (b_0+b_2) + b_1 */ - -#define v2 (t+2*k+1) - - /* compute v1 := (a0+a1+a2)*(b0+b1+b2) in {t, 2k+1}; - since v1 < 9*B^(2k), v1 uses only 2k+1 words if GMP_NUMB_BITS >= 4 */ - TOOM3_MUL_REC (c2, t, t + k1, k1, trec); - - /* c c2 c4 t - {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v1 */ - - /* put |a0-a1+a2| in {c, k+1} and |b0-b1+b2| in {c+4k+2,k+1} */ - /* (They're already there, actually) */ - - /* sa = sign(a0-a1+a2) */ - sa = (cy != 0) ? 1 : mpn_cmp (c, a + k, k); - c[k] = (sa >= 0) ? cy - mpn_sub_n (c, c, a + k, k) - : mpn_sub_n (c, a + k, c, k); - - sb = (cc != 0) ? 1 : mpn_cmp (c4 + 2, b + k, k); - c5[2] = (sb >= 0) ? cc - mpn_sub_n (c4 + 2, c4 + 2, b + k, k) - : mpn_sub_n (c4 + 2, b + k, c4 + 2, k); - sa *= sb; /* sign of vm1 */ - - /* compute vm1 := (a0-a1+a2)*(b0-b1+b2) in {t, 2k+1}; - since |vm1| < 4*B^(2k), vm1 uses only 2k+1 limbs */ - TOOM3_MUL_REC (t, c, c4 + 2, k1, trec); - - /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v1 vm1 - */ - - /* compute a0+2a1+4a2 in {c, k+1} and b0+2b1+4b2 in {c+4k+2, k+1} - [requires 5k+3 <= 2n, i.e. n >= 17] */ -#ifdef HAVE_NATIVE_mpn_addlsh1_n - c1[0] = mpn_addlsh1_n (c, a + k, a + twok, r); - c5[2] = mpn_addlsh1_n (c4 + 2, b + k, b + twok, r); - if (r < k) - { - __GMPN_ADD_1 (c1[0], c + r, a + k + r, k - r, c1[0]); - __GMPN_ADD_1 (c5[2], c4 + 2 + r, b + k + r, k - r, c5[2]); - } - c1[0] = 2 * c1[0] + mpn_addlsh1_n (c, a, c, k); - c5[2] = 2 * c5[2] + mpn_addlsh1_n (c4 + 2, b, c4 + 2, k); -#else - c[r] = mpn_lshift (c, a + twok, r, 1); - c4[r + 2] = mpn_lshift (c4 + 2, b + twok, r, 1); - if (r < k) - { - MPN_ZERO(c + r + 1, k - r); - MPN_ZERO(c4 + r + 3, k - r); - } - c1[0] += mpn_add_n (c, c, a + k, k); - c5[2] += mpn_add_n (c4 + 2, c4 + 2, b + k, k); - mpn_lshift (c, c, k1, 1); - mpn_lshift (c4 + 2, c4 + 2, k1, 1); - c1[0] += mpn_add_n (c, c, a, k); - c5[2] += mpn_add_n (c4 + 2, c4 + 2, b, k); -#endif - - /* compute v2 := (a0+2a1+4a2)*(b0+2b1+4b2) in {t+2k+1, 2k+1} - v2 < 49*B^k so v2 uses at most 2k+1 limbs if GMP_NUMB_BITS >= 6 */ - TOOM3_MUL_REC (v2, c, c4 + 2, k1, trec); - - /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v1 vm1 v2 - */ - - /* compute v0 := a0*b0 in {c, 2k} */ - TOOM3_MUL_REC (c, a, b, k, trec); - - /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v0 v1 vm1 v2 */ - - /* compute vinf := a2*b2 in {t+4k+2, 2r}: in {c4, 2r} */ - - saved = c4[0]; /* Remember v1's highest byte (will be overwritten). */ - TOOM3_MUL_REC (c4, a + twok, b + twok, r, trec); /* Overwrites c4[0]. */ - vinf0 = c4[0]; /* Remember vinf's lowest byte (will be overwritten).*/ - c4[0] = saved; /* Overwriting. Now v1 value is correct. */ - - /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v0 v1 vinf[1..] vm1 v2 */ - - mpn_toom_interpolate_5pts (c, v2, t, k, 2*r, sa, vinf0, trec); - -#undef v2 -} - -void -mpn_toom3_sqr_n (mp_ptr c, mp_srcptr a, mp_size_t n, mp_ptr t) -{ - mp_size_t k, k1, kk1, r, twok, twor; - mp_limb_t cy, saved, vinf0; - mp_ptr trec; - int sa; - mp_ptr c1, c2, c3, c4; - - ASSERT(GMP_NUMB_BITS >= 6); - ASSERT(n >= 17); /* so that r <> 0 and 5k+3 <= 2n */ - - /* the algorithm is the same as mpn_toom3_mul_n, with b=a */ - - k = (n + 2) / 3; /* ceil(n/3) */ - twok = 2 * k; - k1 = k + 1; - kk1 = k + k1; - r = n - twok; /* last chunk */ - twor = 2 * r; - - c1 = c + k; - c2 = c1 + k; - c3 = c2 + k; - c4 = c3 + k; - - trec = t + 4 * k + 3; /* trec = v2 + (2k+2) */ - - cy = mpn_add_n (c, a, a + twok, r); - if (r < k) - __GMPN_ADD_1 (cy, c + r, a + r, k - r, cy); - t[k] = (c1[0] = cy) + mpn_add_n (t, c, a + k, k); - -#define v2 (t+2*k+1) - - TOOM3_SQR_REC (c2, t, k1, trec); - - sa = (cy != 0) ? 1 : mpn_cmp (c, a + k, k); - c[k] = (sa >= 0) ? cy - mpn_sub_n (c, c, a + k, k) - : mpn_sub_n (c, a + k, c, k); - - TOOM3_SQR_REC (t, c, k1, trec); - -#ifdef HAVE_NATIVE_mpn_addlsh1_n - c1[0] = mpn_addlsh1_n (c, a + k, a + twok, r); - if (r < k) - __GMPN_ADD_1 (c1[0], c + r, a + k + r, k - r, c1[0]); - c1[0] = 2 * c1[0] + mpn_addlsh1_n (c, a, c, k); -#else - c[r] = mpn_lshift (c, a + twok, r, 1); - if (r < k) - MPN_ZERO(c + r + 1, k - r); - c1[0] += mpn_add_n (c, c, a + k, k); - mpn_lshift (c, c, k1, 1); - c1[0] += mpn_add_n (c, c, a, k); -#endif - - TOOM3_SQR_REC (v2, c, k1, trec); - - TOOM3_SQR_REC (c, a, k, trec); - - saved = c4[0]; - TOOM3_SQR_REC (c4, a + twok, r, trec); - vinf0 = c4[0]; - c4[0] = saved; - - mpn_toom_interpolate_5pts (c, v2, t, k, 2*r, 1, vinf0, trec); - -#undef v2 -} - void mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n) { @@ -697,31 +29,28 @@ mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n) ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n)); ASSERT (! MPN_OVERLAP_P (p, 2 * n, b, n)); - if (BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) + if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) { mpn_mul_basecase (p, a, n, b, n); } - else if (BELOW_THRESHOLD (n, MUL_TOOM3_THRESHOLD)) + else if (BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) { /* Allocate workspace of fixed size on stack: fast! */ - mp_limb_t ws[MPN_KARA_MUL_N_TSIZE (MUL_TOOM3_THRESHOLD_LIMIT-1)]; - ASSERT (MUL_TOOM3_THRESHOLD <= MUL_TOOM3_THRESHOLD_LIMIT); - mpn_kara_mul_n (p, a, b, n, ws); + mp_limb_t ws[mpn_toom22_mul_itch (MUL_TOOM33_THRESHOLD_LIMIT-1, + MUL_TOOM33_THRESHOLD_LIMIT-1)]; + ASSERT (MUL_TOOM33_THRESHOLD <= MUL_TOOM33_THRESHOLD_LIMIT); + mpn_toom22_mul (p, a, n, b, n, ws); } else if (BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) { mp_ptr ws; TMP_SDECL; TMP_SMARK; - ws = TMP_SALLOC_LIMBS (MPN_TOOM3_MUL_N_TSIZE (n)); - mpn_toom3_mul_n (p, a, b, n, ws); + ws = TMP_SALLOC_LIMBS (mpn_toom33_mul_itch (n, n)); + mpn_toom33_mul (p, a, n, b, n, ws); TMP_SFREE; } -#if WANT_FFT || TUNE_PROGRAM_BUILD - else if (BELOW_THRESHOLD (n, MUL_FFT_THRESHOLD)) -#else - else if (BELOW_THRESHOLD (n, MPN_TOOM44_MAX_N)) -#endif + else if (BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) { mp_ptr ws; TMP_SDECL; @@ -730,91 +59,28 @@ mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n) mpn_toom44_mul (p, a, n, b, n, ws); TMP_SFREE; } - else -#if WANT_FFT || TUNE_PROGRAM_BUILD - { - /* The current FFT code allocates its own space. That should probably - change. */ - mpn_mul_fft_full (p, a, n, b, n); - } -#else - { - /* Toom4 for large operands. */ - mp_ptr ws; - TMP_DECL; - TMP_MARK; - ws = TMP_BALLOC_LIMBS (mpn_toom44_mul_itch (n, n)); - mpn_toom44_mul (p, a, n, b, n, ws); - TMP_FREE; - } -#endif -} - -void -mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n) -{ - ASSERT (n >= 1); - ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n)); - -#if 0 - /* FIXME: Can this be removed? */ - if (n == 0) - return; -#endif - - if (BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD)) - { /* mul_basecase is faster than sqr_basecase on small sizes sometimes */ - mpn_mul_basecase (p, a, n, a, n); - } - else if (BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) - { - mpn_sqr_basecase (p, a, n); - } - else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) - { - /* Allocate workspace of fixed size on stack: fast! */ - mp_limb_t ws[MPN_KARA_SQR_N_TSIZE (SQR_TOOM3_THRESHOLD_LIMIT-1)]; - ASSERT (SQR_TOOM3_THRESHOLD <= SQR_TOOM3_THRESHOLD_LIMIT); - mpn_kara_sqr_n (p, a, n, ws); - } - else if (BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD)) + else if (BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD)) { mp_ptr ws; TMP_SDECL; TMP_SMARK; - ws = TMP_SALLOC_LIMBS (MPN_TOOM3_SQR_N_TSIZE (n)); - mpn_toom3_sqr_n (p, a, n, ws); + ws = TMP_SALLOC_LIMBS (mpn_toom6_mul_n_itch (n)); + mpn_toom6h_mul (p, a, n, b, n, ws); TMP_SFREE; } -#if WANT_FFT || TUNE_PROGRAM_BUILD - else if (BELOW_THRESHOLD (n, SQR_FFT_THRESHOLD)) -#else - else if (BELOW_THRESHOLD (n, MPN_TOOM44_MAX_N)) -#endif + else if (BELOW_THRESHOLD (n, MUL_FFT_THRESHOLD)) { mp_ptr ws; - TMP_SDECL; - TMP_SMARK; - ws = TMP_SALLOC_LIMBS (mpn_toom4_sqr_itch (n)); - mpn_toom4_sqr (p, a, n, ws); - TMP_SFREE; + TMP_DECL; + TMP_MARK; + ws = TMP_ALLOC_LIMBS (mpn_toom8_mul_n_itch (n)); + mpn_toom8h_mul (p, a, n, b, n, ws); + TMP_FREE; } else -#if WANT_FFT || TUNE_PROGRAM_BUILD { /* The current FFT code allocates its own space. That should probably change. */ - mpn_mul_fft_full (p, a, n, a, n); - } -#else - { - /* Toom4 for large operands. */ - mp_ptr ws; - TMP_DECL; - TMP_MARK; - ws = TMP_BALLOC_LIMBS (mpn_toom4_sqr_itch (n)); - mpn_toom4_sqr (p, a, n, ws); - TMP_FREE; + mpn_fft_mul (p, a, n, b, n); } -#endif } diff --git a/contrib/gmp/mpn/generic/mullow_basecase.c b/contrib/gmp/mpn/generic/mullo_basecase.c similarity index 89% rename from contrib/gmp/mpn/generic/mullow_basecase.c rename to contrib/gmp/mpn/generic/mullo_basecase.c index 72c48f65b4..ceea829dba 100644 --- a/contrib/gmp/mpn/generic/mullow_basecase.c +++ b/contrib/gmp/mpn/generic/mullo_basecase.c @@ -1,4 +1,4 @@ -/* mpn_mullow_basecase -- Internal routine to multiply two natural +/* mpn_mullo_basecase -- Internal routine to multiply two natural numbers of length m and n and return the low part. THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ */ void -mpn_mullow_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) +mpn_mullo_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) { mp_size_t i; diff --git a/contrib/gmp/mpn/generic/mullo_n.c b/contrib/gmp/mpn/generic/mullo_n.c new file mode 100644 index 0000000000..24c2c3c5ab --- /dev/null +++ b/contrib/gmp/mpn/generic/mullo_n.c @@ -0,0 +1,245 @@ +/* mpn_mullo_n -- multiply two n-limb numbers and return the low n limbs + of their products. + + Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato. + + THIS IS (FOR NOW) AN INTERNAL FUNCTION. IT IS ONLY SAFE TO REACH THIS + FUNCTION THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED + THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2004, 2005, 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + + +#ifndef MULLO_BASECASE_THRESHOLD +#define MULLO_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */ +#endif + +#ifndef MULLO_DC_THRESHOLD +#define MULLO_DC_THRESHOLD 3*MUL_TOOM22_THRESHOLD +#endif + +#ifndef MULLO_MUL_N_THRESHOLD +#define MULLO_MUL_N_THRESHOLD MUL_FFT_THRESHOLD +#endif + +#if TUNE_PROGRAM_BUILD +#define MAYBE_range_basecase 1 +#define MAYBE_range_toom22 1 +#else +#define MAYBE_range_basecase \ + ((MULLO_DC_THRESHOLD == 0 ? MULLO_BASECASE_THRESHOLD : MULLO_DC_THRESHOLD) < MUL_TOOM22_THRESHOLD*36/(36-11)) +#define MAYBE_range_toom22 \ + ((MULLO_DC_THRESHOLD == 0 ? MULLO_BASECASE_THRESHOLD : MULLO_DC_THRESHOLD) < MUL_TOOM33_THRESHOLD*36/(36-11) ) +#endif + +/* THINK: The DC strategy uses different constants in different Toom's + ranges. Something smoother? +*/ + +/* + Compute the least significant half of the product {xy,n}*{yp,n}, or + formally {rp,n} = {xy,n}*{yp,n} Mod (B^n). + + Above the given threshold, the Divide and Conquer strategy is used. + The operands are split in two, and a full product plus two mullo + are used to obtain the final result. The more natural strategy is to + split in two halves, but this is far from optimal when a + sub-quadratic multiplication is used. + + Mulders suggests an unbalanced split in favour of the full product, + split n = n1 + n2, where an = n1 <= n2 = (1-a)n; i.e. 0 < a <= 1/2. + + To compute the value of a, we assume that the cost of mullo for a + given size ML(n) is a fraction of the cost of a full product with + same size M(n), and the cost M(n)=n^e for some exponent 1 < e <= 2; + then we can write: + + ML(n) = 2*ML(an) + M((1-a)n) => k*M(n) = 2*k*M(n)*a^e + M(n)*(1-a)^e + + Given a value for e, want to minimise the value of k, i.e. the + function k=(1-a)^e/(1-2*a^e). + + With e=2, the exponent for schoolbook multiplication, the minimum is + given by the values a=1-a=1/2. + + With e=log(3)/log(2), the exponent for Karatsuba (aka toom22), + Mulders compute (1-a) = 0.694... and we approximate a with 11/36. + + Other possible approximations follow: + e=log(5)/log(3) [Toom-3] -> a ~= 9/40 + e=log(7)/log(4) [Toom-4] -> a ~= 7/39 + e=log(11)/log(6) [Toom-6] -> a ~= 1/8 + e=log(15)/log(8) [Toom-8] -> a ~= 1/10 + + The values above where obtained with the following trivial commands + in the gp-pari shell: + +fun(e,a)=(1-a)^e/(1-2*a^e) +mul(a,b,c)={local(m,x,p);if(b-c<1/10000,(b+c)/2,m=1;x=b;forstep(p=c,b,(b-c)/8,if(fun(a,p)= 2); + ASSERT (! MPN_OVERLAP_P (rp, n, xp, n)); + ASSERT (! MPN_OVERLAP_P (rp, n, yp, n)); + ASSERT (MPN_SAME_OR_SEPARATE2_P(rp, n, tp, 2*n)); + + /* Divide-and-conquer */ + + /* We need fractional approximation of the value 0 < a <= 1/2 + giving the minimum in the function k=(1-a)^e/(1-2*a^e). + */ + if (MAYBE_range_basecase && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD*36/(36-11))) + n1 = n >> 1; + else if (MAYBE_range_toom22 && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD*36/(36-11))) + n1 = n * 11 / (size_t) 36; /* n1 ~= n*(1-.694...) */ + else if (BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD*40/(40-9))) + n1 = n * 9 / (size_t) 40; /* n1 ~= n*(1-.775...) */ + else if (BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD*10/9)) + n1 = n * 7 / (size_t) 39; /* n1 ~= n*(1-.821...) */ + /* n1 = n * 4 / (size_t) 31; // n1 ~= n*(1-.871...) [TOOM66] */ + else + n1 = n / (size_t) 10; /* n1 ~= n*(1-.899...) [TOOM88] */ + + n2 = n - n1; + + /* Split as x = x1 2^(n2 GMP_NUMB_BITS) + x0, + y = y1 2^(n2 GMP_NUMB_BITS) + y0 */ + + /* x0 * y0 */ + mpn_mul_n (tp, xp, yp, n2); + MPN_COPY (rp, tp, n2); + + /* x1 * y0 * 2^(n2 GMP_NUMB_BITS) */ + if (BELOW_THRESHOLD (n1, MULLO_BASECASE_THRESHOLD)) + mpn_mul_basecase (tp + n, xp + n2, n1, yp, n1); + else if (BELOW_THRESHOLD (n1, MULLO_DC_THRESHOLD)) + mpn_mullo_basecase (tp + n, xp + n2, yp, n1); + else + mpn_dc_mullo_n (tp + n, xp + n2, yp, n1, tp + n); + mpn_add_n (rp + n2, tp + n2, tp + n, n1); + + /* x0 * y1 * 2^(n2 GMP_NUMB_BITS) */ + if (BELOW_THRESHOLD (n1, MULLO_BASECASE_THRESHOLD)) + mpn_mul_basecase (tp + n, xp, n1, yp + n2, n1); + else if (BELOW_THRESHOLD (n1, MULLO_DC_THRESHOLD)) + mpn_mullo_basecase (tp + n, xp, yp + n2, n1); + else + mpn_dc_mullo_n (tp + n, xp, yp + n2, n1, tp + n); + mpn_add_n (rp + n2, rp + n2, tp + n, n1); +} + +/* Avoid zero allocations when MULLO_BASECASE_THRESHOLD is 0. */ +#define MUL_BASECASE_ALLOC \ + (MULLO_BASECASE_THRESHOLD_LIMIT == 0 ? 1 : 2*MULLO_BASECASE_THRESHOLD_LIMIT) + +/* FIXME: This function should accept a temporary area; dc_mullow_n + accepts a pointer tp, and handle the case tp == rp, do the same here. + Maybe recombine the two functions. + THINK: If mpn_mul_basecase is always faster than mpn_mullo_basecase + (typically thanks to mpn_addmul_2) should we unconditionally use + mpn_mul_n? +*/ + +void +mpn_mullo_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n) +{ + ASSERT (n >= 1); + ASSERT (! MPN_OVERLAP_P (rp, n, xp, n)); + ASSERT (! MPN_OVERLAP_P (rp, n, yp, n)); + + if (BELOW_THRESHOLD (n, MULLO_BASECASE_THRESHOLD)) + { + /* Allocate workspace of fixed size on stack: fast! */ + mp_limb_t tp[MUL_BASECASE_ALLOC]; + mpn_mul_basecase (tp, xp, n, yp, n); + MPN_COPY (rp, tp, n); + } + else if (BELOW_THRESHOLD (n, MULLO_DC_THRESHOLD)) + { + mpn_mullo_basecase (rp, xp, yp, n); + } + else + { + mp_ptr tp; + TMP_DECL; + TMP_MARK; + tp = TMP_ALLOC_LIMBS (mpn_mullo_n_itch (n)); + if (BELOW_THRESHOLD (n, MULLO_MUL_N_THRESHOLD)) + { + mpn_dc_mullo_n (rp, xp, yp, n, tp); + } + else + { + /* For really large operands, use plain mpn_mul_n but throw away upper n + limbs of result. */ +#if !TUNE_PROGRAM_BUILD && (MULLO_MUL_N_THRESHOLD > MUL_FFT_THRESHOLD) + mpn_fft_mul (tp, xp, n, yp, n); +#else + mpn_mul_n (tp, xp, yp, n); +#endif + MPN_COPY (rp, tp, n); + } + TMP_FREE; + } +} diff --git a/contrib/gmp/mpn/generic/mullow_n.c b/contrib/gmp/mpn/generic/mullow_n.c deleted file mode 100644 index e92a554616..0000000000 --- a/contrib/gmp/mpn/generic/mullow_n.c +++ /dev/null @@ -1,111 +0,0 @@ -/* mpn_mullow_n -- multiply two n-limb nunbers and return the low n limbs - of their products. - - THIS IS (FOR NOW) AN INTERNAL FUNCTION. IT IS ONLY SAFE TO REACH THIS - FUNCTION THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED - THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. - -Copyright 2004, 2005 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" - - -#ifndef MULLOW_BASECASE_THRESHOLD -#define MULLOW_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */ -#endif - -#ifndef MULLOW_DC_THRESHOLD -#define MULLOW_DC_THRESHOLD 3*MUL_KARATSUBA_THRESHOLD -#endif - -#ifndef MULLOW_MUL_N_THRESHOLD -#define MULLOW_MUL_N_THRESHOLD 10*MULLOW_DC_THRESHOLD -#endif - -/* Avoid zero allocations when MULLOW_BASECASE_THRESHOLD is 0. */ -#define MUL_BASECASE_ALLOC \ - (MULLOW_BASECASE_THRESHOLD_LIMIT == 0 ? 1 : 2*MULLOW_BASECASE_THRESHOLD_LIMIT) - -/* - FIXME: This function should accept a temporary area. - FIXME: Perhaps call mpn_kara_mul_n instead of mpn_mul_n? - THINK: If mpn_mul_basecase is always faster than mpn_mullow_basecase - (typically thanks to mpn_addmul_2) should we unconditionally use - mpn_mul_n? - FIXME: The recursive calls to mpn_mullow_n use sizes n/2 (one uses floor(n/2) - and the other ceil(n/2)). Depending on the values of the various - _THRESHOLDs, this may never trigger MULLOW_BASECASE_THRESHOLD. - Should we worry about this overhead? -*/ - -void -mpn_mullow_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n) -{ - if (BELOW_THRESHOLD (n, MULLOW_BASECASE_THRESHOLD)) - { - /* Allocate workspace of fixed size on stack: fast! */ - mp_limb_t ws[MUL_BASECASE_ALLOC]; - mpn_mul_basecase (ws, xp, n, yp, n); - MPN_COPY (rp, ws, n); - } - else if (BELOW_THRESHOLD (n, MULLOW_DC_THRESHOLD)) - { - mpn_mullow_basecase (rp, xp, yp, n); - } - else if (BELOW_THRESHOLD (n, MULLOW_MUL_N_THRESHOLD)) - { - /* Divide-and-conquer */ - mp_size_t n2 = n >> 1; /* floor(n/2) */ - mp_size_t n1 = n - n2; /* ceil(n/2) */ - mp_ptr tp; - TMP_SDECL; - TMP_SMARK; - tp = TMP_SALLOC_LIMBS (n1); - - /* Split as x = x1 2^(n1 GMP_NUMB_BITS) + x0, - y = y1 2^(n2 GMP_NUMB_BITS) + y0 */ - - /* x0 * y0 */ - mpn_mul_n (rp, xp, yp, n2); - if (n1 != n2) - rp[2 * n2] = mpn_addmul_1 (rp + n2, yp, n2, xp[n2]); - - /* x1 * y0 * 2^(n1 GMP_NUMB_BITS) */ - mpn_mullow_n (tp, xp + n1, yp, n2); - mpn_add_n (rp + n1, rp + n1, tp, n2); - - /* x0 * y1 * 2^(n2 GMP_NUMB_BITS) */ - mpn_mullow_n (tp, yp + n2, xp, n1); - mpn_add_n (rp + n2, rp + n2, tp, n1); - TMP_SFREE; - } - else - { - /* For really large operands, use plain mpn_mul_n but throw away upper n - limbs of result. */ - mp_ptr tp; - TMP_DECL; - TMP_MARK; - tp = TMP_ALLOC_LIMBS (2 * n); - - mpn_mul_n (tp, xp, yp, n); - MPN_COPY (rp, tp, n); - TMP_FREE; - } -} diff --git a/contrib/gmp/mpn/generic/mulmod_bnm1.c b/contrib/gmp/mpn/generic/mulmod_bnm1.c new file mode 100644 index 0000000000..df0eca815b --- /dev/null +++ b/contrib/gmp/mpn/generic/mulmod_bnm1.c @@ -0,0 +1,351 @@ +/* mulmod_bnm1.c -- multiplication mod B^n-1. + + Contributed to the GNU project by Niels Möller, Torbjorn Granlund and + Marco Bodrato. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +/* Inputs are {ap,rn} and {bp,rn}; output is {rp,rn}, computation is + mod B^rn - 1, and values are semi-normalised; zero is represented + as either 0 or B^n - 1. Needs a scratch of 2rn limbs at tp. + tp==rp is allowed. */ +void +mpn_bc_mulmod_bnm1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn, + mp_ptr tp) +{ + mp_limb_t cy; + + ASSERT (0 < rn); + + mpn_mul_n (tp, ap, bp, rn); + cy = mpn_add_n (rp, tp, tp + rn, rn); + /* If cy == 1, then the value of rp is at most B^rn - 2, so there can + * be no overflow when adding in the carry. */ + MPN_INCR_U (rp, rn, cy); +} + + +/* Inputs are {ap,rn+1} and {bp,rn+1}; output is {rp,rn+1}, in + semi-normalised representation, computation is mod B^rn + 1. Needs + a scratch area of 2rn + 2 limbs at tp; tp == rp is allowed. + Output is normalised. */ +static void +mpn_bc_mulmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn, + mp_ptr tp) +{ + mp_limb_t cy; + + ASSERT (0 < rn); + + mpn_mul_n (tp, ap, bp, rn + 1); + ASSERT (tp[2*rn+1] == 0); + ASSERT (tp[2*rn] < GMP_NUMB_MAX); + cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn); + rp[rn] = 0; + MPN_INCR_U (rp, rn+1, cy ); +} + + +/* Computes {rp,MIN(rn,an+bn)} <- {ap,an}*{bp,bn} Mod(B^rn-1) + * + * The result is expected to be ZERO if and only if one of the operand + * already is. Otherwise the class [0] Mod(B^rn-1) is represented by + * B^rn-1. This should not be a problem if mulmod_bnm1 is used to + * combine results and obtain a natural number when one knows in + * advance that the final value is less than (B^rn-1). + * Moreover it should not be a problem if mulmod_bnm1 is used to + * compute the full product with an+bn <= rn, because this condition + * implies (B^an-1)(B^bn-1) < (B^rn-1) . + * + * Requires 0 < bn <= an <= rn and an + bn > rn/2 + * Scratch need: rn + (need for recursive call OR rn + 4). This gives + * + * S(n) <= rn + MAX (rn + 4, S(n/2)) <= 2rn + 4 + */ +void +mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn, mp_ptr tp) +{ + ASSERT (0 < bn); + ASSERT (bn <= an); + ASSERT (an <= rn); + + if ((rn & 1) != 0 || BELOW_THRESHOLD (rn, MULMOD_BNM1_THRESHOLD)) + { + if (UNLIKELY (bn < rn)) + { + if (UNLIKELY (an + bn <= rn)) + { + mpn_mul (rp, ap, an, bp, bn); + } + else + { + mp_limb_t cy; + mpn_mul (tp, ap, an, bp, bn); + cy = mpn_add (rp, tp, rn, tp + rn, an + bn - rn); + MPN_INCR_U (rp, rn, cy); + } + } + else + mpn_bc_mulmod_bnm1 (rp, ap, bp, rn, tp); + } + else + { + mp_size_t n; + mp_limb_t cy; + mp_limb_t hi; + + n = rn >> 1; + + /* We need at least an + bn >= n, to be able to fit one of the + recursive products at rp. Requiring strict inequality makes + the coded slightly simpler. If desired, we could avoid this + restriction by initially halving rn as long as rn is even and + an + bn <= rn/2. */ + + ASSERT (an + bn > n); + + /* Compute xm = a*b mod (B^n - 1), xp = a*b mod (B^n + 1) + and crt together as + + x = -xp * B^n + (B^n + 1) * [ (xp + xm)/2 mod (B^n-1)] + */ + +#define a0 ap +#define a1 (ap + n) +#define b0 bp +#define b1 (bp + n) + +#define xp tp /* 2n + 2 */ + /* am1 maybe in {xp, n} */ + /* bm1 maybe in {xp + n, n} */ +#define sp1 (tp + 2*n + 2) + /* ap1 maybe in {sp1, n + 1} */ + /* bp1 maybe in {sp1 + n + 1, n + 1} */ + + { + mp_srcptr am1, bm1; + mp_size_t anm, bnm; + mp_ptr so; + + if (LIKELY (an > n)) + { + am1 = xp; + cy = mpn_add (xp, a0, n, a1, an - n); + MPN_INCR_U (xp, n, cy); + anm = n; + if (LIKELY (bn > n)) + { + bm1 = xp + n; + cy = mpn_add (xp + n, b0, n, b1, bn - n); + MPN_INCR_U (xp + n, n, cy); + bnm = n; + so = xp + 2*n; + } + else + { + so = xp + n; + bm1 = b0; + bnm = bn; + } + } + else + { + so = xp; + am1 = a0; + anm = an; + bm1 = b0; + bnm = bn; + } + + mpn_mulmod_bnm1 (rp, n, am1, anm, bm1, bnm, so); + } + + { + int k; + mp_srcptr ap1, bp1; + mp_size_t anp, bnp; + + if (LIKELY (an > n)) { + ap1 = sp1; + cy = mpn_sub (sp1, a0, n, a1, an - n); + sp1[n] = 0; + MPN_INCR_U (sp1, n + 1, cy); + anp = n + ap1[n]; + } else { + ap1 = a0; + anp = an; + } + + if (LIKELY (bn > n)) { + bp1 = sp1 + n + 1; + cy = mpn_sub (sp1 + n + 1, b0, n, b1, bn - n); + sp1[2*n+1] = 0; + MPN_INCR_U (sp1 + n + 1, n + 1, cy); + bnp = n + bp1[n]; + } else { + bp1 = b0; + bnp = bn; + } + + if (BELOW_THRESHOLD (n, MUL_FFT_MODF_THRESHOLD)) + k=0; + else + { + int mask; + k = mpn_fft_best_k (n, 0); + mask = (1<>=1;}; + } + if (k >= FFT_FIRST_K) + xp[n] = mpn_mul_fft (xp, n, ap1, anp, bp1, bnp, k); + else if (UNLIKELY (bp1 == b0)) + { + ASSERT (anp + bnp <= 2*n+1); + ASSERT (anp + bnp > n); + ASSERT (anp >= bnp); + mpn_mul (xp, ap1, anp, bp1, bnp); + anp = anp + bnp - n; + ASSERT (anp <= n || xp[2*n]==0); + anp-= anp > n; + cy = mpn_sub (xp, xp, n, xp + n, anp); + xp[n] = 0; + MPN_INCR_U (xp, n+1, cy); + } + else + mpn_bc_mulmod_bnp1 (xp, ap1, bp1, n, xp); + } + + /* Here the CRT recomposition begins. + + xm <- (xp + xm)/2 = (xp + xm)B^n/2 mod (B^n-1) + Division by 2 is a bitwise rotation. + + Assumes xp normalised mod (B^n+1). + + The residue class [0] is represented by [B^n-1]; except when + both input are ZERO. + */ + +#if HAVE_NATIVE_mpn_rsh1add_n || HAVE_NATIVE_mpn_rsh1add_nc +#if HAVE_NATIVE_mpn_rsh1add_nc + cy = mpn_rsh1add_nc(rp, rp, xp, n, xp[n]); /* B^n = 1 */ + hi = cy << (GMP_NUMB_BITS - 1); + cy = 0; + /* next update of rp[n-1] will set cy = 1 only if rp[n-1]+=hi + overflows, i.e. a further increment will not overflow again. */ +#else /* ! _nc */ + cy = xp[n] + mpn_rsh1add_n(rp, rp, xp, n); /* B^n = 1 */ + hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */ + cy >>= 1; + /* cy = 1 only if xp[n] = 1 i.e. {xp,n} = ZERO, this implies that + the rsh1add was a simple rshift: the top bit is 0. cy=1 => hi=0. */ +#endif +#if GMP_NAIL_BITS == 0 + add_ssaaaa(cy, rp[n-1], cy, rp[n-1], 0, hi); +#else + cy += (hi & rp[n-1]) >> (GMP_NUMB_BITS-1); + rp[n-1] ^= hi; +#endif +#else /* ! HAVE_NATIVE_mpn_rsh1add_n */ +#if HAVE_NATIVE_mpn_add_nc + cy = mpn_add_nc(rp, rp, xp, n, xp[n]); +#else /* ! _nc */ + cy = xp[n] + mpn_add_n(rp, rp, xp, n); /* xp[n] == 1 implies {xp,n} == ZERO */ +#endif + cy += (rp[0]&1); + mpn_rshift(rp, rp, n, 1); + ASSERT (cy <= 2); + hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */ + cy >>= 1; + /* We can have cy != 0 only if hi = 0... */ + ASSERT ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0); + rp[n-1] |= hi; + /* ... rp[n-1] + cy can not overflow, the following INCR is correct. */ +#endif + ASSERT (cy <= 1); + /* Next increment can not overflow, read the previous comments about cy. */ + ASSERT ((cy == 0) || ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0)); + MPN_INCR_U(rp, n, cy); + + /* Compute the highest half: + ([(xp + xm)/2 mod (B^n-1)] - xp ) * B^n + */ + if (UNLIKELY (an + bn < rn)) + { + /* Note that in this case, the only way the result can equal + zero mod B^{rn} - 1 is if one of the inputs is zero, and + then the output of both the recursive calls and this CRT + reconstruction is zero, not B^{rn} - 1. Which is good, + since the latter representation doesn't fit in the output + area.*/ + cy = mpn_sub_n (rp + n, rp, xp, an + bn - n); + + /* FIXME: This subtraction of the high parts is not really + necessary, we do it to get the carry out, and for sanity + checking. */ + cy = xp[n] + mpn_sub_nc (xp + an + bn - n, rp + an + bn - n, + xp + an + bn - n, rn - (an + bn), cy); + ASSERT (an + bn == rn - 1 || + mpn_zero_p (xp + an + bn - n + 1, rn - 1 - (an + bn))); + cy = mpn_sub_1 (rp, rp, an + bn, cy); + ASSERT (cy == (xp + an + bn - n)[0]); + } + else + { + cy = xp[n] + mpn_sub_n (rp + n, rp, xp, n); + /* cy = 1 only if {xp,n+1} is not ZERO, i.e. {rp,n} is not ZERO. + DECR will affect _at most_ the lowest n limbs. */ + MPN_DECR_U (rp, 2*n, cy); + } +#undef a0 +#undef a1 +#undef b0 +#undef b1 +#undef xp +#undef sp1 + } +} + +mp_size_t +mpn_mulmod_bnm1_next_size (mp_size_t n) +{ + mp_size_t nh; + + if (BELOW_THRESHOLD (n, MULMOD_BNM1_THRESHOLD)) + return n; + if (BELOW_THRESHOLD (n, 4 * (MULMOD_BNM1_THRESHOLD - 1) + 1)) + return (n + (2-1)) & (-2); + if (BELOW_THRESHOLD (n, 8 * (MULMOD_BNM1_THRESHOLD - 1) + 1)) + return (n + (4-1)) & (-4); + + nh = (n + 1) >> 1; + + if (BELOW_THRESHOLD (nh, MUL_FFT_MODF_THRESHOLD)) + return (n + (8-1)) & (-8); + + return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 0)); +} diff --git a/contrib/gmp/mpn/generic/neg_n.c b/contrib/gmp/mpn/generic/neg.c similarity index 92% copy from contrib/gmp/mpn/generic/neg_n.c copy to contrib/gmp/mpn/generic/neg.c index 1609204c90..980e59e675 100644 --- a/contrib/gmp/mpn/generic/neg_n.c +++ b/contrib/gmp/mpn/generic/neg.c @@ -1,4 +1,4 @@ -/* mpn_neg_n - negate an mpn. +/* mpn_neg - negate an mpn. Copyright 2001, 2009 Free Software Foundation, Inc. @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define __GMP_FORCE_mpn_neg_n 1 +#define __GMP_FORCE_mpn_neg 1 #include "gmp.h" #include "gmp-impl.h" diff --git a/contrib/gmp/mpn/generic/nussbaumer_mul.c b/contrib/gmp/mpn/generic/nussbaumer_mul.c new file mode 100644 index 0000000000..131faf8cfb --- /dev/null +++ b/contrib/gmp/mpn/generic/nussbaumer_mul.c @@ -0,0 +1,60 @@ +/* mpn_nussbaumer_mul -- Multiply {ap,an} and {bp,bn} using + Nussbaumer's negacyclic convolution. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Multiply {ap,an} by {bp,bn}, and put the result in {pp, an+bn} */ +void +mpn_nussbaumer_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn) +{ + mp_size_t rn; + mp_ptr tp; + TMP_DECL; + + ASSERT (an >= bn); + ASSERT (bn > 0); + + TMP_MARK; + + if ((ap == bp) && (an == bn)) + { + rn = mpn_sqrmod_bnm1_next_size (2*an); + tp = TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (rn, an)); + mpn_sqrmod_bnm1 (pp, rn, ap, an, tp); + } + else + { + rn = mpn_mulmod_bnm1_next_size (an + bn); + tp = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (rn, an, bn)); + mpn_mulmod_bnm1 (pp, rn, ap, an, bp, bn, tp); + } + + TMP_FREE; +} diff --git a/contrib/gmp/mpn/generic/perfpow.c b/contrib/gmp/mpn/generic/perfpow.c new file mode 100644 index 0000000000..709e2bb69d --- /dev/null +++ b/contrib/gmp/mpn/generic/perfpow.c @@ -0,0 +1,493 @@ +/* mpn_perfect_power_p -- mpn perfect power detection. + + Contributed to the GNU project by Martin Boij. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +#define SMALL 20 +#define MEDIUM 100 + +/* + Returns non-zero if {np,nn} == {xp,xn} ^ k. + Algorithm: + For s = 1, 2, 4, ..., s_max, compute the s least significant + limbs of {xp,xn}^k. Stop if they don't match the s least + significant limbs of {np,nn}. +*/ +static int +pow_equals (mp_srcptr np, mp_size_t nn, + mp_srcptr xp,mp_size_t xn, + mp_limb_t k, mp_bitcnt_t f, + mp_ptr tp) +{ + mp_limb_t *tp2; + mp_bitcnt_t y, z, count; + mp_size_t i, bn; + int ans; + mp_limb_t h, l; + TMP_DECL; + + ASSERT (nn > 1 || (nn == 1 && np[0] > 1)); + ASSERT (np[nn - 1] > 0); + ASSERT (xn > 0); + + if (xn == 1 && xp[0] == 1) + return 0; + + z = 1 + (nn >> 1); + for (bn = 1; bn < z; bn <<= 1) + { + mpn_powlo (tp, xp, &k, 1, bn, tp + bn); + if (mpn_cmp (tp, np, bn) != 0) + return 0; + } + + TMP_MARK; + + /* Final check. Estimate the size of {xp,xn}^k before computing + the power with full precision. + Optimization: It might pay off to make a more accurate estimation of + the logarithm of {xp,xn}, rather than using the index of the MSB. + */ + + count_leading_zeros (count, xp[xn - 1]); + y = xn * GMP_LIMB_BITS - count - 1; /* msb_index (xp, xn) */ + + umul_ppmm (h, l, k, y); + h -= l == 0; l--; /* two-limb decrement */ + + z = f - 1; /* msb_index (np, nn) */ + if (h == 0 && l <= z) + { + mp_limb_t size; + size = l + k; + ASSERT_ALWAYS (size >= k); + + y = 2 + size / GMP_LIMB_BITS; + tp2 = TMP_ALLOC_LIMBS (y); + + i = mpn_pow_1 (tp, xp, xn, k, tp2); + if (i == nn && mpn_cmp (tp, np, nn) == 0) + ans = 1; + else + ans = 0; + } + else + { + ans = 0; + } + + TMP_FREE; + return ans; +} + +/* + Computes rp such that rp^k * yp = 1 (mod 2^b). + Algorithm: + Apply Hensel lifting repeatedly, each time + doubling (approx.) the number of known bits in rp. +*/ +static void +binv_root (mp_ptr rp, mp_srcptr yp, + mp_limb_t k, mp_size_t bn, + mp_bitcnt_t b, mp_ptr tp) +{ + mp_limb_t *tp2 = tp + bn, *tp3 = tp + 2 * bn, di, k2 = k + 1; + mp_bitcnt_t order[GMP_LIMB_BITS * 2]; + int i, d = 0; + + ASSERT (bn > 0); + ASSERT (b > 0); + ASSERT ((k & 1) != 0); + + binvert_limb (di, k); + + rp[0] = 1; + for (; b != 1; b = (b + 1) >> 1) + order[d++] = b; + + for (i = d - 1; i >= 0; i--) + { + b = order[i]; + bn = 1 + (b - 1) / GMP_LIMB_BITS; + + mpn_mul_1 (tp, rp, bn, k2); + + mpn_powlo (tp2, rp, &k2, 1, bn, tp3); + mpn_mullo_n (rp, yp, tp2, bn); + + mpn_sub_n (tp2, tp, rp, bn); + mpn_pi1_bdiv_q_1 (rp, tp2, bn, k, di, 0); + if ((b % GMP_LIMB_BITS) != 0) + rp[(b - 1) / GMP_LIMB_BITS] &= (((mp_limb_t) 1) << (b % GMP_LIMB_BITS)) - 1; + } + return; +} + +/* + Computes rp such that rp^2 * yp = 1 (mod 2^{b+1}). + Returns non-zero if such an integer rp exists. +*/ +static int +binv_sqroot (mp_ptr rp, mp_srcptr yp, + mp_size_t bn, mp_bitcnt_t b, + mp_ptr tp) +{ + mp_limb_t k = 3, *tp2 = tp + bn, *tp3 = tp + (bn << 1); + mp_bitcnt_t order[GMP_LIMB_BITS * 2]; + int i, d = 0; + + ASSERT (bn > 0); + ASSERT (b > 0); + + rp[0] = 1; + if (b == 1) + { + if ((yp[0] & 3) != 1) + return 0; + } + else + { + if ((yp[0] & 7) != 1) + return 0; + + for (; b != 2; b = (b + 2) >> 1) + order[d++] = b; + + for (i = d - 1; i >= 0; i--) + { + b = order[i]; + bn = 1 + b / GMP_LIMB_BITS; + + mpn_mul_1 (tp, rp, bn, k); + + mpn_powlo (tp2, rp, &k, 1, bn, tp3); + mpn_mullo_n (rp, yp, tp2, bn); + +#if HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (rp, tp, rp, bn); +#else + mpn_sub_n (tp2, tp, rp, bn); + mpn_rshift (rp, tp2, bn, 1); +#endif + rp[b / GMP_LIMB_BITS] &= (((mp_limb_t) 1) << (b % GMP_LIMB_BITS)) - 1; + } + } + return 1; +} + +/* + Returns non-zero if {np,nn} is a kth power. +*/ +static int +is_kth_power (mp_ptr rp, mp_srcptr np, + mp_limb_t k, mp_srcptr yp, + mp_size_t nn, mp_bitcnt_t f, + mp_ptr tp) +{ + mp_limb_t x, c; + mp_bitcnt_t b; + mp_size_t i, rn, xn; + + ASSERT (nn > 0); + ASSERT (((k & 1) != 0) || (k == 2)); + ASSERT ((np[0] & 1) != 0); + + if (k == 2) + { + b = (f + 1) >> 1; + rn = 1 + b / GMP_LIMB_BITS; + if (binv_sqroot (rp, yp, rn, b, tp) != 0) + { + xn = rn; + MPN_NORMALIZE (rp, xn); + if (pow_equals (np, nn, rp, xn, k, f, tp) != 0) + return 1; + + /* Check if (2^b - rp)^2 == np */ + c = 0; + for (i = 0; i < rn; i++) + { + x = rp[i]; + rp[i] = -x - c; + c |= (x != 0); + } + rp[rn - 1] &= (((mp_limb_t) 1) << (b % GMP_LIMB_BITS)) - 1; + MPN_NORMALIZE (rp, rn); + if (pow_equals (np, nn, rp, rn, k, f, tp) != 0) + return 1; + } + } + else + { + b = 1 + (f - 1) / k; + rn = 1 + (b - 1) / GMP_LIMB_BITS; + binv_root (rp, yp, k, rn, b, tp); + MPN_NORMALIZE (rp, rn); + if (pow_equals (np, nn, rp, rn, k, f, tp) != 0) + return 1; + } + MPN_ZERO (rp, rn); /* Untrash rp */ + return 0; +} + +static int +perfpow (mp_srcptr np, mp_size_t nn, + mp_limb_t ub, mp_limb_t g, + mp_bitcnt_t f, int neg) +{ + mp_limb_t *yp, *tp, k = 0, *rp1; + int ans = 0; + mp_bitcnt_t b; + gmp_primesieve_t ps; + TMP_DECL; + + ASSERT (nn > 0); + ASSERT ((np[0] & 1) != 0); + ASSERT (ub > 0); + + TMP_MARK; + gmp_init_primesieve (&ps); + b = (f + 3) >> 1; + + yp = TMP_ALLOC_LIMBS (nn); + rp1 = TMP_ALLOC_LIMBS (nn); + tp = TMP_ALLOC_LIMBS (5 * nn); /* FIXME */ + MPN_ZERO (rp1, nn); + + mpn_binvert (yp, np, 1 + (b - 1) / GMP_LIMB_BITS, tp); + if (b % GMP_LIMB_BITS) + yp[(b - 1) / GMP_LIMB_BITS] &= (((mp_limb_t) 1) << (b % GMP_LIMB_BITS)) - 1; + + if (neg) + gmp_nextprime (&ps); + + if (g > 0) + { + ub = MIN (ub, g + 1); + while ((k = gmp_nextprime (&ps)) < ub) + { + if ((g % k) == 0) + { + if (is_kth_power (rp1, np, k, yp, nn, f, tp) != 0) + { + ans = 1; + goto ret; + } + } + } + } + else + { + while ((k = gmp_nextprime (&ps)) < ub) + { + if (is_kth_power (rp1, np, k, yp, nn, f, tp) != 0) + { + ans = 1; + goto ret; + } + } + } + ret: + TMP_FREE; + return ans; +} + +static const unsigned short nrtrial[] = { 100, 500, 1000 }; + +/* Table of (log_{p_i} 2) values, where p_i is + the (nrtrial[i] + 1)'th prime number. +*/ +static const double logs[] = { 0.1099457228193620, 0.0847016403115322, 0.0772048195144415 }; + +int +mpn_perfect_power_p (mp_srcptr np, mp_size_t nn) +{ + mp_size_t ncn, s, pn, xn; + mp_limb_t *nc, factor, g = 0; + mp_limb_t exp, *prev, *next, d, l, r, c, *tp, cry; + mp_bitcnt_t twos = 0, count; + int ans, where = 0, neg = 0, trial; + TMP_DECL; + + nc = (mp_ptr) np; + + if (nn < 0) + { + neg = 1; + nn = -nn; + } + + if (nn == 0 || (nn == 1 && np[0] == 1)) + return 1; + + TMP_MARK; + + ncn = nn; + twos = mpn_scan1 (np, 0); + if (twos > 0) + { + if (twos == 1) + { + ans = 0; + goto ret; + } + s = twos / GMP_LIMB_BITS; + if (s + 1 == nn && POW2_P (np[s])) + { + ans = ! (neg && POW2_P (twos)); + goto ret; + } + count = twos % GMP_LIMB_BITS; + ncn = nn - s; + nc = TMP_ALLOC_LIMBS (ncn); + if (count > 0) + { + mpn_rshift (nc, np + s, ncn, count); + ncn -= (nc[ncn - 1] == 0); + } + else + { + MPN_COPY (nc, np + s, ncn); + } + g = twos; + } + + if (ncn <= SMALL) + trial = 0; + else if (ncn <= MEDIUM) + trial = 1; + else + trial = 2; + + factor = mpn_trialdiv (nc, ncn, nrtrial[trial], &where); + + if (factor != 0) + { + if (twos == 0) + { + nc = TMP_ALLOC_LIMBS (ncn); + MPN_COPY (nc, np, ncn); + } + + /* Remove factors found by trialdiv. + Optimization: Perhaps better to use + the strategy in mpz_remove (). + */ + prev = TMP_ALLOC_LIMBS (ncn + 2); + next = TMP_ALLOC_LIMBS (ncn + 2); + tp = TMP_ALLOC_LIMBS (4 * ncn); + + do + { + binvert_limb (d, factor); + prev[0] = d; + pn = 1; + exp = 1; + while (2 * pn - 1 <= ncn) + { + mpn_sqr (next, prev, pn); + xn = 2 * pn; + xn -= (next[xn - 1] == 0); + + if (mpn_divisible_p (nc, ncn, next, xn) == 0) + break; + + exp <<= 1; + pn = xn; + MP_PTR_SWAP (next, prev); + } + + /* Binary search for the exponent */ + l = exp + 1; + r = 2 * exp - 1; + while (l <= r) + { + c = (l + r) >> 1; + if (c - exp > 1) + { + xn = mpn_pow_1 (tp, &d, 1, c - exp, next); + if (pn + xn - 1 > ncn) + { + r = c - 1; + continue; + } + mpn_mul (next, prev, pn, tp, xn); + xn += pn; + xn -= (next[xn - 1] == 0); + } + else + { + cry = mpn_mul_1 (next, prev, pn, d); + next[pn] = cry; + xn = pn + (cry != 0); + } + + if (mpn_divisible_p (nc, ncn, next, xn) == 0) + { + r = c - 1; + } + else + { + exp = c; + l = c + 1; + MP_PTR_SWAP (next, prev); + pn = xn; + } + } + + if (g == 0) + g = exp; + else + g = mpn_gcd_1 (&g, 1, exp); + + if (g == 1) + { + ans = 0; + goto ret; + } + + mpn_divexact (next, nc, ncn, prev, pn); + ncn = ncn - pn; + ncn += next[ncn] != 0; + MPN_COPY (nc, next, ncn); + + if (ncn == 1 && nc[0] == 1) + { + ans = ! (neg && POW2_P (g)); + goto ret; + } + + factor = mpn_trialdiv (nc, ncn, nrtrial[trial], &where); + } + while (factor != 0); + } + + count_leading_zeros (count, nc[ncn-1]); + count = GMP_LIMB_BITS * ncn - count; /* log (nc) + 1 */ + d = (mp_limb_t) (count * logs[trial] + 1e-9) + 1; + ans = perfpow (nc, ncn, d, g, count, neg); + + ret: + TMP_FREE; + return ans; +} diff --git a/contrib/gmp/mpn/generic/perfsqr.c b/contrib/gmp/mpn/generic/perfsqr.c index 1995a944df..1c65dfb05c 100644 --- a/contrib/gmp/mpn/generic/perfsqr.c +++ b/contrib/gmp/mpn/generic/perfsqr.c @@ -104,18 +104,18 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Maybe a new sort of mpn_preinv_mod_1 could accept an unnormalized divisor and a shift count, like mpn_preinv_divrem_1. But mod_34lsub1 is our normal case, so lets not worry too much about mod_1. */ -#define PERFSQR_MOD_PP(r, up, usize) \ - do { \ - if (USE_PREINV_MOD_1) \ - { \ - (r) = mpn_preinv_mod_1 (up, usize, PERFSQR_PP_NORM, \ - PERFSQR_PP_INVERTED); \ - (r) %= PERFSQR_PP; \ - } \ - else \ - { \ - (r) = mpn_mod_1 (up, usize, PERFSQR_PP); \ - } \ +#define PERFSQR_MOD_PP(r, up, usize) \ + do { \ + if (BELOW_THRESHOLD (usize, PREINV_MOD_1_TO_MOD_1_THRESHOLD)) \ + { \ + (r) = mpn_preinv_mod_1 (up, usize, PERFSQR_PP_NORM, \ + PERFSQR_PP_INVERTED); \ + (r) %= PERFSQR_PP; \ + } \ + else \ + { \ + (r) = mpn_mod_1 (up, usize, PERFSQR_PP); \ + } \ } while (0) #define PERFSQR_MOD_IDX(idx, r, d, inv) \ @@ -218,7 +218,7 @@ mpn_perfect_square_p (mp_srcptr up, mp_size_t usize) TMP_DECL; TMP_MARK; - root_ptr = (mp_ptr) TMP_ALLOC ((usize + 1) / 2 * BYTES_PER_MP_LIMB); + root_ptr = TMP_ALLOC_LIMBS ((usize + 1) / 2); /* Iff mpn_sqrtrem returns zero, the square is perfect. */ res = ! mpn_sqrtrem (root_ptr, NULL, up, usize); diff --git a/contrib/gmp/mpn/generic/popham.c b/contrib/gmp/mpn/generic/popham.c index be7c525036..b9d0bf3356 100644 --- a/contrib/gmp/mpn/generic/popham.c +++ b/contrib/gmp/mpn/generic/popham.c @@ -30,14 +30,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define POPHAM(u,v) u ^ v #endif -unsigned long +mp_bitcnt_t FNAME (mp_srcptr up, #if OPERATION_hamdist mp_srcptr vp, #endif mp_size_t n) { - unsigned long result = 0; + mp_bitcnt_t result = 0; mp_limb_t p0, p1, p2, p3, x, p01, p23; mp_size_t i; diff --git a/contrib/gmp/mpn/generic/pow_1.c b/contrib/gmp/mpn/generic/pow_1.c index 4bc9f434bc..d379836e31 100644 --- a/contrib/gmp/mpn/generic/pow_1.c +++ b/contrib/gmp/mpn/generic/pow_1.c @@ -34,6 +34,9 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp) mp_size_t rn; int par; + ASSERT (bn >= 1); + /* FIXME: Add operand overlap criteria */ + if (exp <= 1) { if (exp == 0) @@ -68,7 +71,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp) if ((cnt & 1) != 0) MP_PTR_SWAP (rp, tp); - mpn_sqr_n (rp, bp, bn); + mpn_sqr (rp, bp, bn); rn = 2 * bn; rn -= rp[rn - 1] == 0; for (i = GMP_LIMB_BITS - cnt - 1;;) @@ -83,7 +86,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp) if (--i == 0) break; - mpn_sqr_n (tp, rp, rn); + mpn_sqr (tp, rp, rn); rn = 2 * rn; rn -= tp[rn - 1] == 0; MP_PTR_SWAP (rp, tp); } @@ -93,7 +96,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp) if (((par ^ cnt) & 1) == 0) MP_PTR_SWAP (rp, tp); - mpn_sqr_n (rp, bp, bn); + mpn_sqr (rp, bp, bn); rn = 2 * bn; rn -= rp[rn - 1] == 0; for (i = GMP_LIMB_BITS - cnt - 1;;) @@ -108,7 +111,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp) if (--i == 0) break; - mpn_sqr_n (tp, rp, rn); + mpn_sqr (tp, rp, rn); rn = 2 * rn; rn -= tp[rn - 1] == 0; MP_PTR_SWAP (rp, tp); } diff --git a/contrib/gmp/mpn/generic/powlo.c b/contrib/gmp/mpn/generic/powlo.c index ca3e1e9448..7eb64540da 100644 --- a/contrib/gmp/mpn/generic/powlo.c +++ b/contrib/gmp/mpn/generic/powlo.c @@ -1,4 +1,4 @@ -/* mpn_powlo -- Compute R = U^E mod R^n, where R is the limb base. +/* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base. Copyright 2007, 2008, 2009 Free Software Foundation, Inc. @@ -27,7 +27,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ ((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1) static inline mp_limb_t -getbits (const mp_limb_t *p, unsigned long bi, int nbits) +getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits) { int nbits_in_r; mp_limb_t r; @@ -40,10 +40,10 @@ getbits (const mp_limb_t *p, unsigned long bi, int nbits) else { bi -= nbits; /* bit index of low bit to extract */ - i = bi / GMP_LIMB_BITS; /* word index of low bit to extract */ - bi %= GMP_LIMB_BITS; /* bit index in low word */ + i = bi / GMP_NUMB_BITS; /* word index of low bit to extract */ + bi %= GMP_NUMB_BITS; /* bit index in low word */ r = p[i] >> bi; /* extract (low) bits */ - nbits_in_r = GMP_LIMB_BITS - bi; /* number of bits now in r */ + nbits_in_r = GMP_NUMB_BITS - bi; /* number of bits now in r */ if (nbits_in_r < nbits) /* did we get enough bits? */ r += p[i + 1] << nbits_in_r; /* prepend bits from higher word */ return r & (((mp_limb_t ) 1 << nbits) - 1); @@ -51,16 +51,16 @@ getbits (const mp_limb_t *p, unsigned long bi, int nbits) } static inline int -win_size (unsigned long eb) +win_size (mp_bitcnt_t eb) { int k; - static unsigned long x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~0ul}; + static mp_bitcnt_t x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0}; for (k = 0; eb > x[k]; k++) ; return k; } -/* rp[n-1..0] = bp[n-1..0] ^ ep[en-1..0] mod R^n, R is the limb base. +/* rp[n-1..0] = bp[n-1..0] ^ ep[en-1..0] mod B^n, B is the limb base. Requires that ep[en-1] is non-zero. Uses scratch space tp[3n-1..0], i.e., 3n words. */ void @@ -69,7 +69,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, mp_size_t n, mp_ptr tp) { int cnt; - long ebi; + mp_bitcnt_t ebi; int windowsize, this_windowsize; mp_limb_t expbits; mp_limb_t *pp, *this_pp, *last_pp; @@ -82,11 +82,11 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, TMP_MARK; count_leading_zeros (cnt, ep[en - 1]); - ebi = en * GMP_LIMB_BITS - cnt; + ebi = (mp_bitcnt_t) en * GMP_LIMB_BITS - cnt; windowsize = win_size (ebi); - pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)) + n); /* + n is for mullow ign part */ + pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)) + n); /* + n is for mullo ign part */ this_pp = pp; @@ -95,7 +95,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, b2p = tp + 2*n; /* Store b^2 in b2. */ - mpn_sqr_n (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */ + mpn_sqr (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */ MPN_COPY (b2p, tp, n); /* Precompute odd powers of b and put them in the temporary area at pp. */ @@ -103,13 +103,14 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, { last_pp = this_pp; this_pp += n; - mpn_mullow_n (this_pp, last_pp, b2p, n); + mpn_mullo_n (this_pp, last_pp, b2p, n); } expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; - if (ebi < 0) + if (ebi < windowsize) ebi = 0; + else + ebi -= windowsize; count_trailing_zeros (cnt, expbits); ebi += cnt; @@ -121,7 +122,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, { while (getbit (ep, ebi) == 0) { - mpn_sqr_n (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */ + mpn_sqr (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */ MPN_COPY (rp, tp, n); ebi--; if (ebi == 0) @@ -132,13 +133,14 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, bits <= windowsize, and such that the least significant bit is 1. */ expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; this_windowsize = windowsize; - if (ebi < 0) + if (ebi < windowsize) { - this_windowsize += ebi; + this_windowsize -= windowsize - ebi; ebi = 0; } + else + ebi -= windowsize; count_trailing_zeros (cnt, expbits); this_windowsize -= cnt; @@ -147,13 +149,13 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp, do { - mpn_sqr_n (tp, rp, n); + mpn_sqr (tp, rp, n); MPN_COPY (rp, tp, n); this_windowsize--; } while (this_windowsize != 0); - mpn_mullow_n (tp, rp, pp + n * (expbits >> 1), n); + mpn_mullo_n (tp, rp, pp + n * (expbits >> 1), n); MPN_COPY (rp, tp, n); } diff --git a/contrib/gmp/mpn/generic/powm.c b/contrib/gmp/mpn/generic/powm.c index c057ec2156..8c58795bd9 100644 --- a/contrib/gmp/mpn/generic/powm.c +++ b/contrib/gmp/mpn/generic/powm.c @@ -1,5 +1,11 @@ /* mpn_powm -- Compute R = U^E mod M. + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + Copyright 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +25,16 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* - BASIC ALGORITHM, Compute b^e mod n, where n is odd. - - 1. w <- b + BASIC ALGORITHM, Compute U^E mod M, where M < B^n is odd. - 2. While w^2 < n (and there are more bits in e) - w <- power left-to-right base-2 without reduction + 1. W <- U - 3. t <- (B^n * b) / n Convert to REDC form + 2. T <- (B^n * U) mod M Convert to REDC form - 4. Compute power table of e-dependent size + 3. Compute table U^1, U^3, U^5... of E-dependent size - 5. While there are more bits in e - w <- power left-to-right base-k with reduction + 4. While there are more bits in E + W <- power left-to-right base-k TODO: @@ -40,51 +43,46 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ That will simplify the code using getbits. (Perhaps make getbits' sibling getbit then have similar form, for symmetry.) - * Write an itch function. + * Write an itch function. Or perhaps get rid of tp parameter since the huge + pp area is allocated locally anyway? * Choose window size without looping. (Superoptimize or think(tm).) - * How do we handle small bases? - - * This is slower than old mpz code, in particular if we base it on redc_1 - (use: #undef HAVE_NATIVE_mpn_addmul_2). Why? - - * Make it sub-quadratic. + * Handle small bases with initial, reduction-free exponentiation. * Call new division functions, not mpn_tdiv_qr. - * Is redc obsolete with improved SB division? - * Consider special code for one-limb M. - * CRT for N = odd*2^t: - Using Newton's method and 2-adic arithmetic: - m1_inv_m2 = 1/odd mod 2^t - Plain 2-adic (REDC) modexp: - r1 = a ^ b mod odd - Mullo+sqrlo-based modexp: - r2 = a ^ b mod 2^t - mullo, mul, add: - r = ((r2 - r1) * m1_i_m2 mod 2^t) * odd + r1 - - * How should we handle the redc1/redc2/redc2/redc4/redc_subquad choice? - - redc1: T(binvert_1limb) + e * (n) * (T(mullo1x1) + n*T(addmul_1)) - - redc2: T(binvert_2limbs) + e * (n/2) * (T(mullo2x2) + n*T(addmul_2)) - - redc3: T(binvert_3limbs) + e * (n/3) * (T(mullo3x3) + n*T(addmul_3)) + * How should we handle the redc1/redc2/redc_n choice? + - redc1: T(binvert_1limb) + e * (n) * (T(mullo-1x1) + n*T(addmul_1)) + - redc2: T(binvert_2limbs) + e * (n/2) * (T(mullo-2x2) + n*T(addmul_2)) + - redc_n: T(binvert_nlimbs) + e * (T(mullo-nxn) + T(M(n))) This disregards the addmul_N constant term, but we could think of - that as part of the respective mulloNxN. + that as part of the respective mullo. + + * When U (the base) is small, we should start the exponentiation with plain + operations, then convert that partial result to REDC form. + + * When U is just one limb, should it be handled without the k-ary tricks? + We could keep a factor of B^n in W, but use U' = BU as base. After + multiplying by this (pseudo two-limb) number, we need to multiply by 1/B + mod M. */ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" +#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2 +#define WANT_REDC_2 1 +#endif #define getbit(p,bi) \ ((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1) static inline mp_limb_t -getbits (const mp_limb_t *p, unsigned long bi, int nbits) +getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits) { int nbits_in_r; mp_limb_t r; @@ -97,49 +95,27 @@ getbits (const mp_limb_t *p, unsigned long bi, int nbits) else { bi -= nbits; /* bit index of low bit to extract */ - i = bi / GMP_LIMB_BITS; /* word index of low bit to extract */ - bi %= GMP_LIMB_BITS; /* bit index in low word */ + i = bi / GMP_NUMB_BITS; /* word index of low bit to extract */ + bi %= GMP_NUMB_BITS; /* bit index in low word */ r = p[i] >> bi; /* extract (low) bits */ - nbits_in_r = GMP_LIMB_BITS - bi; /* number of bits now in r */ + nbits_in_r = GMP_NUMB_BITS - bi; /* number of bits now in r */ if (nbits_in_r < nbits) /* did we get enough bits? */ r += p[i + 1] << nbits_in_r; /* prepend bits from higher word */ return r & (((mp_limb_t ) 1 << nbits) - 1); } } -#undef HAVE_NATIVE_mpn_addmul_2 - -#ifndef HAVE_NATIVE_mpn_addmul_2 -#define REDC_2_THRESHOLD MP_SIZE_T_MAX -#endif - -#ifndef REDC_2_THRESHOLD -#define REDC_2_THRESHOLD 4 -#endif - -static void mpn_redc_n () {ASSERT_ALWAYS(0);} - static inline int -win_size (unsigned long eb) +win_size (mp_bitcnt_t eb) { int k; - static unsigned long x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~0ul}; - for (k = 0; eb > x[k]; k++) + static mp_bitcnt_t x[] = {0,7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0}; + for (k = 1; eb > x[k]; k++) ; return k; } -#define MPN_REDC_X(rp, tp, mp, n, mip) \ - do { \ - if (redc_x == 1) \ - mpn_redc_1 (rp, tp, mp, n, mip[0]); \ - else if (redc_x == 2) \ - mpn_redc_2 (rp, tp, mp, n, mip); \ - else \ - mpn_redc_n (rp, tp, mp, n, mip); \ - } while (0) - - /* Convert U to REDC form, U_r = B^n * U mod M */ +/* Convert U to REDC form, U_r = B^n * U mod M */ static void redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n) { @@ -159,21 +135,19 @@ redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n) /* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0] Requires that mp[n-1..0] is odd. Requires that ep[en-1..0] is > 1. - Uses scratch space tp[3n..0], i.e., 3n+1 words. */ + Uses scratch space at tp of MAX(mpn_binvert_itch(n),2n) limbs. */ void mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_srcptr ep, mp_size_t en, mp_srcptr mp, mp_size_t n, mp_ptr tp) { - mp_limb_t mip[2]; + mp_limb_t ip[2], *mip; int cnt; - long ebi; + mp_bitcnt_t ebi; int windowsize, this_windowsize; mp_limb_t expbits; - mp_ptr pp, this_pp, last_pp; - mp_ptr b2p; + mp_ptr pp, this_pp; long i; - int redc_x; TMP_DECL; ASSERT (en > 1 || (en == 1 && ep[0] > 1)); @@ -182,7 +156,7 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn, TMP_MARK; count_leading_zeros (cnt, ep[en - 1]); - ebi = en * GMP_LIMB_BITS - cnt; + ebi = (mp_bitcnt_t) en * GMP_LIMB_BITS - cnt; #if 0 if (bn < n) @@ -191,7 +165,7 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn, until the result is greater than the mod argument. */ for (;;) { - mpn_sqr_n (tp, this_pp, tn); + mpn_sqr (tp, this_pp, tn); tn = tn * 2 - 1, tn += tp[tn] != 0; if (getbit (ep, ebi) != 0) mpn_mul (..., tp, tn, bp, bn); @@ -202,49 +176,75 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn, windowsize = win_size (ebi); - if (BELOW_THRESHOLD (n, REDC_2_THRESHOLD)) +#if WANT_REDC_2 + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) { + mip = ip; binvert_limb (mip[0], mp[0]); mip[0] = -mip[0]; - redc_x = 1; } -#if defined (HAVE_NATIVE_mpn_addmul_2) - else + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) { + mip = ip; mpn_binvert (mip, mp, 2, tp); mip[0] = -mip[0]; mip[1] = ~mip[1]; - redc_x = 2; + } +#else + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) + { + mip = ip; + binvert_limb (mip[0], mp[0]); + mip[0] = -mip[0]; } #endif -#if 0 - mpn_binvert (mip, mp, n, tp); - redc_x = 0; -#endif + else + { + mip = TMP_ALLOC_LIMBS (n); + mpn_binvert (mip, mp, n, tp); + } pp = TMP_ALLOC_LIMBS (n << (windowsize - 1)); this_pp = pp; redcify (this_pp, bp, bn, mp, n); - b2p = tp + 2*n; - - /* Store b^2 in b2. */ - mpn_sqr_n (tp, this_pp, n); - MPN_REDC_X (b2p, tp, mp, n, mip); + /* Store b^2 at rp. */ + mpn_sqr (tp, this_pp, n); +#if WANT_REDC_2 + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) + mpn_redc_1 (rp, tp, mp, n, mip[0]); + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) + mpn_redc_2 (rp, tp, mp, n, mip); +#else + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) + mpn_redc_1 (rp, tp, mp, n, mip[0]); +#endif + else + mpn_redc_n (rp, tp, mp, n, mip); /* Precompute odd powers of b and put them in the temporary area at pp. */ for (i = (1 << (windowsize - 1)) - 1; i > 0; i--) { - last_pp = this_pp; + mpn_mul_n (tp, this_pp, rp, n); this_pp += n; - mpn_mul_n (tp, last_pp, b2p, n); - MPN_REDC_X (this_pp, tp, mp, n, mip); +#if WANT_REDC_2 + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) + mpn_redc_1 (this_pp, tp, mp, n, mip[0]); + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) + mpn_redc_2 (this_pp, tp, mp, n, mip); +#else + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) + mpn_redc_1 (this_pp, tp, mp, n, mip[0]); +#endif + else + mpn_redc_n (this_pp, tp, mp, n, mip); } expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; - if (ebi < 0) + if (ebi < windowsize) ebi = 0; + else + ebi -= windowsize; count_trailing_zeros (cnt, expbits); ebi += cnt; @@ -252,51 +252,227 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn, MPN_COPY (rp, pp + n * (expbits >> 1), n); - while (ebi != 0) +#define INNERLOOP \ + while (ebi != 0) \ + { \ + while (getbit (ep, ebi) == 0) \ + { \ + MPN_SQR (tp, rp, n); \ + MPN_REDUCE (rp, tp, mp, n, mip); \ + ebi--; \ + if (ebi == 0) \ + goto done; \ + } \ + \ + /* The next bit of the exponent is 1. Now extract the largest \ + block of bits <= windowsize, and such that the least \ + significant bit is 1. */ \ + \ + expbits = getbits (ep, ebi, windowsize); \ + this_windowsize = windowsize; \ + if (ebi < windowsize) \ + { \ + this_windowsize -= windowsize - ebi; \ + ebi = 0; \ + } \ + else \ + ebi -= windowsize; \ + \ + count_trailing_zeros (cnt, expbits); \ + this_windowsize -= cnt; \ + ebi += cnt; \ + expbits >>= cnt; \ + \ + do \ + { \ + MPN_SQR (tp, rp, n); \ + MPN_REDUCE (rp, tp, mp, n, mip); \ + this_windowsize--; \ + } \ + while (this_windowsize != 0); \ + \ + MPN_MUL_N (tp, rp, pp + n * (expbits >> 1), n); \ + MPN_REDUCE (rp, tp, mp, n, mip); \ + } + + +#if WANT_REDC_2 + if (REDC_1_TO_REDC_2_THRESHOLD < MUL_TOOM22_THRESHOLD) { - while (getbit (ep, ebi) == 0) + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) { - mpn_sqr_n (tp, rp, n); - MPN_REDC_X (rp, tp, mp, n, mip); - ebi--; - if (ebi == 0) - goto done; +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; } - - /* The next bit of the exponent is 1. Now extract the largest block of - bits <= windowsize, and such that the least significant bit is 1. */ - - expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; - this_windowsize = windowsize; - if (ebi < 0) + else if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) { - this_windowsize += ebi; - ebi = 0; +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_2 (rp, tp, mp, n, mip) + INNERLOOP; } + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_2 (rp, tp, mp, n, mip) + INNERLOOP; + } + else + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip) + INNERLOOP; + } + } + else + { + if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; + } + else if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; + } + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_2 (rp, tp, mp, n, mip) + INNERLOOP; + } + else + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip) + INNERLOOP; + } + } - count_trailing_zeros (cnt, expbits); - this_windowsize -= cnt; - ebi += cnt; - expbits >>= cnt; +#else /* WANT_REDC_2 */ - do + if (REDC_1_TO_REDC_N_THRESHOLD < MUL_TOOM22_THRESHOLD) + { + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) { - mpn_sqr_n (tp, rp, n); - MPN_REDC_X (rp, tp, mp, n, mip); - this_windowsize--; +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; + } + else if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip) + INNERLOOP; + } + else + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip) + INNERLOOP; + } + } + else + { + if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n) +#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; + } + else if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_1 (rp, tp, mp, n, mip[0]) + INNERLOOP; + } + else + { +#undef MPN_MUL_N +#undef MPN_SQR +#undef MPN_REDUCE +#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n) +#define MPN_SQR(r,a,n) mpn_sqr (r,a,n) +#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip) + INNERLOOP; } - while (this_windowsize != 0); - - mpn_mul_n (tp, rp, pp + n * (expbits >> 1), n); - MPN_REDC_X (rp, tp, mp, n, mip); } +#endif /* WANT_REDC_2 */ done: + MPN_COPY (tp, rp, n); MPN_ZERO (tp + n, n); - MPN_REDC_X (rp, tp, mp, n, mip); + +#if WANT_REDC_2 + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD)) + mpn_redc_1 (rp, tp, mp, n, mip[0]); + else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD)) + mpn_redc_2 (rp, tp, mp, n, mip); +#else + if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD)) + mpn_redc_1 (rp, tp, mp, n, mip[0]); +#endif + else + mpn_redc_n (rp, tp, mp, n, mip); + if (mpn_cmp (rp, mp, n) >= 0) mpn_sub_n (rp, rp, mp, n); + TMP_FREE; } diff --git a/contrib/gmp/mpn/generic/powm_sec.c b/contrib/gmp/mpn/generic/powm_sec.c index 26d77b5c81..315ae6e5e0 100644 --- a/contrib/gmp/mpn/generic/powm_sec.c +++ b/contrib/gmp/mpn/generic/powm_sec.c @@ -1,4 +1,11 @@ -/* mpn_powm_sec -- Compute R = U^E mod M. Safe variant, not leaking time info. +/* mpn_powm_sec -- Compute R = U^E mod M. Secure variant, side-channel silent + under the assumption that the multiply instruction is side channel silent. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. Copyright 2007, 2008, 2009 Free Software Foundation, Inc. @@ -19,19 +26,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* - BASIC ALGORITHM, Compute b^e mod n, where n is odd. - - 1. w <- b - - 2. While w^2 < n (and there are more bits in e) - w <- power left-to-right base-2 without reduction + BASIC ALGORITHM, Compute U^E mod M, where M < B^n is odd. - 3. t <- (B^n * b) / n Convert to REDC form + 1. T <- (B^n * U) mod M Convert to REDC form - 4. Compute power table of e-dependent size + 2. Compute table U^0, U^1, U^2... of E-dependent size - 5. While there are more bits in e - w <- power left-to-right base-k with reduction + 3. While there are more bits in E + W <- power left-to-right base-k TODO: @@ -40,19 +42,12 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ That will simplify the code using getbits. (Perhaps make getbits' sibling getbit then have similar form, for symmetry.) - * Write an itch function. + * Write an itch function. Or perhaps get rid of tp parameter since the huge + pp area is allocated locally anyway? * Choose window size without looping. (Superoptimize or think(tm).) - * Make it sub-quadratic. - * Call new division functions, not mpn_tdiv_qr. - - * Is redc obsolete with improved SB division? - - * Consider special code for one-limb M. - - * Handle even M (in mpz_powm_sec) with two modexps and CRT. */ #include "gmp.h" @@ -62,11 +57,108 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define WANT_CACHE_SECURITY 1 +/* Define our own mpn squaring function. We do this since we cannot use a + native mpn_sqr_basecase over TUNE_SQR_TOOM2_MAX, or a non-native one over + SQR_TOOM2_THRESHOLD. This is so because of fixed size stack allocations + made inside mpn_sqr_basecase. */ + +#if HAVE_NATIVE_mpn_sqr_diagonal +#define MPN_SQR_DIAGONAL(rp, up, n) \ + mpn_sqr_diagonal (rp, up, n) +#else +#define MPN_SQR_DIAGONAL(rp, up, n) \ + do { \ + mp_size_t _i; \ + for (_i = 0; _i < (n); _i++) \ + { \ + mp_limb_t ul, lpl; \ + ul = (up)[_i]; \ + umul_ppmm ((rp)[2 * _i + 1], lpl, ul, ul << GMP_NAIL_BITS); \ + (rp)[2 * _i] = lpl >> GMP_NAIL_BITS; \ + } \ + } while (0) +#endif + + +#if ! HAVE_NATIVE_mpn_sqr_basecase +/* The limit of the generic code is SQR_TOOM2_THRESHOLD. */ +#define SQR_BASECASE_MAX SQR_TOOM2_THRESHOLD +#endif + +#if HAVE_NATIVE_mpn_sqr_basecase +#ifdef TUNE_SQR_TOOM2_MAX +/* We slightly abuse TUNE_SQR_TOOM2_MAX here. If it is set for an assembly + mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly + file. An assembly mpn_sqr_basecase that does not define it, should allow + any size. */ +#define SQR_BASECASE_MAX SQR_TOOM2_THRESHOLD +#endif +#endif + +#ifndef SQR_BASECASE_MAX +/* If SQR_BASECASE_MAX is now not defined, use mpn_sqr_basecase for any operand + size. */ +#define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n) +#else +/* Define our own squaring function, which uses mpn_sqr_basecase for its + allowed sizes, but its own code for larger sizes. */ +static void +mpn_local_sqr (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr tp) +{ + mp_size_t i; + + ASSERT (n >= 1); + ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n)); + + if (n < SQR_BASECASE_MAX) + { + mpn_sqr_basecase (rp, up, n); + return; + } + + { + mp_limb_t ul, lpl; + ul = up[0]; + umul_ppmm (rp[1], lpl, ul, ul << GMP_NAIL_BITS); + rp[0] = lpl >> GMP_NAIL_BITS; + } + if (n > 1) + { + mp_limb_t cy; + TMP_DECL; + TMP_MARK; + + cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]); + tp[n - 1] = cy; + for (i = 2; i < n; i++) + { + mp_limb_t cy; + cy = mpn_addmul_1 (tp + 2 * i - 2, up + i, n - i, up[i - 1]); + tp[n + i - 2] = cy; + } + MPN_SQR_DIAGONAL (rp + 2, up + 1, n - 1); + + { + mp_limb_t cy; +#if HAVE_NATIVE_mpn_addlsh1_n + cy = mpn_addlsh1_n (rp + 1, rp + 1, tp, 2 * n - 2); +#else + cy = mpn_lshift (tp, tp, 2 * n - 2, 1); + cy += mpn_add_n (rp + 1, rp + 1, tp, 2 * n - 2); +#endif + rp[2 * n - 1] += cy; + } + + TMP_FREE; + } +} +#endif + #define getbit(p,bi) \ ((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1) static inline mp_limb_t -getbits (const mp_limb_t *p, unsigned long bi, int nbits) +getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits) { int nbits_in_r; mp_limb_t r; @@ -89,48 +181,25 @@ getbits (const mp_limb_t *p, unsigned long bi, int nbits) } } -#undef HAVE_NATIVE_mpn_addmul_2 - -#ifndef HAVE_NATIVE_mpn_addmul_2 -#define REDC_2_THRESHOLD MP_SIZE_T_MAX -#endif - -#ifndef REDC_2_THRESHOLD -#define REDC_2_THRESHOLD 4 -#endif - -static void mpn_redc_n () {ASSERT_ALWAYS(0);} - static inline int -win_size (unsigned long eb) +win_size (mp_bitcnt_t eb) { int k; - static unsigned long x[] = {1,4,27,100,325,1026,2905,7848,20457,51670,~0ul}; - for (k = 0; eb > x[k]; k++) + static mp_bitcnt_t x[] = {0,4,27,100,325,1026,2905,7848,20457,51670,~(mp_bitcnt_t)0}; + for (k = 1; eb > x[k]; k++) ; return k; } -#define MPN_REDC_X(rp, tp, mp, n, mip) \ - do { \ - if (redc_x == 1) \ - mpn_redc_1 (rp, tp, mp, n, mip[0]); \ - else if (redc_x == 2) \ - mpn_redc_2 (rp, tp, mp, n, mip); \ - else \ - mpn_redc_n (rp, tp, mp, n, mip); \ - } while (0) - - /* Convert U to REDC form, U_r = B^n * U mod M */ +/* Convert U to REDC form, U_r = B^n * U mod M */ static void -redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n) +redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n, mp_ptr tp) { - mp_ptr tp, qp; + mp_ptr qp; TMP_DECL; TMP_MARK; - tp = TMP_ALLOC_LIMBS (un + n); - qp = TMP_ALLOC_LIMBS (un + 1); /* FIXME: Put at tp+? */ + qp = tp + un + n; MPN_ZERO (tp, n); MPN_COPY (tp + n, up, un); @@ -139,118 +208,103 @@ redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n) } /* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0] - Requires that mp[n-1..0] is odd. + Requires that mp[n-1..0] is odd. FIXME: is this true? Requires that ep[en-1..0] is > 1. - Uses scratch space tp[3n..0], i.e., 3n+1 words. */ + Uses scratch space at tp of 3n+1 limbs. */ void mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_srcptr ep, mp_size_t en, mp_srcptr mp, mp_size_t n, mp_ptr tp) { - mp_limb_t mip[2]; + mp_limb_t minv; int cnt; - long ebi; + mp_bitcnt_t ebi; int windowsize, this_windowsize; mp_limb_t expbits; - mp_ptr pp, this_pp, last_pp; + mp_ptr pp, this_pp; long i; - int redc_x; + int cnd; TMP_DECL; - ASSERT (en > 1 || (en == 1 && ep[0] > 1)); + ASSERT (en > 1 || (en == 1 && ep[0] > 0)); ASSERT (n >= 1 && ((mp[0] & 1) != 0)); TMP_MARK; count_leading_zeros (cnt, ep[en - 1]); - ebi = en * GMP_LIMB_BITS - cnt; + ebi = (mp_bitcnt_t) en * GMP_LIMB_BITS - cnt; windowsize = win_size (ebi); - if (BELOW_THRESHOLD (n, REDC_2_THRESHOLD)) - { - binvert_limb (mip[0], mp[0]); - mip[0] = -mip[0]; - redc_x = 1; - } -#if defined (HAVE_NATIVE_mpn_addmul_2) - else - { - mpn_binvert (mip, mp, 2, tp); - mip[0] = -mip[0]; mip[1] = ~mip[1]; - redc_x = 2; - } -#endif -#if 0 - mpn_binvert (mip, mp, n, tp); - redc_x = 0; -#endif + binvert_limb (minv, mp[0]); + minv = -minv; - pp = TMP_ALLOC_LIMBS (n << windowsize); + pp = tp + 4 * n; this_pp = pp; this_pp[n] = 1; - redcify (this_pp, this_pp + n, 1, mp, n); + redcify (this_pp, this_pp + n, 1, mp, n, tp + 6 * n); this_pp += n; - redcify (this_pp, bp, bn, mp, n); + redcify (this_pp, bp, bn, mp, n, tp + 6 * n); /* Precompute powers of b and put them in the temporary area at pp. */ for (i = (1 << windowsize) - 2; i > 0; i--) { - last_pp = this_pp; + mpn_mul_basecase (tp, this_pp, n, pp + n, n); this_pp += n; - mpn_mul_n (tp, last_pp, pp + n, n); - MPN_REDC_X (this_pp, tp, mp, n, mip); + mpn_redc_1_sec (this_pp, tp, mp, n, minv); } expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; - if (ebi < 0) + if (ebi < windowsize) ebi = 0; + else + ebi -= windowsize; MPN_COPY (rp, pp + n * expbits, n); while (ebi != 0) { expbits = getbits (ep, ebi, windowsize); - ebi -= windowsize; this_windowsize = windowsize; - if (ebi < 0) + if (ebi < windowsize) { - this_windowsize += ebi; + this_windowsize -= windowsize - ebi; ebi = 0; } + else + ebi -= windowsize; do { - mpn_sqr_n (tp, rp, n); - MPN_REDC_X (rp, tp, mp, n, mip); + mpn_local_sqr (tp, rp, n, tp + 2 * n); + mpn_redc_1_sec (rp, tp, mp, n, minv); this_windowsize--; } while (this_windowsize != 0); #if WANT_CACHE_SECURITY mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits); - mpn_mul_n (tp, rp, tp + 2*n, n); + mpn_mul_basecase (tp, rp, n, tp + 2*n, n); #else - mpn_mul_n (tp, rp, pp + n * expbits, n); + mpn_mul_basecase (tp, rp, n, pp + n * expbits, n); #endif - MPN_REDC_X (rp, tp, mp, n, mip); + mpn_redc_1_sec (rp, tp, mp, n, minv); } MPN_COPY (tp, rp, n); MPN_ZERO (tp + n, n); - MPN_REDC_X (rp, tp, mp, n, mip); - if (mpn_cmp (rp, mp, n) >= 0) - mpn_sub_n (rp, rp, mp, n); + mpn_redc_1_sec (rp, tp, mp, n, minv); + cnd = mpn_sub_n (tp, rp, mp, n); /* we need just retval */ + mpn_subcnd_n (rp, rp, mp, n, !cnd); TMP_FREE; } #if ! HAVE_NATIVE_mpn_tabselect /* Select entry `which' from table `tab', which has nents entries, each `n' limbs. Store the selected entry at rp. Reads entire table to avoid - sideband information leaks. O(n*nents). */ - + side-channel information leaks. O(n*nents). + FIXME: Move to its own file. */ void mpn_tabselect (volatile mp_limb_t *rp, volatile mp_limb_t *tab, mp_size_t n, mp_size_t nents, mp_size_t which) @@ -270,3 +324,17 @@ mpn_tabselect (volatile mp_limb_t *rp, volatile mp_limb_t *tab, mp_size_t n, } } #endif + +mp_size_t +mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n) +{ + int windowsize; + mp_size_t redcify_itch, itch; + + windowsize = win_size (en * GMP_NUMB_BITS); /* slight over-estimate of exp */ + itch = 4 * n + (n << windowsize); + redcify_itch = 2 * bn + n + 1; + /* The 6n is due to the placement of reduce scratch 6n into the start of the + scratch area. */ + return MAX (itch, redcify_itch + 6 * n); +} diff --git a/contrib/gmp/mpn/generic/pre_divrem_1.c b/contrib/gmp/mpn/generic/pre_divrem_1.c index 6badf63192..134b4cb444 100644 --- a/contrib/gmp/mpn/generic/pre_divrem_1.c +++ b/contrib/gmp/mpn/generic/pre_divrem_1.c @@ -32,8 +32,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Same test here for skipping one divide step as in mpn_divrem_1. The main reason for a separate shift==0 case is that not all CPUs give - zero for "n0 >> BITS_PER_MP_LIMB" which would arise in the general case - code used on shift==0. shift==0 is also reasonably common in __mp_bases + zero for "n0 >> GMP_LIMB_BITS" which would arise in the general case + code used on shift==0. shift==0 is also reasonably common in mp_bases big_base, for instance base==10 on a 64-bit limb. Under shift!=0 it would be possible to call mpn_lshift to adjust the @@ -106,14 +106,14 @@ mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t xsize, } n1 = ap[size-1]; - r |= n1 >> (BITS_PER_MP_LIMB - shift); + r |= n1 >> (GMP_LIMB_BITS - shift); for (i = size-2; i >= 0; i--) { ASSERT (r < d); n0 = ap[i]; udiv_qrnnd_preinv (*qp, r, r, - ((n1 << shift) | (n0 >> (BITS_PER_MP_LIMB - shift))), + ((n1 << shift) | (n0 >> (GMP_LIMB_BITS - shift))), d, dinv); qp--; n1 = n0; diff --git a/contrib/gmp/mpn/generic/random2.c b/contrib/gmp/mpn/generic/random2.c index e29238c514..7d3da9fa4d 100644 --- a/contrib/gmp/mpn/generic/random2.c +++ b/contrib/gmp/mpn/generic/random2.c @@ -22,7 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, unsigned long int)); +static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, mp_bitcnt_t)); /* Ask _gmp_rand for 32 bits per call unless that's more than a limb can hold. Thus, we get the same random number sequence in the common cases. @@ -54,9 +54,9 @@ mpn_random2 (mp_ptr rp, mp_size_t n) } static void -gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits) +gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits) { - unsigned long int bi; + mp_bitcnt_t bi; mp_limb_t ranm; /* buffer for random bits */ unsigned cap_chunksize, chunksize; mp_size_t i; diff --git a/contrib/gmp/mpn/generic/redc_1.c b/contrib/gmp/mpn/generic/redc_1.c index 47bee8220b..177f3932f9 100644 --- a/contrib/gmp/mpn/generic/redc_1.c +++ b/contrib/gmp/mpn/generic/redc_1.c @@ -4,7 +4,7 @@ THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES. -Copyright (C) 2000, 2001, 2002, 2004, 2008 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002, 2004, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -30,11 +30,14 @@ mpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm) mp_size_t j; mp_limb_t cy; + ASSERT (n > 0); ASSERT_MPN (up, 2*n); for (j = n - 1; j >= 0; j--) { - up[0] = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK); + cy = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK); + ASSERT (up[0] == 0); + up[0] = cy; up++; } cy = mpn_add_n (rp, up, up - n, n); diff --git a/contrib/gmp/mpn/generic/redc_1.c b/contrib/gmp/mpn/generic/redc_1_sec.c similarity index 73% copy from contrib/gmp/mpn/generic/redc_1.c copy to contrib/gmp/mpn/generic/redc_1_sec.c index 47bee8220b..3d914381cd 100644 --- a/contrib/gmp/mpn/generic/redc_1.c +++ b/contrib/gmp/mpn/generic/redc_1_sec.c @@ -1,10 +1,10 @@ -/* mpn_redc_1. Set cp[] <- up[]/R^n mod mp[]. Clobber up[]. +/* mpn_redc_1_sec. Set cp[] <- up[]/R^n mod mp[]. Clobber up[]. mp[] is n limbs; up[] is 2n limbs. THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES. -Copyright (C) 2000, 2001, 2002, 2004, 2008 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002, 2004, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -25,19 +25,21 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm) +mpn_redc_1_sec (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm) { mp_size_t j; mp_limb_t cy; + ASSERT (n > 0); ASSERT_MPN (up, 2*n); for (j = n - 1; j >= 0; j--) { - up[0] = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK); + cy = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK); + ASSERT (up[0] == 0); + up[0] = cy; up++; } cy = mpn_add_n (rp, up, up - n, n); - if (cy != 0) - mpn_sub_n (rp, rp, mp, n); + mpn_subcnd_n (rp, rp, mp, n, cy); } diff --git a/contrib/gmp/mpn/generic/redc_2.c b/contrib/gmp/mpn/generic/redc_2.c index 0efbd9d4c7..2b27586618 100644 --- a/contrib/gmp/mpn/generic/redc_2.c +++ b/contrib/gmp/mpn/generic/redc_2.c @@ -41,7 +41,7 @@ mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp) } #endif -#if defined (__ia64) && W_TYPE_SIZE == 64 +#if defined (__GNUC__) && defined (__ia64) && W_TYPE_SIZE == 64 #define umul2low(ph, pl, uh, ul, vh, vl) \ do { \ mp_limb_t _ph, _pl; \ @@ -74,6 +74,7 @@ mpn_redc_2 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr mip) mp_limb_t upn; mp_limb_t cy; + ASSERT (n > 0); ASSERT_MPN (up, 2*n); if ((n & 1) != 0) diff --git a/contrib/gmp/mpn/generic/redc_n.c b/contrib/gmp/mpn/generic/redc_n.c new file mode 100644 index 0000000000..99f618ff48 --- /dev/null +++ b/contrib/gmp/mpn/generic/redc_n.c @@ -0,0 +1,66 @@ +/* mpn_redc_n. Set cp[] <- up[]/R^n mod mp[]. Clobber up[]. + mp[] is n limbs; up[] is 2n limbs, the inverse ip[] is n limbs. + + THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES. + +Copyright (C) 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +/* + TODO + + * We assume mpn_mulmod_bnm1 is always faster than plain mpn_mul_n (or a + future mpn_mulhi) for the range we will be called. Follow up that + assumption. + + * Decrease scratch usage. +*/ + +void +mpn_redc_n (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr ip) +{ + mp_ptr xp, yp, scratch; + mp_limb_t cy; + mp_size_t rn; + TMP_DECL; + TMP_MARK; + + rn = mpn_mulmod_bnm1_next_size (n); + + scratch = TMP_ALLOC_LIMBS (n + rn + mpn_mulmod_bnm1_itch (rn, n, n)); + + xp = scratch; + mpn_mullo_n (xp, up, ip, n); + + yp = scratch + n; + mpn_mulmod_bnm1 (yp, rn, xp, n, mp, n, scratch + n + rn); + + ASSERT_ALWAYS (2 * n > rn); /* could handle this */ + + cy = mpn_sub_n (yp + rn, yp, up, 2*n - rn); /* undo wrap around */ + MPN_DECR_U (yp + 2*n - rn, rn, cy); + + cy = mpn_sub_n (rp, up + n, yp + n, n); + if (cy != 0) + mpn_add_n (rp, rp, mp, n); + + TMP_FREE; +} diff --git a/contrib/gmp/mpn/generic/remove.c b/contrib/gmp/mpn/generic/remove.c new file mode 100644 index 0000000000..427a46fbd1 --- /dev/null +++ b/contrib/gmp/mpn/generic/remove.c @@ -0,0 +1,143 @@ +/* mpn_remove -- divide out all multiples of odd mpn number from another mpn + number. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +#if GMP_LIMB_BITS > 50 +#define LOG 50 +#else +#define LOG GMP_LIMB_BITS +#endif + + +/* Input: U = {up,un}, V = {vp,vn} must be odd, cap + Ouput W = {wp,*wn} allocation need is exactly *wn + + Set W = U / V^k, where k is the largest integer <= cap such that the + division yields an integer. + + FIXME: We currently allow any operand overlap. This is quite non mpn-ish + and might be changed, since it cost significant temporary space. + * If we require W to have space for un limbs, we could save qp or qp2 (but + we will still need to copy things into wp 50% of the time). + * If we allow ourselves to clobber U, we could save the other of qp and qp2. +*/ + +mp_bitcnt_t +mpn_remove (mp_ptr wp, mp_size_t *wn, + mp_ptr up, mp_size_t un, mp_ptr vp, mp_size_t vn, + mp_bitcnt_t cap) +{ + mp_ptr pwpsp[LOG]; + mp_size_t pwpsn[LOG]; + mp_size_t npowers; + mp_ptr tp, qp, np, pp, qp2, scratch_out; + mp_size_t pn, nn, qn, i; + mp_bitcnt_t pwr; + TMP_DECL; + + ASSERT (un > 0); + ASSERT (vn > 0); + ASSERT (vp[0] % 2 != 0); /* 2-adic division wants odd numbers */ + ASSERT (vn > 1 || vp[0] > 1); /* else we would loop indefinitely */ + + TMP_MARK; + + tp = TMP_ALLOC_LIMBS ((un + vn) / 2); /* remainder */ + qp = TMP_ALLOC_LIMBS (un); /* quotient, alternating */ + qp2 = TMP_ALLOC_LIMBS (un); /* quotient, alternating */ + np = TMP_ALLOC_LIMBS (un + LOG); /* powers of V */ + pp = vp; + pn = vn; + + /* FIXME: This allocation need indicate a flaw in the current itch mechanism: + Which operands not greater than un,un will incur the worst itch? We need + a parallel foo_maxitch set of functions. */ + scratch_out = TMP_ALLOC_LIMBS (mpn_bdiv_qr_itch (un, un >> 1)); + + MPN_COPY (qp, up, un); + qn = un; + + npowers = 0; + while (qn >= pn) + { + mpn_bdiv_qr (qp2, tp, qp, qn, pp, pn, scratch_out); + if (!mpn_zero_p (tp, pn)) + break; /* could not divide by V^npowers */ + + MP_PTR_SWAP (qp, qp2); + qn = qn - pn; + qn += qp[qn] != 0; + + pwpsp[npowers] = pp; + pwpsn[npowers] = pn; + npowers++; + + if (((mp_bitcnt_t) 2 << npowers) - 1 > cap) + break; + + nn = 2 * pn - 1; /* next power will be at least this many limbs */ + if (nn > qn) + break; /* next power would be overlarge */ + + mpn_sqr (np, pp, pn); + nn += np[nn] != 0; + pp = np; + pn = nn; + np += nn; + } + + pwr = ((mp_bitcnt_t) 1 << npowers) - 1; + + for (i = npowers - 1; i >= 0; i--) + { + pp = pwpsp[i]; + pn = pwpsn[i]; + if (qn < pn) + continue; + + if (pwr + ((mp_bitcnt_t) 1 << i) > cap) + continue; /* V^i would bring us past cap */ + + mpn_bdiv_qr (qp2, tp, qp, qn, pp, pn, scratch_out); + if (!mpn_zero_p (tp, pn)) + continue; /* could not divide by V^i */ + + MP_PTR_SWAP (qp, qp2); + qn = qn - pn; + qn += qp[qn] != 0; + + pwr += (mp_bitcnt_t) 1 << i; + } + + MPN_COPY (wp, qp, qn); + *wn = qn; + + TMP_FREE; + + return pwr; +} diff --git a/contrib/gmp/mpn/generic/rootrem.c b/contrib/gmp/mpn/generic/rootrem.c index 657e543ab3..272b95c134 100644 --- a/contrib/gmp/mpn/generic/rootrem.c +++ b/contrib/gmp/mpn/generic/rootrem.c @@ -8,7 +8,7 @@ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT'S ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2002, 2005, 2009 Free Software Foundation, Inc. +Copyright 2002, 2005, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -26,11 +26,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* FIXME: - (a) Once there is a native mpn_tdiv_q function in GMP (division without - remainder), replace the quick-and-dirty implementation below by it. - (b) The implementation below is not optimal when remp == NULL, since the - complexity is M(n) where n is the input size, whereas it should be - only M(n/k) on average. + This implementation is not optimal when remp == NULL, since the complexity + is M(n), whereas it should be M(n/k) on average. */ #include /* for NULL */ @@ -41,8 +38,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ static mp_size_t mpn_rootrem_internal (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, int); -static void mpn_tdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, - mp_srcptr, mp_size_t); #define MPN_RSHIFT(cy,rp,up,un,cnt) \ do { \ @@ -124,7 +119,7 @@ static mp_size_t mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un, mp_limb_t k, int approx) { - mp_ptr qp, rp, sp, wp; + mp_ptr qp, rp, sp, wp, scratch; mp_size_t qn, rn, sn, wn, nl, bn; mp_limb_t save, save2, cy; unsigned long int unb; /* number of significant bits of {up,un} */ @@ -150,9 +145,15 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un, qp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain quotient and remainder of R/(k*S^(k-1)), and S^k */ if (remp == NULL) - rp = TMP_ALLOC_LIMBS (un); /* will contain the remainder */ + { + rp = TMP_ALLOC_LIMBS (un + 1); /* will contain the remainder */ + scratch = rp; /* used by mpn_div_q */ + } else - rp = remp; + { + scratch = TMP_ALLOC_LIMBS (un + 1); /* used by mpn_div_q */ + rp = remp; + } sp = rootp; wp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain S^(k-1), k*S^(k-1), and temporary for mpn_pow_1 */ @@ -297,7 +298,7 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un, The quotient needs rn-wn+1 limbs, thus quotient+remainder need altogether rn+1 limbs. */ tp = qp + qn + 1; /* put remainder in Q buffer */ - mpn_tdiv_q (qp, tp, 0, rp, rn, wp, wn); + mpn_div_q (qp, rp, rn, wp, wn, scratch); qn += qp[qn] != 0; } @@ -405,47 +406,3 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un, TMP_FREE; return rn; } - -/* return the quotient Q = {np, nn} divided by {dp, dn} only */ -static void -mpn_tdiv_q (mp_ptr qp, mp_ptr rp, mp_size_t qxn, mp_srcptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn) -{ - mp_size_t qn = nn - dn; /* expected quotient size is qn+1 */ - mp_size_t cut; - - ASSERT_ALWAYS (qxn == 0); - if (dn <= qn + 3) - { - mpn_tdiv_qr (qp, rp, 0, np, nn, dp, dn); - } - else - { - mp_ptr tp; - TMP_DECL; - TMP_MARK; - tp = TMP_ALLOC_LIMBS (qn + 2); - cut = dn - (qn + 3); - /* perform a first division with divisor cut to dn-cut=qn+3 limbs - and dividend to nn-(cut-1) limbs, i.e. the quotient will be one - limb more than the final quotient. - The quotient will have qn+2 < dn-cut limbs, - and the remainder dn-cut = qn+3 limbs. */ - mpn_tdiv_qr (tp, rp, 0, np + cut - 1, nn - cut + 1, dp + cut, dn - cut); - /* let Q' be the quotient of B * {np, nn} by {dp, dn} [qn+2 limbs] - and T be the approximation of Q' computed above, where - B = 2^GMP_NUMB_BITS. - We have Q' <= T <= Q'+1, and since floor(Q'/B) = Q, we have - Q = floor(T/B), unless the last limb of T only consists of zeroes. */ - if (tp[0] != 0) - { - /* simply truncate one limb of T */ - MPN_COPY (qp, tp + 1, qn + 1); - } - else /* too bad: perform the expensive division */ - { - mpn_tdiv_qr (qp, rp, 0, np, nn, dp, dn); - } - TMP_FREE; - } -} diff --git a/contrib/gmp/mpn/generic/sb_div_qr.c b/contrib/gmp/mpn/generic/sb_div_qr.c deleted file mode 100644 index 40e4442e21..0000000000 --- a/contrib/gmp/mpn/generic/sb_div_qr.c +++ /dev/null @@ -1,91 +0,0 @@ -/* mpn_sb_div_qr -- schoolbook division with 2-limb sloppy non-greater - precomputed inverse, returning quotient and remainder. - - Contributed to the GNU project by Torbjörn Granlund. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. - -Copyright 2006, 2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -/* - CAVEATS: - 1. Should it demand normalized operands like now, or normalize on-the-fly? - 2. Overwrites {np,nn} instead of writing remainder to a designated area. - 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1 - instead. (That would open for mpn_addmul_2 straightforwardly.) -*/ - -mp_limb_t -mpn_sb_div_qr (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_srcptr dip) -{ - mp_limb_t q, q10, q01a, q00a, q01b, q00b; - mp_limb_t cy; - mp_size_t i; - mp_limb_t qh; - mp_limb_t di1, di0; - - ASSERT (dn > 0); - ASSERT (nn >= dn); - ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0); - ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np); - ASSERT_MPN (np, nn); - ASSERT_MPN (dp, dn); - - np += nn; - - qh = mpn_cmp (np - dn, dp, dn) >= 0; - if (qh != 0) - mpn_sub_n (np - dn, np - dn, dp, dn); - - qp += nn - dn; - di1 = dip[1]; di0 = dip[0]; - for (i = nn - dn; i > 0; i--) - { - np--; - umul_ppmm (q, q10, np[0], di1); - umul_ppmm (q01a, q00a, np[-1], di1); - add_ssaaaa (q, q10, q, q10, np[0], q01a); - umul_ppmm (q01b, q00b, np[0], di0); - add_ssaaaa (q, q10, q, q10, 0, q01b); - add_ssaaaa (q, q10, q, q10, 0, np[-1]); - - cy = mpn_submul_1 (np - dn, dp, dn, q); - - if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0)) - { - q = q + 1; - mpn_sub_n (np - dn, np - dn, dp, dn); - } - - *--qp = q; - } - - return qh; -} diff --git a/contrib/gmp/mpn/generic/sb_divappr_q.c b/contrib/gmp/mpn/generic/sb_divappr_q.c deleted file mode 100644 index 42a39be009..0000000000 --- a/contrib/gmp/mpn/generic/sb_divappr_q.c +++ /dev/null @@ -1,136 +0,0 @@ -/* mpn_sb_divappr_q -- schoolbook division with 2-limb sloppy non-greater - precomputed inverse, returning approximate quotient. - - Contributed to the GNU project by Torbjörn Granlund. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. - -Copyright 2006, 2007 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - -/* - CAVEATS: - 1. Should it demand normalized operands like now, or normalize on-the-fly? - 2. Overwrites {np,nn}. - 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1 - instead. (That would open for mpn_addmul_2 straightforwardly.) -*/ - -mp_limb_t -mpn_sb_divappr_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_srcptr dip) -{ - mp_limb_t q, q10, q01a, q00a, q01b, q00b; - mp_limb_t cy; - mp_size_t i; - mp_limb_t qh; - mp_limb_t di1, di0; - mp_size_t qn; - - ASSERT (dn > 0); - ASSERT (nn >= dn); - ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0); - ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np); - ASSERT_MPN (np, nn); - ASSERT_MPN (dp, dn); - - np += nn; - qn = nn - dn; - if (qn + 1 < dn) - { - dp += dn - (qn + 1); - dn = qn + 1; - } - - qh = mpn_cmp (np - dn, dp, dn) >= 0; - if (qh != 0) - mpn_sub_n (np - dn, np - dn, dp, dn); - - qp += qn; - di1 = dip[1]; di0 = dip[0]; - for (i = qn; i >= dn; i--) - { - np--; - umul_ppmm (q, q10, np[0], di1); - umul_ppmm (q01a, q00a, np[-1], di1); - add_ssaaaa (q, q10, q, q10, np[0], q01a); - umul_ppmm (q01b, q00b, np[0], di0); - add_ssaaaa (q, q10, q, q10, 0, q01b); - add_ssaaaa (q, q10, q, q10, 0, np[-1]); - - cy = mpn_submul_1 (np - dn, dp, dn, q); - - if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0)) - { - q = q + 1; - mpn_sub_n (np - dn, np - dn, dp, dn); - } - - *--qp = q; - } - - for (i = dn - 1; i > 0; i--) - { - np--; - umul_ppmm (q, q10, np[0], di1); - umul_ppmm (q01a, q00a, np[-1], di1); - add_ssaaaa (q, q10, q, q10, np[0], q01a); - umul_ppmm (q01b, q00b, np[0], di0); - add_ssaaaa (q, q10, q, q10, 0, q01b); - add_ssaaaa (q, q10, q, q10, 0, np[-1]); - - cy = mpn_submul_1 (np - dn, dp, dn, q); - - if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0)) - { - q = q + 1; - if (q == 0) - q = GMP_NUMB_MAX; - else - mpn_sub_n (np - dn, np - dn, dp, dn); - } - - *--qp = q; - - /* Truncate operands. */ - dn--; - dp++; - - /* The partial remainder might be equal to the truncated divisor, - thus non-canonical. When that happens, the rest of the quotient - should be all ones. */ - if (UNLIKELY (mpn_cmp (np - dn, dp, dn) == 0)) - { - while (--i) - *--qp = GMP_NUMB_MAX; - break; - } - } - - return qh; -} diff --git a/contrib/gmp/mpn/generic/sb_divrem_mn.c b/contrib/gmp/mpn/generic/sb_divrem_mn.c deleted file mode 100644 index 06e2f4ca0d..0000000000 --- a/contrib/gmp/mpn/generic/sb_divrem_mn.c +++ /dev/null @@ -1,205 +0,0 @@ -/* mpn_sb_divrem_mn -- Divide natural numbers, producing both remainder and - quotient. - - THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE - INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. - IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A - FUTURE GNU MP RELEASE. - - -Copyright 1993, 1994, 1995, 1996, 2000, 2001, 2002 Free Software Foundation, -Inc. - -This file is part of the GNU MP Library. - -The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -The GNU MP Library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" - - -/* The size where udiv_qrnnd_preinv should be used rather than udiv_qrnnd, - meaning the quotient size where that should happen, the quotient size - being how many udiv divisions will be done. - - The default is to use preinv always, CPUs where this doesn't suit have - tuned thresholds. Note in particular that preinv should certainly be - used if that's the only division available (USE_PREINV_ALWAYS). */ - -#ifndef DIV_SB_PREINV_THRESHOLD -#define DIV_SB_PREINV_THRESHOLD 0 -#endif - - -/* Divide num (NP/NSIZE) by den (DP/DSIZE) and write - the NSIZE-DSIZE least significant quotient limbs at QP - and the DSIZE long remainder at NP. - Return the most significant limb of the quotient, this is always 0 or 1. - - Preconditions: - 0. NSIZE >= DSIZE. - 1. The most significant bit of the divisor must be set. - 2. QP must either not overlap with the input operands at all, or - QP + DSIZE >= NP must hold true. (This means that it's - possible to put the quotient in the high part of NUM, right after the - remainder in NUM. - 3. NSIZE >= DSIZE. - 4. DSIZE > 2. */ - - -mp_limb_t -mpn_sb_divrem_mn (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn) -{ - mp_limb_t most_significant_q_limb = 0; - mp_size_t qn = nn - dn; - mp_size_t i; - mp_limb_t dx, d1, n0; - mp_limb_t dxinv; - int use_preinv; - - ASSERT (dn > 2); - ASSERT (nn >= dn); - ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT); - ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np); - ASSERT_MPN (np, nn); - ASSERT_MPN (dp, dn); - - np += qn; - dx = dp[dn - 1]; - d1 = dp[dn - 2]; - n0 = np[dn - 1]; - - if (n0 >= dx) - { - if (n0 > dx || mpn_cmp (np, dp, dn - 1) >= 0) - { - mpn_sub_n (np, np, dp, dn); - most_significant_q_limb = 1; - } - } - - use_preinv = ABOVE_THRESHOLD (qn, DIV_SB_PREINV_THRESHOLD); - if (use_preinv) - invert_limb (dxinv, dx); - - for (i = qn - 1; i >= 0; i--) - { - mp_limb_t q; - mp_limb_t nx; - mp_limb_t cy_limb; - - nx = np[dn - 1]; /* FIXME: could get value from r1 */ - np--; - - if (nx == dx) - { - /* This might over-estimate q, but it's probably not worth - the extra code here to find out. */ - q = GMP_NUMB_MASK; - -#if 1 - cy_limb = mpn_submul_1 (np, dp, dn, q); -#else - /* This should be faster on many machines */ - cy_limb = mpn_sub_n (np + 1, np + 1, dp, dn); - cy = mpn_add_n (np, np, dp, dn); - np[dn] += cy; -#endif - - if (nx != cy_limb) - { - mpn_add_n (np, np, dp, dn); - q--; - } - - qp[i] = q; - } - else - { - mp_limb_t rx, r1, r0, p1, p0; - - /* "workaround" avoids a problem with gcc 2.7.2.3 i386 register usage - when np[dn-1] is used in an asm statement like umul_ppmm in - udiv_qrnnd_preinv. The symptom is seg faults due to registers - being clobbered. gcc 2.95 i386 doesn't have the problem. */ - { - mp_limb_t workaround = np[dn - 1]; - if (CACHED_ABOVE_THRESHOLD (use_preinv, DIV_SB_PREINV_THRESHOLD)) - udiv_qrnnd_preinv (q, r1, nx, workaround, dx, dxinv); - else - { - udiv_qrnnd (q, r1, nx, workaround << GMP_NAIL_BITS, - dx << GMP_NAIL_BITS); - r1 >>= GMP_NAIL_BITS; - } - } - umul_ppmm (p1, p0, d1, q << GMP_NAIL_BITS); - p0 >>= GMP_NAIL_BITS; - - r0 = np[dn - 2]; - rx = 0; - if (r1 < p1 || (r1 == p1 && r0 < p0)) - { - p1 -= p0 < d1; - p0 = (p0 - d1) & GMP_NUMB_MASK; - q--; - r1 = (r1 + dx) & GMP_NUMB_MASK; - rx = r1 < dx; - } - - p1 += r0 < p0; /* cannot carry! */ - rx -= r1 < p1; /* may become 11..1 if q is still too large */ - r1 = (r1 - p1) & GMP_NUMB_MASK; - r0 = (r0 - p0) & GMP_NUMB_MASK; - - cy_limb = mpn_submul_1 (np, dp, dn - 2, q); - - /* Check if we've over-estimated q, and adjust as needed. */ - { - mp_limb_t cy1, cy2; - cy1 = r0 < cy_limb; - r0 = (r0 - cy_limb) & GMP_NUMB_MASK; - cy2 = r1 < cy1; - r1 -= cy1; - np[dn - 1] = r1; - np[dn - 2] = r0; - if (cy2 != rx) - { - mpn_add_n (np, np, dp, dn); - q--; - } - } - qp[i] = q; - } - } - - /* ______ ______ ______ - |__rx__|__r1__|__r0__| partial remainder - ______ ______ - - |__p1__|__p0__| partial product to subtract - ______ ______ - - |______|cylimb| - - rx is -1, 0 or 1. If rx=1, then q is correct (it should match - carry out). If rx=-1 then q is too large. If rx=0, then q might - be too large, but it is most likely correct. - */ - - return most_significant_q_limb; -} diff --git a/contrib/gmp/mpn/generic/sb_bdiv_q.c b/contrib/gmp/mpn/generic/sbpi1_bdiv_q.c similarity index 64% rename from contrib/gmp/mpn/generic/sb_bdiv_q.c rename to contrib/gmp/mpn/generic/sbpi1_bdiv_q.c index 474c804d48..3d2f743cde 100644 --- a/contrib/gmp/mpn/generic/sb_bdiv_q.c +++ b/contrib/gmp/mpn/generic/sbpi1_bdiv_q.c @@ -1,4 +1,4 @@ -/* mpn_sb_bdiv_q -- schoolbook Hensel division with precomputed inverse, +/* mpn_sbpi1_bdiv_q -- schoolbook Hensel division with precomputed inverse, returning quotient only. Contributed to the GNU project by Niels Möller. @@ -7,7 +7,7 @@ IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2005, 2006 Free Software Foundation, Inc. +Copyright 2005, 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -29,7 +29,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Computes Q = N / D mod B^nn, destroys N. - Clobbers N. D must be odd. dinv is (-D)^-1 mod B. @@ -45,47 +44,44 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ qp[i] = (-D)^{-1} * np[i] (mod B) N += B^i * qp[i] * D - And then we flip the sign, -Q = (not Q) + 1. -*/ + And then we flip the sign, -Q = (not Q) + 1. */ void -mpn_sb_bdiv_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_limb_t dinv) +mpn_sbpi1_bdiv_q (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) { mp_size_t i; - mp_limb_t qh; + mp_limb_t cy, q; - ASSERT (nn > 0); ASSERT (dn > 0); ASSERT (nn >= dn); - ASSERT (dp[0] & 1); + ASSERT ((dp[0] & 1) != 0); - for (i = 0; i < nn - dn; i++) + for (i = nn - dn; i > 0; i--) { - mp_limb_t cy; - mp_limb_t q; - - q = dinv * np[i]; - qp[i] = ~q; - cy = mpn_addmul_1 (np + i, dp, dn, q); - mpn_add_1 (np + i + dn, np + i + dn, nn - i - dn, cy); - ASSERT (np[i] == 0); + q = dinv * np[0]; + qp[0] = ~q; + qp++; + cy = mpn_addmul_1 (np, dp, dn, q); + mpn_add_1 (np + dn, np + dn, i, cy); + ASSERT (np[0] == 0); + np++; } - for (; i < nn - 1; i++) + for (i = dn; i > 1; i--) { - mp_limb_t q; - - q = dinv * np[i]; - qp[i] = ~q; - mpn_addmul_1 (np + i, dp, nn - i, q); - - ASSERT (np[i] == 0); + q = dinv * np[0]; + qp[0] = ~q; + qp++; + mpn_addmul_1 (np, dp, i, q); + ASSERT (np[0] == 0); + np++; } /* Final limb */ - qp[nn - 1] = ~(dinv * np[nn - 1]); - qh = mpn_add_1 (qp, qp, nn, 1); /* FIXME: can we get carry? */ + q = dinv * np[0]; + qp[0] = ~q; + mpn_add_1 (qp - nn + 1, qp - nn + 1, nn, 1); } diff --git a/contrib/gmp/mpn/generic/sb_bdiv_qr.c b/contrib/gmp/mpn/generic/sbpi1_bdiv_qr.c similarity index 83% rename from contrib/gmp/mpn/generic/sb_bdiv_qr.c rename to contrib/gmp/mpn/generic/sbpi1_bdiv_qr.c index d1cd0dee32..c20477a3d9 100644 --- a/contrib/gmp/mpn/generic/sb_bdiv_qr.c +++ b/contrib/gmp/mpn/generic/sbpi1_bdiv_qr.c @@ -1,12 +1,13 @@ -/* mpn_sb_bdiv_qr -- schoolbook Hensel division with precomputed inverse, +/* mpn_sbpi1_bdiv_qr -- schoolbook Hensel division with precomputed inverse, returning quotient and remainder. Contributed to the GNU project by Niels Möller. THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. - IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. + IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS + ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2006 Free Software Foundation, Inc. +Copyright 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -40,19 +41,18 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ D must be odd. dinv is (-D)^-1 mod B. */ mp_limb_t -mpn_sb_bdiv_qr (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, mp_limb_t dinv) +mpn_sbpi1_bdiv_qr (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, mp_limb_t dinv) { mp_size_t qn; mp_size_t i; mp_limb_t rh; mp_limb_t ql; - ASSERT (nn > 0); ASSERT (dn > 0); ASSERT (nn > dn); - ASSERT (dp[0] & 1); + ASSERT ((dp[0] & 1) != 0); qn = nn - dn; diff --git a/contrib/gmp/mpn/generic/sb_div_q.c b/contrib/gmp/mpn/generic/sbpi1_div_q.c similarity index 54% rename from contrib/gmp/mpn/generic/sb_div_q.c rename to contrib/gmp/mpn/generic/sbpi1_div_q.c index 609c4ae7f2..595a03f092 100644 --- a/contrib/gmp/mpn/generic/sb_div_q.c +++ b/contrib/gmp/mpn/generic/sbpi1_div_q.c @@ -1,14 +1,13 @@ -/* mpn_sb_div_q -- schoolbook division with 2-limb sloppy non-greater - precomputed inverse, returning an accurate quotient. +/* mpn_sbpi1_div_q -- Schoolbook division using the Möller-Granlund 3/2 + division algorithm. - Contributed to the GNU project by Torbjörn Granlund. + Contributed to the GNU project by Torbjorn Granlund. - THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS - ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS - ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP - RELEASE. + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 2006, 2007 Free Software Foundation, Inc. +Copyright 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -25,45 +24,35 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" -/* - CAVEATS: - 1. Should it demand normalized operands like now, or normalize on-the-fly? - 2. Overwrites {np,nn}. - 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1 - instead. (That would open for mpn_addmul_2 straightforwardly.) -*/ - mp_limb_t -mpn_sb_div_q (mp_ptr qp, - mp_ptr np, mp_size_t nn, - mp_srcptr dp, mp_size_t dn, - mp_srcptr dip) +mpn_sbpi1_div_q (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) { - mp_limb_t q, q10, q01a, q00a, q01b, q00b; - mp_limb_t cy; - mp_size_t i; mp_limb_t qh; - mp_limb_t di1, di0; - mp_size_t qn; + mp_size_t qn, i; + mp_limb_t n1, n0; + mp_limb_t d1, d0; + mp_limb_t cy, cy1; + mp_limb_t q; + mp_limb_t flag; mp_size_t dn_orig = dn; mp_srcptr dp_orig = dp; mp_ptr np_orig = np; - ASSERT (dn > 0); + ASSERT (dn > 2); ASSERT (nn >= dn); ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0); - ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn)); - ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np); - ASSERT_MPN (np, nn); - ASSERT_MPN (dp, dn); np += nn; + qn = nn - dn; if (qn + 1 < dn) { @@ -76,68 +65,131 @@ mpn_sb_div_q (mp_ptr qp, mpn_sub_n (np - dn, np - dn, dp, dn); qp += qn; - di1 = dip[1]; di0 = dip[0]; - for (i = qn; i >= dn; i--) + + dn -= 2; /* offset dn by 2 for main division loops, + saving two iterations in mpn_submul_1. */ + d1 = dp[dn + 1]; + d0 = dp[dn + 0]; + + np -= 2; + + n1 = np[1]; + + for (i = qn - (dn + 2); i >= 0; i--) { np--; - umul_ppmm (q, q10, np[0], di1); - umul_ppmm (q01a, q00a, np[-1], di1); - add_ssaaaa (q, q10, q, q10, np[0], q01a); - umul_ppmm (q01b, q00b, np[0], di0); - add_ssaaaa (q, q10, q, q10, 0, q01b); - add_ssaaaa (q, q10, q, q10, 0, np[-1]); + if (UNLIKELY (n1 == d1) && np[1] == d0) + { + q = GMP_NUMB_MASK; + mpn_submul_1 (np - dn, dp, dn + 2, q); + n1 = np[1]; /* update n1, last loop's value will now be invalid */ + } + else + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); - cy = mpn_submul_1 (np - dn, dp, dn, q); + cy = mpn_submul_1 (np - dn, dp, dn, q); - if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0)) - { - q = q + 1; - mpn_sub_n (np - dn, np - dn, dp, dn); + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 -= cy1; + np[0] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1); + q--; + } } *--qp = q; } - for (i = dn - 1; i > 0; i--) - { - np--; - umul_ppmm (q, q10, np[0], di1); - umul_ppmm (q01a, q00a, np[-1], di1); - add_ssaaaa (q, q10, q, q10, np[0], q01a); - umul_ppmm (q01b, q00b, np[0], di0); - add_ssaaaa (q, q10, q, q10, 0, q01b); - add_ssaaaa (q, q10, q, q10, 0, np[-1]); + flag = ~CNST_LIMB(0); - cy = mpn_submul_1 (np - dn, dp, dn, q); - - if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0)) + if (dn >= 0) + { + for (i = dn; i > 0; i--) { - q = q + 1; - if (q == 0) - q = GMP_NUMB_MAX; + np--; + if (UNLIKELY (n1 >= (d1 & flag))) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np - dn, dp, dn + 2, q); + + if (UNLIKELY (n1 != cy)) + { + if (n1 < (cy & flag)) + { + q--; + mpn_add_n (np - dn, np - dn, dp, dn + 2); + } + else + flag = 0; + } + n1 = np[1]; + } else - mpn_sub_n (np - dn, np - dn, dp, dn); - } + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); - *--qp = q; + cy = mpn_submul_1 (np - dn, dp, dn, q); - /* Truncate operands. */ - dn--; - dp++; + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 -= cy1; + np[0] = n0; - /* The partial remainder might be equal to the truncated divisor, - thus non-canonical. When that happens, the rest of the quotient - should be all ones. */ - if (UNLIKELY (mpn_cmp (np - dn, dp, dn) == 0)) + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1); + q--; + } + } + + *--qp = q; + + /* Truncate operands. */ + dn--; + dp++; + } + + np--; + if (UNLIKELY (n1 >= (d1 & flag))) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np, dp, 2, q); + + if (UNLIKELY (n1 != cy)) + { + if (n1 < (cy & flag)) + { + q--; + add_ssaaaa (np[1], np[0], np[1], np[0], dp[1], dp[0]); + } + else + flag = 0; + } + n1 = np[1]; + } + else { - while (--i) - *--qp = GMP_NUMB_MAX; - break; + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); + + np[0] = n0; + np[1] = n1; } + + *--qp = q; } + ASSERT_ALWAYS (np[1] == n1); + np += 2; + dn = dn_orig; - if (UNLIKELY (np[-1] < dn)) + if (UNLIKELY (n1 < (dn & flag))) { mp_limb_t q, x; @@ -157,7 +209,7 @@ mpn_sb_div_q (mp_ptr qp, data, instead handle both the triangularization and chopping at once. */ - x = np[-1]; + x = n1; if (dn > 2) { @@ -198,9 +250,6 @@ mpn_sb_div_q (mp_ptr qp, { /* Compensate for ignored dividend and divisor tails. */ - if (qn == 0) - return qh; - dp = dp_orig; np = np_orig; @@ -211,13 +260,17 @@ mpn_sb_div_q (mp_ptr qp, { if (x == 0) { - cy = mpn_sub_1 (qp, qp, qn, 1); + if (qn != 0) + cy = mpn_sub_1 (qp, qp, qn, 1); return qh - cy; } x--; } } + if (qn == 0) + return qh; + for (i = dn - qn - 2; i >= 0; i--) { cy = mpn_submul_1 (np + i, qp, qn, dp[i]); @@ -227,8 +280,7 @@ mpn_sb_div_q (mp_ptr qp, if (x == 0) { cy = mpn_sub_1 (qp, qp, qn, 1); - ASSERT_ALWAYS (cy == 0); - return qh - cy; + return qh; } x--; } diff --git a/contrib/gmp/mpn/generic/sbpi1_div_qr.c b/contrib/gmp/mpn/generic/sbpi1_div_qr.c new file mode 100644 index 0000000000..7e53aae58f --- /dev/null +++ b/contrib/gmp/mpn/generic/sbpi1_div_qr.c @@ -0,0 +1,99 @@ +/* mpn_sbpi1_div_qr -- Schoolbook division using the Möller-Granlund 3/2 + division algorithm. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2007, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +mp_limb_t +mpn_sbpi1_div_qr (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) +{ + mp_limb_t qh; + mp_size_t i; + mp_limb_t n1, n0; + mp_limb_t d1, d0; + mp_limb_t cy, cy1; + mp_limb_t q; + + ASSERT (dn > 2); + ASSERT (nn >= dn); + ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0); + + np += nn; + + qh = mpn_cmp (np - dn, dp, dn) >= 0; + if (qh != 0) + mpn_sub_n (np - dn, np - dn, dp, dn); + + qp += nn - dn; + + dn -= 2; /* offset dn by 2 for main division loops, + saving two iterations in mpn_submul_1. */ + d1 = dp[dn + 1]; + d0 = dp[dn + 0]; + + np -= 2; + + n1 = np[1]; + + for (i = nn - (dn + 2); i > 0; i--) + { + np--; + if (UNLIKELY (n1 == d1) && np[1] == d0) + { + q = GMP_NUMB_MASK; + mpn_submul_1 (np - dn, dp, dn + 2, q); + n1 = np[1]; /* update n1, last loop's value will now be invalid */ + } + else + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); + + cy = mpn_submul_1 (np - dn, dp, dn, q); + + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 = (n1 - cy1) & GMP_NUMB_MASK; + np[0] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1); + q--; + } + } + + *--qp = q; + } + np[1] = n1; + + return qh; +} diff --git a/contrib/gmp/mpn/generic/sbpi1_divappr_q.c b/contrib/gmp/mpn/generic/sbpi1_divappr_q.c new file mode 100644 index 0000000000..53d4a25066 --- /dev/null +++ b/contrib/gmp/mpn/generic/sbpi1_divappr_q.c @@ -0,0 +1,188 @@ +/* mpn_sbpi1_divappr_q -- Schoolbook division using the Möller-Granlund 3/2 + division algorithm, returning approximate quotient. The quotient returned + is either correct, or one too large. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. + +Copyright 2007, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +mp_limb_t +mpn_sbpi1_divappr_q (mp_ptr qp, + mp_ptr np, mp_size_t nn, + mp_srcptr dp, mp_size_t dn, + mp_limb_t dinv) +{ + mp_limb_t qh; + mp_size_t qn, i; + mp_limb_t n1, n0; + mp_limb_t d1, d0; + mp_limb_t cy, cy1; + mp_limb_t q; + mp_limb_t flag; + + ASSERT (dn > 2); + ASSERT (nn >= dn); + ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0); + + np += nn; + + qn = nn - dn; + if (qn + 1 < dn) + { + dp += dn - (qn + 1); + dn = qn + 1; + } + + qh = mpn_cmp (np - dn, dp, dn) >= 0; + if (qh != 0) + mpn_sub_n (np - dn, np - dn, dp, dn); + + qp += qn; + + dn -= 2; /* offset dn by 2 for main division loops, + saving two iterations in mpn_submul_1. */ + d1 = dp[dn + 1]; + d0 = dp[dn + 0]; + + np -= 2; + + n1 = np[1]; + + for (i = qn - (dn + 2); i >= 0; i--) + { + np--; + if (UNLIKELY (n1 == d1) && np[1] == d0) + { + q = GMP_NUMB_MASK; + mpn_submul_1 (np - dn, dp, dn + 2, q); + n1 = np[1]; /* update n1, last loop's value will now be invalid */ + } + else + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); + + cy = mpn_submul_1 (np - dn, dp, dn, q); + + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 -= cy1; + np[0] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1); + q--; + } + } + + *--qp = q; + } + + flag = ~CNST_LIMB(0); + + if (dn >= 0) + { + for (i = dn; i > 0; i--) + { + np--; + if (UNLIKELY (n1 >= (d1 & flag))) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np - dn, dp, dn + 2, q); + + if (UNLIKELY (n1 != cy)) + { + if (n1 < (cy & flag)) + { + q--; + mpn_add_n (np - dn, np - dn, dp, dn + 2); + } + else + flag = 0; + } + n1 = np[1]; + } + else + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); + + cy = mpn_submul_1 (np - dn, dp, dn, q); + + cy1 = n0 < cy; + n0 = (n0 - cy) & GMP_NUMB_MASK; + cy = n1 < cy1; + n1 -= cy1; + np[0] = n0; + + if (UNLIKELY (cy != 0)) + { + n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1); + q--; + } + } + + *--qp = q; + + /* Truncate operands. */ + dn--; + dp++; + } + + np--; + if (UNLIKELY (n1 >= (d1 & flag))) + { + q = GMP_NUMB_MASK; + cy = mpn_submul_1 (np, dp, 2, q); + + if (UNLIKELY (n1 != cy)) + { + if (n1 < (cy & flag)) + { + q--; + add_ssaaaa (np[1], np[0], np[1], np[0], dp[1], dp[0]); + } + else + flag = 0; + } + n1 = np[1]; + } + else + { + udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv); + + np[1] = n1; + np[0] = n0; + } + + *--qp = q; + } + + ASSERT_ALWAYS (np[1] == n1); + + return qh; +} diff --git a/contrib/gmp/mpn/generic/scan0.c b/contrib/gmp/mpn/generic/scan0.c index 2e9f3a43da..234ba9bfba 100644 --- a/contrib/gmp/mpn/generic/scan0.c +++ b/contrib/gmp/mpn/generic/scan0.c @@ -25,9 +25,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ 1. U must sooner or later have a limb with a clear bit. */ -unsigned long int -mpn_scan0 (register mp_srcptr up, - register unsigned long int starting_bit) +mp_bitcnt_t +mpn_scan0 (mp_srcptr up, mp_bitcnt_t starting_bit) { mp_size_t starting_word; mp_limb_t alimb; diff --git a/contrib/gmp/mpn/generic/scan1.c b/contrib/gmp/mpn/generic/scan1.c index d0d9a3feea..9fb2446af5 100644 --- a/contrib/gmp/mpn/generic/scan1.c +++ b/contrib/gmp/mpn/generic/scan1.c @@ -25,9 +25,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ 1. U must sooner or later have a limb != 0. */ -unsigned long int -mpn_scan1 (register mp_srcptr up, - register unsigned long int starting_bit) +mp_bitcnt_t +mpn_scan1 (mp_srcptr up, mp_bitcnt_t starting_bit) { mp_size_t starting_word; mp_limb_t alimb; diff --git a/contrib/gmp/mpn/generic/set_str.c b/contrib/gmp/mpn/generic/set_str.c index 975cfb0dad..83f5ac550d 100644 --- a/contrib/gmp/mpn/generic/set_str.c +++ b/contrib/gmp/mpn/generic/set_str.c @@ -69,7 +69,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base) int next_bitpos; mp_limb_t res_digit; mp_size_t size; - int bits_per_indigit = __mp_bases[base].big_base; + int bits_per_indigit = mp_bases[base].big_base; size = 0; res_digit = 0; @@ -107,7 +107,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base) TMP_MARK; - chars_per_limb = __mp_bases[base].chars_per_limb; + chars_per_limb = mp_bases[base].chars_per_limb; un = str_len / chars_per_limb + 1; @@ -139,9 +139,9 @@ mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, i powtab_mem_ptr = powtab_mem; - chars_per_limb = __mp_bases[base].chars_per_limb; - big_base = __mp_bases[base].big_base; - big_base_inverted = __mp_bases[base].big_base_inverted; + chars_per_limb = mp_bases[base].chars_per_limb; + big_base = mp_bases[base].big_base; + big_base_inverted = mp_bases[base].big_base_inverted; count_leading_zeros (normalization_steps, big_base); p = powtab_mem_ptr; @@ -169,7 +169,7 @@ mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, i ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_set_str_powtab_alloc (un)); - mpn_sqr_n (t, p, n); + mpn_sqr (t, p, n); n = 2 * n - 1; n += t[n] != 0; digits_in_base *= 2; #if 1 @@ -278,11 +278,11 @@ mpn_bc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base) mp_limb_t res_digit; ASSERT (base >= 2); - ASSERT (base < numberof (__mp_bases)); + ASSERT (base < numberof (mp_bases)); ASSERT (str_len >= 1); - big_base = __mp_bases[base].big_base; - chars_per_limb = __mp_bases[base].chars_per_limb; + big_base = mp_bases[base].big_base; + chars_per_limb = mp_bases[base].chars_per_limb; size = 0; for (i = chars_per_limb; i < str_len; i += chars_per_limb) diff --git a/contrib/gmp/mpn/generic/sizeinbase.c b/contrib/gmp/mpn/generic/sizeinbase.c index edd10b544e..303359a5cc 100644 --- a/contrib/gmp/mpn/generic/sizeinbase.c +++ b/contrib/gmp/mpn/generic/sizeinbase.c @@ -37,7 +37,7 @@ mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) ASSERT (xsize >= 0); ASSERT (base >= 2); - ASSERT (base < numberof (__mp_bases)); + ASSERT (base < numberof (mp_bases)); /* Special case for X == 0. */ if (xsize == 0) @@ -45,14 +45,14 @@ mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) /* Calculate the total number of significant bits of X. */ count_leading_zeros (cnt, xp[xsize-1]); - totbits = xsize * BITS_PER_MP_LIMB - cnt; + totbits = xsize * GMP_LIMB_BITS - cnt; if (POW2_P (base)) { /* Special case for powers of 2, giving exact result. */ - lb_base = __mp_bases[base].big_base; + lb_base = mp_bases[base].big_base; return (totbits + lb_base - 1) / lb_base; } else - return (size_t) (totbits * __mp_bases[base].chars_per_bit_exactly) + 1; + return (size_t) (totbits * mp_bases[base].chars_per_bit_exactly) + 1; } diff --git a/contrib/gmp/mpn/generic/sqr.c b/contrib/gmp/mpn/generic/sqr.c new file mode 100644 index 0000000000..504dbfb2d6 --- /dev/null +++ b/contrib/gmp/mpn/generic/sqr.c @@ -0,0 +1,88 @@ +/* mpn_sqr -- square natural numbers. + +Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +2005, 2008, 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +void +mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n) +{ + ASSERT (n >= 1); + ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n)); + + if (BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD)) + { /* mul_basecase is faster than sqr_basecase on small sizes sometimes */ + mpn_mul_basecase (p, a, n, a, n); + } + else if (BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) + { + mpn_sqr_basecase (p, a, n); + } + else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) + { + /* Allocate workspace of fixed size on stack: fast! */ + mp_limb_t ws[mpn_toom2_sqr_itch (SQR_TOOM3_THRESHOLD_LIMIT-1)]; + ASSERT (SQR_TOOM3_THRESHOLD <= SQR_TOOM3_THRESHOLD_LIMIT); + mpn_toom2_sqr (p, a, n, ws); + } + else if (BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD)) + { + mp_ptr ws; + TMP_SDECL; + TMP_SMARK; + ws = TMP_SALLOC_LIMBS (mpn_toom3_sqr_itch (n)); + mpn_toom3_sqr (p, a, n, ws); + TMP_SFREE; + } + else if (BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD)) + { + mp_ptr ws; + TMP_SDECL; + TMP_SMARK; + ws = TMP_SALLOC_LIMBS (mpn_toom4_sqr_itch (n)); + mpn_toom4_sqr (p, a, n, ws); + TMP_SFREE; + } + else if (BELOW_THRESHOLD (n, SQR_TOOM8_THRESHOLD)) + { + mp_ptr ws; + TMP_SDECL; + TMP_SMARK; + ws = TMP_SALLOC_LIMBS (mpn_toom6_sqr_itch (n)); + mpn_toom6_sqr (p, a, n, ws); + TMP_SFREE; + } + else if (BELOW_THRESHOLD (n, SQR_FFT_THRESHOLD)) + { + mp_ptr ws; + TMP_DECL; + TMP_MARK; + ws = TMP_ALLOC_LIMBS (mpn_toom8_sqr_itch (n)); + mpn_toom8_sqr (p, a, n, ws); + TMP_FREE; + } + else + { + /* The current FFT code allocates its own space. That should probably + change. */ + mpn_fft_mul (p, a, n, a, n); + } +} diff --git a/contrib/gmp/mpn/generic/sqr_basecase.c b/contrib/gmp/mpn/generic/sqr_basecase.c index 56d22216f6..548033d27b 100644 --- a/contrib/gmp/mpn/generic/sqr_basecase.c +++ b/contrib/gmp/mpn/generic/sqr_basecase.c @@ -54,12 +54,12 @@ void mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n) { mp_size_t i; - mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD]; + mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD]; mp_ptr tp = tarr; mp_limb_t cy; /* must fit 2*n limbs in tarr */ - ASSERT (n <= SQR_KARATSUBA_THRESHOLD); + ASSERT (n <= SQR_TOOM2_THRESHOLD); if ((n & 1) != 0) { @@ -136,12 +136,12 @@ void mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n) { mp_size_t i; - mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD]; + mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD]; mp_ptr tp = tarr; mp_limb_t cy; /* must fit 2*n limbs in tarr */ - ASSERT (n <= SQR_KARATSUBA_THRESHOLD); + ASSERT (n <= SQR_TOOM2_THRESHOLD); if ((n & 1) != 0) { @@ -268,12 +268,12 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n) } if (n > 1) { - mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD]; + mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD]; mp_ptr tp = tarr; mp_limb_t cy; /* must fit 2*n limbs in tarr */ - ASSERT (n <= SQR_KARATSUBA_THRESHOLD); + ASSERT (n <= SQR_TOOM2_THRESHOLD); cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]); tp[n - 1] = cy; diff --git a/contrib/gmp/mpn/generic/sqrmod_bnm1.c b/contrib/gmp/mpn/generic/sqrmod_bnm1.c new file mode 100644 index 0000000000..698bd6833a --- /dev/null +++ b/contrib/gmp/mpn/generic/sqrmod_bnm1.c @@ -0,0 +1,302 @@ +/* sqrmod_bnm1.c -- squaring mod B^n-1. + + Contributed to the GNU project by Niels Möller, Torbjorn Granlund and + Marco Bodrato. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" +#include "longlong.h" + +/* Input is {ap,rn}; output is {rp,rn}, computation is + mod B^rn - 1, and values are semi-normalised; zero is represented + as either 0 or B^n - 1. Needs a scratch of 2rn limbs at tp. + tp==rp is allowed. */ +static void +mpn_bc_sqrmod_bnm1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn, mp_ptr tp) +{ + mp_limb_t cy; + + ASSERT (0 < rn); + + mpn_sqr (tp, ap, rn); + cy = mpn_add_n (rp, tp, tp + rn, rn); + /* If cy == 1, then the value of rp is at most B^rn - 2, so there can + * be no overflow when adding in the carry. */ + MPN_INCR_U (rp, rn, cy); +} + + +/* Input is {ap,rn+1}; output is {rp,rn+1}, in + semi-normalised representation, computation is mod B^rn + 1. Needs + a scratch area of 2rn + 2 limbs at tp; tp == rp is allowed. + Output is normalised. */ +static void +mpn_bc_sqrmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn, mp_ptr tp) +{ + mp_limb_t cy; + + ASSERT (0 < rn); + + mpn_sqr (tp, ap, rn + 1); + ASSERT (tp[2*rn+1] == 0); + ASSERT (tp[2*rn] < GMP_NUMB_MAX); + cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn); + rp[rn] = 0; + MPN_INCR_U (rp, rn+1, cy ); +} + + +/* Computes {rp,MIN(rn,2an)} <- {ap,an}^2 Mod(B^rn-1) + * + * The result is expected to be ZERO if and only if the operand + * already is. Otherwise the class [0] Mod(B^rn-1) is represented by + * B^rn-1. + * It should not be a problem if sqrmod_bnm1 is used to + * compute the full square with an <= 2*rn, because this condition + * implies (B^an-1)^2 < (B^rn-1) . + * + * Requires rn/4 < an <= rn + * Scratch need: rn/2 + (need for recursive call OR rn + 3). This gives + * + * S(n) <= rn/2 + MAX (rn + 4, S(n/2)) <= 3/2 rn + 4 + */ +void +mpn_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_ptr tp) +{ + ASSERT (0 < an); + ASSERT (an <= rn); + + if ((rn & 1) != 0 || BELOW_THRESHOLD (rn, SQRMOD_BNM1_THRESHOLD)) + { + if (UNLIKELY (an < rn)) + { + if (UNLIKELY (2*an <= rn)) + { + mpn_sqr (rp, ap, an); + } + else + { + mp_limb_t cy; + mpn_sqr (tp, ap, an); + cy = mpn_add (rp, tp, rn, tp + rn, 2*an - rn); + MPN_INCR_U (rp, rn, cy); + } + } + else + mpn_bc_sqrmod_bnm1 (rp, ap, rn, tp); + } + else + { + mp_size_t n; + mp_limb_t cy; + mp_limb_t hi; + + n = rn >> 1; + + ASSERT (2*an > n); + + /* Compute xm = a^2 mod (B^n - 1), xp = a^2 mod (B^n + 1) + and crt together as + + x = -xp * B^n + (B^n + 1) * [ (xp + xm)/2 mod (B^n-1)] + */ + +#define a0 ap +#define a1 (ap + n) + +#define xp tp /* 2n + 2 */ + /* am1 maybe in {xp, n} */ +#define sp1 (tp + 2*n + 2) + /* ap1 maybe in {sp1, n + 1} */ + + { + mp_srcptr am1; + mp_size_t anm; + mp_ptr so; + + if (LIKELY (an > n)) + { + so = xp + n; + am1 = xp; + cy = mpn_add (xp, a0, n, a1, an - n); + MPN_INCR_U (xp, n, cy); + anm = n; + } + else + { + so = xp; + am1 = a0; + anm = an; + } + + mpn_sqrmod_bnm1 (rp, n, am1, anm, so); + } + + { + int k; + mp_srcptr ap1; + mp_size_t anp; + + if (LIKELY (an > n)) { + ap1 = sp1; + cy = mpn_sub (sp1, a0, n, a1, an - n); + sp1[n] = 0; + MPN_INCR_U (sp1, n + 1, cy); + anp = n + ap1[n]; + } else { + ap1 = a0; + anp = an; + } + + if (BELOW_THRESHOLD (n, MUL_FFT_MODF_THRESHOLD)) + k=0; + else + { + int mask; + k = mpn_fft_best_k (n, 1); + mask = (1<>=1;}; + } + if (k >= FFT_FIRST_K) + xp[n] = mpn_mul_fft (xp, n, ap1, anp, ap1, anp, k); + else if (UNLIKELY (ap1 == a0)) + { + ASSERT (anp <= n); + ASSERT (2*anp > n); + mpn_sqr (xp, a0, an); + anp = 2*an - n; + cy = mpn_sub (xp, xp, n, xp + n, anp); + xp[n] = 0; + MPN_INCR_U (xp, n+1, cy); + } + else + mpn_bc_sqrmod_bnp1 (xp, ap1, n, xp); + } + + /* Here the CRT recomposition begins. + + xm <- (xp + xm)/2 = (xp + xm)B^n/2 mod (B^n-1) + Division by 2 is a bitwise rotation. + + Assumes xp normalised mod (B^n+1). + + The residue class [0] is represented by [B^n-1]; except when + both input are ZERO. + */ + +#if HAVE_NATIVE_mpn_rsh1add_n || HAVE_NATIVE_mpn_rsh1add_nc +#if HAVE_NATIVE_mpn_rsh1add_nc + cy = mpn_rsh1add_nc(rp, rp, xp, n, xp[n]); /* B^n = 1 */ + hi = cy << (GMP_NUMB_BITS - 1); + cy = 0; + /* next update of rp[n-1] will set cy = 1 only if rp[n-1]+=hi + overflows, i.e. a further increment will not overflow again. */ +#else /* ! _nc */ + cy = xp[n] + mpn_rsh1add_n(rp, rp, xp, n); /* B^n = 1 */ + hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */ + cy >>= 1; + /* cy = 1 only if xp[n] = 1 i.e. {xp,n} = ZERO, this implies that + the rsh1add was a simple rshift: the top bit is 0. cy=1 => hi=0. */ +#endif +#if GMP_NAIL_BITS == 0 + add_ssaaaa(cy, rp[n-1], cy, rp[n-1], 0, hi); +#else + cy += (hi & rp[n-1]) >> (GMP_NUMB_BITS-1); + rp[n-1] ^= hi; +#endif +#else /* ! HAVE_NATIVE_mpn_rsh1add_n */ +#if HAVE_NATIVE_mpn_add_nc + cy = mpn_add_nc(rp, rp, xp, n, xp[n]); +#else /* ! _nc */ + cy = xp[n] + mpn_add_n(rp, rp, xp, n); /* xp[n] == 1 implies {xp,n} == ZERO */ +#endif + cy += (rp[0]&1); + mpn_rshift(rp, rp, n, 1); + ASSERT (cy <= 2); + hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */ + cy >>= 1; + /* We can have cy != 0 only if hi = 0... */ + ASSERT ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0); + rp[n-1] |= hi; + /* ... rp[n-1] + cy can not overflow, the following INCR is correct. */ +#endif + ASSERT (cy <= 1); + /* Next increment can not overflow, read the previous comments about cy. */ + ASSERT ((cy == 0) || ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0)); + MPN_INCR_U(rp, n, cy); + + /* Compute the highest half: + ([(xp + xm)/2 mod (B^n-1)] - xp ) * B^n + */ + if (UNLIKELY (2*an < rn)) + { + /* Note that in this case, the only way the result can equal + zero mod B^{rn} - 1 is if the input is zero, and + then the output of both the recursive calls and this CRT + reconstruction is zero, not B^{rn} - 1. */ + cy = mpn_sub_n (rp + n, rp, xp, 2*an - n); + + /* FIXME: This subtraction of the high parts is not really + necessary, we do it to get the carry out, and for sanity + checking. */ + cy = xp[n] + mpn_sub_nc (xp + 2*an - n, rp + 2*an - n, + xp + 2*an - n, rn - 2*an, cy); + ASSERT (mpn_zero_p (xp + 2*an - n+1, rn - 1 - 2*an)); + cy = mpn_sub_1 (rp, rp, 2*an, cy); + ASSERT (cy == (xp + 2*an - n)[0]); + } + else + { + cy = xp[n] + mpn_sub_n (rp + n, rp, xp, n); + /* cy = 1 only if {xp,n+1} is not ZERO, i.e. {rp,n} is not ZERO. + DECR will affect _at most_ the lowest n limbs. */ + MPN_DECR_U (rp, 2*n, cy); + } +#undef a0 +#undef a1 +#undef xp +#undef sp1 + } +} + +mp_size_t +mpn_sqrmod_bnm1_next_size (mp_size_t n) +{ + mp_size_t nh; + + if (BELOW_THRESHOLD (n, SQRMOD_BNM1_THRESHOLD)) + return n; + if (BELOW_THRESHOLD (n, 4 * (SQRMOD_BNM1_THRESHOLD - 1) + 1)) + return (n + (2-1)) & (-2); + if (BELOW_THRESHOLD (n, 8 * (SQRMOD_BNM1_THRESHOLD - 1) + 1)) + return (n + (4-1)) & (-4); + + nh = (n + 1) >> 1; + + if (BELOW_THRESHOLD (nh, SQR_FFT_MODF_THRESHOLD)) + return (n + (8-1)) & (-8); + + return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 1)); +} diff --git a/contrib/gmp/mpn/generic/sqrtrem.c b/contrib/gmp/mpn/generic/sqrtrem.c index ac878c5083..a609a4bef5 100644 --- a/contrib/gmp/mpn/generic/sqrtrem.c +++ b/contrib/gmp/mpn/generic/sqrtrem.c @@ -8,8 +8,8 @@ INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE. -Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2008 Free Software Foundation, -Inc. +Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2008, 2010 Free Software +Foundation, Inc. This file is part of the GNU MP Library. @@ -92,9 +92,9 @@ static const unsigned short invsqrttab[384] = /* Compute s = floor(sqrt(a0)), and *rp = a0 - s^2. */ #if GMP_NUMB_BITS > 32 -#define MAGIC 0x10000000000 /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */ +#define MAGIC CNST_LIMB(0x10000000000) /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */ #else -#define MAGIC 0x100000 /* 0xfee6f < MAGIC < 0x29cbc8 */ +#define MAGIC CNST_LIMB(0x100000) /* 0xfee6f < MAGIC < 0x29cbc8 */ #endif static mp_limb_t @@ -121,7 +121,7 @@ mpn_sqrtrem1 (mp_ptr rp, mp_limb_t a0) #if GMP_NUMB_BITS > 32 a1 = a0 >> (GMP_LIMB_BITS - 1 - 32); - t = (mp_limb_signed_t) (0x2000000000000l - 0x30000 - a1 * x0 * x0) >> 16; + t = (mp_limb_signed_t) (CNST_LIMB(0x2000000000000) - 0x30000 - a1 * x0 * x0) >> 16; x0 = (x0 << 16) + ((mp_limb_signed_t) (x0 * t) >> (16+2)); /* x0 is now an 16 bits approximation of 1/sqrt(a0) */ @@ -239,7 +239,7 @@ mpn_dc_sqrtrem (mp_ptr sp, mp_ptr np, mp_size_t n) q >>= 1; if (c != 0) c = mpn_add_n (np + l, np + l, sp + l, h); - mpn_sqr_n (np + n, sp, l); + mpn_sqr (np + n, sp, l); b = q + mpn_sub_n (np, np, np + n, 2 * l); c -= (l == h) ? b : mpn_sub_1 (np + 2 * l, np + 2 * l, 1, (mp_limb_t) b); q = mpn_add_1 (sp + l, sp + l, h, q); diff --git a/contrib/gmp/mpn/generic/sub_n.c b/contrib/gmp/mpn/generic/sub_n.c index d33668fa86..3c2ed57f90 100644 --- a/contrib/gmp/mpn/generic/sub_n.c +++ b/contrib/gmp/mpn/generic/sub_n.c @@ -1,6 +1,7 @@ /* mpn_sub_n -- Subtract equal length limb vectors. -Copyright 1992, 1993, 1994, 1996, 2000, 2002 Free Software Foundation, Inc. +Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2009 Free Software Foundation, +Inc. This file is part of the GNU MP Library. @@ -29,8 +30,8 @@ mpn_sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) mp_limb_t ul, vl, sl, rl, cy, cy1, cy2; ASSERT (n >= 1); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, up, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n)); cy = 0; do @@ -59,8 +60,8 @@ mpn_sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n) mp_limb_t ul, vl, rl, cy; ASSERT (n >= 1); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n)); - ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, up, n)); + ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n)); cy = 0; do diff --git a/contrib/gmp/mpn/generic/tdiv_qr.c b/contrib/gmp/mpn/generic/tdiv_qr.c index 8ac4d38813..62d28a0a7e 100644 --- a/contrib/gmp/mpn/generic/tdiv_qr.c +++ b/contrib/gmp/mpn/generic/tdiv_qr.c @@ -1,18 +1,17 @@ /* mpn_tdiv_qr -- Divide the numerator (np,nn) by the denominator (dp,dn) and write the nn-dn+1 quotient limbs at qp and the dn remainder limbs at rp. If qxn is non-zero, generate that many fraction limbs and append them after the - other quotient limbs, and update the remainder accordningly. The input + other quotient limbs, and update the remainder accordingly. The input operands are unaffected. Preconditions: 1. The most significant limb of of the divisor must be non-zero. - 2. No argument overlap is permitted. (??? relax this ???) - 3. nn >= dn, even if qxn is non-zero. (??? relax this ???) + 2. nn >= dn, even if qxn is non-zero. (??? relax this ???) The time complexity of this is O(qn*qn+M(dn,qn)), where M(m,n) is the time complexity of multiplication. -Copyright 1997, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. +Copyright 1997, 2000, 2001, 2002, 2005, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -38,13 +37,8 @@ void mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn) { - /* FIXME: - 1. qxn - 2. pass allocated storage in additional parameter? - */ ASSERT_ALWAYS (qxn == 0); - ASSERT (qxn >= 0); ASSERT (nn >= 0); ASSERT (dn >= 0); ASSERT (dn == 0 || dp[dn - 1] != 0); @@ -58,7 +52,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, case 1: { - rp[0] = mpn_divmod_1 (qp, np, nn, dp[0]); + rp[0] = mpn_divrem_1 (qp, (mp_size_t) 0, np, nn, dp[0]); return; } @@ -77,7 +71,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, d2p = dtmp; d2p[1] = (dp[1] << cnt) | (dp[0] >> (GMP_NUMB_BITS - cnt)); d2p[0] = (dp[0] << cnt) & GMP_NUMB_MASK; - n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (nn + 1); cy = mpn_lshift (n2p, np, nn, cnt); n2p[nn] = cy; qhl = mpn_divrem_2 (qp, 0L, n2p, nn + (cy != 0), d2p); @@ -90,7 +84,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, else { d2p = (mp_ptr) dp; - n2p = (mp_ptr) TMP_ALLOC (nn * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (nn); MPN_COPY (n2p, np, nn); qhl = mpn_divrem_2 (qp, 0L, n2p, nn, d2p); qp[nn - 2] = qhl; /* always store nn-2+1 quotient limbs */ @@ -104,12 +98,13 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, default: { int adjust; + gmp_pi1_t dinv; TMP_DECL; TMP_MARK; adjust = np[nn - 1] >= dp[dn - 1]; /* conservative tests for quotient size */ if (nn + adjust >= 2 * dn) { - mp_ptr n2p, d2p, q2p; + mp_ptr n2p, d2p; mp_limb_t cy; int cnt; @@ -118,9 +113,9 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, { count_leading_zeros (cnt, dp[dn - 1]); cnt -= GMP_NAIL_BITS; - d2p = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB); + d2p = TMP_ALLOC_LIMBS (dn); mpn_lshift (d2p, dp, dn, cnt); - n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (nn + 1); cy = mpn_lshift (n2p, np, nn, cnt); n2p[nn] = cy; nn += adjust; @@ -129,51 +124,28 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, { cnt = 0; d2p = (mp_ptr) dp; - n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (nn + 1); MPN_COPY (n2p, np, nn); n2p[nn] = 0; nn += adjust; } - if (dn < DIV_DC_THRESHOLD) - mpn_sb_divrem_mn (qp, n2p, nn, d2p, dn); + invert_pi1 (dinv, d2p[dn - 1], d2p[dn - 2]); + if (BELOW_THRESHOLD (dn, DC_DIV_QR_THRESHOLD)) + mpn_sbpi1_div_qr (qp, n2p, nn, d2p, dn, dinv.inv32); + else if (BELOW_THRESHOLD (dn, MUPI_DIV_QR_THRESHOLD) || /* fast condition */ + BELOW_THRESHOLD (nn, 2 * MU_DIV_QR_THRESHOLD) || /* fast condition */ + (double) (2 * (MU_DIV_QR_THRESHOLD - MUPI_DIV_QR_THRESHOLD)) * dn /* slow... */ + + (double) MUPI_DIV_QR_THRESHOLD * nn > (double) dn * nn) /* ...condition */ + mpn_dcpi1_div_qr (qp, n2p, nn, d2p, dn, &dinv); else { - /* Divide 2*dn / dn limbs as long as the limbs in np last. */ - q2p = qp + nn - dn; - n2p += nn - dn; - do - { - q2p -= dn; n2p -= dn; - mpn_dc_divrem_n (q2p, n2p, d2p, dn); - nn -= dn; - } - while (nn >= 2 * dn); - - if (nn != dn) - { - mp_limb_t ql; - n2p -= nn - dn; - - /* We have now dn < nn - dn < 2dn. Make a recursive call, - since falling out to the code below isn't pretty. - Unfortunately, mpn_tdiv_qr returns nn-dn+1 quotient - limbs, which would overwrite one already generated - quotient limbs. Preserve it with an ugly hack. */ - /* FIXME: This suggests that we should have an - mpn_tdiv_qr_internal that instead returns the most - significant quotient limb and move the meat of this - function there. */ - /* FIXME: Perhaps call mpn_sb_divrem_mn here for certain - operand ranges, to decrease overhead for small - operands? */ - ql = qp[nn - dn]; /* preserve quotient limb... */ - mpn_tdiv_qr (qp, n2p, 0L, n2p, nn, d2p, dn); - qp[nn - dn] = ql; /* ...restore it again */ - } + mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + mpn_mu_div_qr (qp, rp, n2p, nn, d2p, dn, scratch); + n2p = rp; } - if (cnt != 0) mpn_rshift (rp, n2p, dn, cnt); else @@ -246,11 +218,11 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, count_leading_zeros (cnt, dp[dn - 1]); cnt -= GMP_NAIL_BITS; - d2p = (mp_ptr) TMP_ALLOC (qn * BYTES_PER_MP_LIMB); + d2p = TMP_ALLOC_LIMBS (qn); mpn_lshift (d2p, dp + in, qn, cnt); d2p[0] |= dp[in - 1] >> (GMP_NUMB_BITS - cnt); - n2p = (mp_ptr) TMP_ALLOC ((2 * qn + 1) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (2 * qn + 1); cy = mpn_lshift (n2p, np + nn - 2 * qn, 2 * qn, cnt); if (adjust) { @@ -267,7 +239,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, cnt = 0; d2p = (mp_ptr) dp + in; - n2p = (mp_ptr) TMP_ALLOC ((2 * qn + 1) * BYTES_PER_MP_LIMB); + n2p = TMP_ALLOC_LIMBS (2 * qn + 1); MPN_COPY (n2p, np + nn - 2 * qn, 2 * qn); if (adjust) { @@ -280,25 +252,30 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, if (qn == 1) { mp_limb_t q0, r0; - mp_limb_t gcc272bug_n1, gcc272bug_n0, gcc272bug_d0; - /* Due to a gcc 2.7.2.3 reload pass bug, we have to use some - temps here. This doesn't hurt code quality on any machines - so we do it unconditionally. */ - gcc272bug_n1 = n2p[1]; - gcc272bug_n0 = n2p[0]; - gcc272bug_d0 = d2p[0]; - udiv_qrnnd (q0, r0, gcc272bug_n1, gcc272bug_n0 << GMP_NAIL_BITS, - gcc272bug_d0 << GMP_NAIL_BITS); - r0 >>= GMP_NAIL_BITS; - n2p[0] = r0; + udiv_qrnnd (q0, r0, n2p[1], n2p[0] << GMP_NAIL_BITS, d2p[0] << GMP_NAIL_BITS); + n2p[0] = r0 >> GMP_NAIL_BITS; qp[0] = q0; } else if (qn == 2) - mpn_divrem_2 (qp, 0L, n2p, 4L, d2p); - else if (qn < DIV_DC_THRESHOLD) - mpn_sb_divrem_mn (qp, n2p, 2 * qn, d2p, qn); + mpn_divrem_2 (qp, 0L, n2p, 4L, d2p); /* FIXME: obsolete function */ else - mpn_dc_divrem_n (qp, n2p, d2p, qn); + { + invert_pi1 (dinv, d2p[qn - 1], d2p[qn - 2]); + if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD)) + mpn_sbpi1_div_qr (qp, n2p, 2 * qn, d2p, qn, dinv.inv32); + else if (BELOW_THRESHOLD (qn, MU_DIV_QR_THRESHOLD)) + mpn_dcpi1_div_qr (qp, n2p, 2 * qn, d2p, qn, &dinv); + else + { + mp_size_t itch = mpn_mu_div_qr_itch (2 * qn, qn, 0); + mp_ptr scratch = TMP_ALLOC_LIMBS (itch); + mp_ptr r2p = rp; + if (np == r2p) /* If N and R share space, put ... */ + r2p += nn - qn; /* intermediate remainder at N's upper end. */ + mpn_mu_div_qr (qp, r2p, n2p, 2 * qn, d2p, qn, scratch); + MPN_COPY (n2p, r2p, qn); + } + } rn = qn; /* Multiply the first ignored divisor limb by the most significant @@ -316,7 +293,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, dl = dp[in - 2]; #if GMP_NAIL_BITS == 0 - x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % BITS_PER_MP_LIMB)); + x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % GMP_LIMB_BITS)); #else x = (dp[in - 1] << cnt) & GMP_NUMB_MASK; if (cnt != 0) @@ -366,7 +343,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, } /* True: partial remainder now is neutral, i.e., it is not shifted up. */ - tp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (dn); if (in < qn) { diff --git a/contrib/gmp/mpn/generic/toom22_mul.c b/contrib/gmp/mpn/generic/toom22_mul.c index 6407bbeb96..fc296df93e 100644 --- a/contrib/gmp/mpn/generic/toom22_mul.c +++ b/contrib/gmp/mpn/generic/toom22_mul.c @@ -7,7 +7,7 @@ SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -51,12 +51,29 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define TOOM22_MUL_N_REC(p, a, b, n, ws) \ do { \ if (! MAYBE_mul_toom22 \ - || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ + || BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \ mpn_mul_basecase (p, a, n, b, n); \ else \ mpn_toom22_mul (p, a, n, b, n, ws); \ } while (0) +/* Normally, this calls mul_basecase or toom22_mul. But when when the fraction + MUL_TOOM33_THRESHOLD / MUL_TOOM22_THRESHOLD is large, an initially small + relative unbalance will become a larger and larger relative unbalance with + each recursion (the difference s-t will be invariant over recursive calls). + Therefore, we need to call toom32_mul. FIXME: Suppress depending on + MUL_TOOM33_THRESHOLD / MUL_TOOM22_THRESHOLD and on MUL_TOOM22_THRESHOLD. */ +#define TOOM22_MUL_REC(p, a, an, b, bn, ws) \ + do { \ + if (! MAYBE_mul_toom22 \ + || BELOW_THRESHOLD (bn, MUL_TOOM22_THRESHOLD)) \ + mpn_mul_basecase (p, a, an, b, bn); \ + else if (4 * an < 5 * bn) \ + mpn_toom22_mul (p, a, an, b, bn, ws); \ + else \ + mpn_toom32_mul (p, a, an, b, bn, ws); \ + } while (0) + void mpn_toom22_mul (mp_ptr pp, mp_srcptr ap, mp_size_t an, @@ -150,8 +167,8 @@ mpn_toom22_mul (mp_ptr pp, /* vm1, 2n limbs */ TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out); - /* vinf, s+t limbs */ - mpn_mul (vinf, a1, s, b1, t); + if (s > t) TOOM22_MUL_REC (vinf, a1, s, b1, t, scratch_out); + else TOOM22_MUL_N_REC (vinf, a1, b1, s, scratch_out); /* v0, 2n limbs */ TOOM22_MUL_N_REC (v0, ap, bp, n, scratch_out); diff --git a/contrib/gmp/mpn/generic/toom2_sqr.c b/contrib/gmp/mpn/generic/toom2_sqr.c index 445cff8f5d..912feda8ae 100644 --- a/contrib/gmp/mpn/generic/toom2_sqr.c +++ b/contrib/gmp/mpn/generic/toom2_sqr.c @@ -6,7 +6,7 @@ SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -32,12 +32,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ <-s--><--n--> ____ ______ |_a1_|___a0_| - |b1_|___b0_| - <-t-><--n--> - v0 = a0 * b0 # A(0)*B(0) - vm1 = (a0- a1)*(b0- b1) # A(-1)*B(-1) - vinf= a1 * b1 # A(inf)*B(inf) + v0 = a0 ^2 # A(0)^2 + vm1 = (a0- a1)^2 # A(-1)^2 + vinf= a1 ^2 # A(inf)^2 */ #if TUNE_PROGRAM_BUILD @@ -47,10 +45,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ (SQR_TOOM3_THRESHOLD >= 2 * SQR_TOOM2_THRESHOLD) #endif -#define TOOM2_SQR_N_REC(p, a, n, ws) \ +#define TOOM2_SQR_REC(p, a, n, ws) \ do { \ if (! MAYBE_sqr_toom2 \ - || BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \ + || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \ mpn_sqr_basecase (p, a, n); \ else \ mpn_toom2_sqr (p, a, n, ws); \ @@ -103,15 +101,16 @@ mpn_toom2_sqr (mp_ptr pp, #define v0 pp /* 2n */ #define vinf (pp + 2 * n) /* s+s */ #define vm1 scratch /* 2n */ +#define scratch_out scratch + 2 * n /* vm1, 2n limbs */ - TOOM2_SQR_N_REC (vm1, asm1, n, scratch); + TOOM2_SQR_REC (vm1, asm1, n, scratch_out); /* vinf, s+s limbs */ - TOOM2_SQR_N_REC (vinf, a1, s, scratch); + TOOM2_SQR_REC (vinf, a1, s, scratch_out); /* v0, 2n limbs */ - TOOM2_SQR_N_REC (v0, ap, n, scratch); + TOOM2_SQR_REC (v0, ap, n, scratch_out); /* H(v0) + L(vinf) */ cy = mpn_add_n (pp + 2 * n, v0 + n, vinf, n); diff --git a/contrib/gmp/mpn/generic/toom32_mul.c b/contrib/gmp/mpn/generic/toom32_mul.c index 7bdd688a53..2f61fad2df 100644 --- a/contrib/gmp/mpn/generic/toom32_mul.c +++ b/contrib/gmp/mpn/generic/toom32_mul.c @@ -2,6 +2,7 @@ times as large as bn. Or more accurately, bn < an < 3bn. Contributed to the GNU project by Torbjorn Granlund. + Improvements by Marco Bodrato and Niels Möller. The idea of applying toom to unbalanced multiplication is due to Marco Bodrato and Alberto Zanoni. @@ -10,7 +11,7 @@ SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -28,15 +29,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch allocation. - - 2. Apply optimizations also to mul_toom42.c. -*/ - #include "gmp.h" #include "gmp-impl.h" @@ -54,20 +46,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ vinf= a2 * b1 # A(inf)*B(inf) */ -#if TUNE_PROGRAM_BUILD -#define MAYBE_mul_toom22 1 -#else -#define MAYBE_mul_toom22 \ - (MUL_TOOM33_THRESHOLD >= 2 * MUL_TOOM22_THRESHOLD) -#endif - -#define TOOM22_MUL_N_REC(p, a, b, n, ws) \ +#define TOOM32_MUL_N_REC(p, a, b, n, ws) \ do { \ - if (! MAYBE_mul_toom22 \ - || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ - mpn_mul_basecase (p, a, n, b, n); \ - else \ - mpn_toom22_mul (p, a, n, b, n, ws); \ + mpn_mul_n (p, a, b, n); \ } while (0) void @@ -78,15 +59,9 @@ mpn_toom32_mul (mp_ptr pp, { mp_size_t n, s, t; int vm1_neg; -#if HAVE_NATIVE_mpn_add_nc mp_limb_t cy; -#else - mp_limb_t cy, cy2; -#endif - mp_ptr a0_a2; - mp_ptr as1, asm1; - mp_ptr bs1, bsm1; - TMP_DECL; + int hi; + mp_limb_t ap1_hi, bp1_hi; #define a0 ap #define a1 (ap + n) @@ -94,6 +69,9 @@ mpn_toom32_mul (mp_ptr pp, #define b0 bp #define b1 (bp + n) + /* Required, to ensure that s + t >= n. */ + ASSERT (bn + 2 <= an && an + 6 <= 3*bn); + n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1); s = an - 2 * n; @@ -101,191 +79,234 @@ mpn_toom32_mul (mp_ptr pp, ASSERT (0 < s && s <= n); ASSERT (0 < t && t <= n); + ASSERT (s + t >= n); - TMP_MARK; - - as1 = TMP_SALLOC_LIMBS (n + 1); - asm1 = TMP_SALLOC_LIMBS (n + 1); + /* Product area of size an + bn = 3*n + s + t >= 4*n + 2. */ +#define ap1 (pp) /* n, most significant limb in ap1_hi */ +#define bp1 (pp + n) /* n, most significant bit in bp1_hi */ +#define am1 (pp + 2*n) /* n, most significant bit in hi */ +#define bm1 (pp + 3*n) /* n */ +#define v1 (scratch) /* 2n + 1 */ +#define vm1 (pp) /* 2n + 1 */ +#define scratch_out (scratch + 2*n + 1) /* Currently unused. */ - bs1 = TMP_SALLOC_LIMBS (n + 1); - bsm1 = TMP_SALLOC_LIMBS (n); + /* Scratch need: 2*n + 1 + scratch for the recursive multiplications. */ - a0_a2 = pp; + /* FIXME: Keep v1[2*n] and vm1[2*n] in scalar variables? */ - /* Compute as1 and asm1. */ - a0_a2[n] = mpn_add (a0_a2, a0, n, a2, s); -#if HAVE_NATIVE_mpn_addsub_n - if (a0_a2[n] == 0 && mpn_cmp (a0_a2, a1, n) < 0) + /* Compute ap1 = a0 + a1 + a3, am1 = a0 - a1 + a3 */ + ap1_hi = mpn_add (ap1, a0, n, a2, s); +#if HAVE_NATIVE_mpn_add_n_sub_n + if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0) { - cy = mpn_addsub_n (as1, asm1, a1, a0_a2, n); - as1[n] = cy >> 1; - asm1[n] = 0; + ap1_hi = mpn_add_n_sub_n (ap1, am1, a1, ap1, n) >> 1; + hi = 0; vm1_neg = 1; } else { - cy = mpn_addsub_n (as1, asm1, a0_a2, a1, n); - as1[n] = a0_a2[n] + (cy >> 1); - asm1[n] = a0_a2[n] - (cy & 1); + cy = mpn_add_n_sub_n (ap1, am1, ap1, a1, n); + hi = ap1_hi - (cy & 1); + ap1_hi += (cy >> 1); vm1_neg = 0; } #else - as1[n] = a0_a2[n] + mpn_add_n (as1, a0_a2, a1, n); - if (a0_a2[n] == 0 && mpn_cmp (a0_a2, a1, n) < 0) + if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0) { - mpn_sub_n (asm1, a1, a0_a2, n); - asm1[n] = 0; + ASSERT_NOCARRY (mpn_sub_n (am1, a1, ap1, n)); + hi = 0; vm1_neg = 1; } else { - cy = mpn_sub_n (asm1, a0_a2, a1, n); - asm1[n] = a0_a2[n] - cy; + hi = ap1_hi - mpn_sub_n (am1, ap1, a1, n); vm1_neg = 0; } + ap1_hi += mpn_add_n (ap1, ap1, a1, n); #endif - /* Compute bs1 and bsm1. */ + /* Compute bp1 = b0 + b1 and bm1 = b0 - b1. */ if (t == n) { -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (mpn_cmp (b0, b1, n) < 0) { - cy = mpn_addsub_n (bs1, bsm1, b1, b0, n); + cy = mpn_add_n_sub_n (bp1, bm1, b1, b0, n); vm1_neg ^= 1; } else { - cy = mpn_addsub_n (bs1, bsm1, b0, b1, n); + cy = mpn_add_n_sub_n (bp1, bm1, b0, b1, n); } - bs1[n] = cy >> 1; + bp1_hi = cy >> 1; #else - bs1[n] = mpn_add_n (bs1, b0, b1, n); + bp1_hi = mpn_add_n (bp1, b0, b1, n); if (mpn_cmp (b0, b1, n) < 0) { - mpn_sub_n (bsm1, b1, b0, n); + ASSERT_NOCARRY (mpn_sub_n (bm1, b1, b0, n)); vm1_neg ^= 1; } else { - mpn_sub_n (bsm1, b0, b1, n); + ASSERT_NOCARRY (mpn_sub_n (bm1, b0, b1, n)); } #endif } else { - bs1[n] = mpn_add (bs1, b0, n, b1, t); + /* FIXME: Should still use mpn_add_n_sub_n for the main part. */ + bp1_hi = mpn_add (bp1, b0, n, b1, t); if (mpn_zero_p (b0 + t, n - t) && mpn_cmp (b0, b1, t) < 0) { - mpn_sub_n (bsm1, b1, b0, t); - MPN_ZERO (bsm1 + t, n - t); + ASSERT_NOCARRY (mpn_sub_n (bm1, b1, b0, t)); + MPN_ZERO (bm1 + t, n - t); vm1_neg ^= 1; } else { - mpn_sub (bsm1, b0, n, b1, t); + ASSERT_NOCARRY (mpn_sub (bm1, b0, n, b1, t)); } } - ASSERT (as1[n] <= 2); - ASSERT (bs1[n] <= 1); - ASSERT (asm1[n] <= 1); -/*ASSERT (bsm1[n] == 0); */ - -#define v0 pp /* 2n */ -#define v1 (scratch) /* 2n+1 */ -#define vinf (pp + 3 * n) /* s+t */ -#define vm1 (scratch + 2 * n + 1) /* 2n+1 */ -#define scratch_out scratch + 4 * n + 2 - - /* vm1, 2n+1 limbs */ - TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out); - cy = 0; - if (asm1[n] != 0) - cy = mpn_add_n (vm1 + n, vm1 + n, bsm1, n); - vm1[2 * n] = cy; - - /* vinf, s+t limbs */ - if (s > t) mpn_mul (vinf, a2, s, b1, t); - else mpn_mul (vinf, b1, t, a2, s); - - /* v1, 2n+1 limbs */ - TOOM22_MUL_N_REC (v1, as1, bs1, n, scratch_out); - if (as1[n] == 1) + TOOM32_MUL_N_REC (v1, ap1, bp1, n, scratch_out); + if (ap1_hi == 1) { - cy = bs1[n] + mpn_add_n (v1 + n, v1 + n, bs1, n); + cy = bp1_hi + mpn_add_n (v1 + n, v1 + n, bp1, n); } - else if (as1[n] == 2) + else if (ap1_hi == 2) { #if HAVE_NATIVE_mpn_addlsh1_n - cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n); + cy = 2 * bp1_hi + mpn_addlsh1_n (v1 + n, v1 + n, bp1, n); #else - cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2)); + cy = 2 * bp1_hi + mpn_addmul_1 (v1 + n, bp1, n, CNST_LIMB(2)); #endif } else cy = 0; - if (bs1[n] != 0) - cy += mpn_add_n (v1 + n, v1 + n, as1, n); + if (bp1_hi != 0) + cy += mpn_add_n (v1 + n, v1 + n, ap1, n); v1[2 * n] = cy; - mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */ + TOOM32_MUL_N_REC (vm1, am1, bm1, n, scratch_out); + if (hi) + hi = mpn_add_n (vm1+n, vm1+n, bm1, n); - /* Interpolate */ + vm1[2*n] = hi; + /* v1 <-- (v1 + vm1) / 2 = x0 + x2 */ if (vm1_neg) { -#if HAVE_NATIVE_mpn_rsh1add_n - mpn_rsh1add_n (vm1, v1, vm1, 2 * n + 1); +#if HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (v1, v1, vm1, 2*n+1); #else - mpn_add_n (vm1, v1, vm1, 2 * n + 1); - mpn_rshift (vm1, vm1, 2 * n + 1, 1); + mpn_sub_n (v1, v1, vm1, 2*n+1); + ASSERT_NOCARRY (mpn_rshift (v1, v1, 2*n+1, 1)); #endif } else { -#if HAVE_NATIVE_mpn_rsh1sub_n - mpn_rsh1sub_n (vm1, v1, vm1, 2 * n + 1); +#if HAVE_NATIVE_mpn_rsh1add_n + mpn_rsh1add_n (v1, v1, vm1, 2*n+1); #else - mpn_sub_n (vm1, v1, vm1, 2 * n + 1); - mpn_rshift (vm1, vm1, 2 * n + 1, 1); + mpn_add_n (v1, v1, vm1, 2*n+1); + ASSERT_NOCARRY (mpn_rshift (v1, v1, 2*n+1, 1)); #endif } - mpn_sub_n (v1, v1, vm1, 2 * n + 1); - v1[2 * n] -= mpn_sub_n (v1, v1, v0, 2 * n); + /* We get x1 + x3 = (x0 + x2) - (x0 - x1 + x2 - x3), and hence + + y = x1 + x3 + (x0 + x2) * B + = (x0 + x2) * B + (x0 + x2) - vm1. + + y is 3*n + 1 limbs, y = y0 + y1 B + y2 B^2. We store them as + follows: y0 at scratch, y1 at pp + 2*n, and y2 at scratch + n + (already in place, except for carry propagation). + + We thus add - /* - pp[] prior to operations: - |_H vinf|_L vinf|_______|_______|_______| + B^3 B^2 B 1 + | | | | + +-----+----+ + + | x0 + x2 | + +----+-----+----+ + + | x0 + x2 | + +----------+ + - | vm1 | + --+----++----+----+- + | y2 | y1 | y0 | + +-----+----+----+ - summation scheme for remaining operations: - |_______|_______|_______|_______|_______| - |_Hvinf_|_Lvinf_| |_H v0__|_L v0__| - | H vm1 | L vm1 | - |-H vinf|-L vinf| - | H v1 | L v1 | + Since we store y0 at the same location as the low half of x0 + x2, we + need to do the middle sum first. */ + + hi = vm1[2*n]; + cy = mpn_add_n (pp + 2*n, v1, v1 + n, n); + MPN_INCR_U (v1 + n, n + 1, cy + v1[2*n]); + + /* FIXME: Can we get rid of this second vm1_neg conditional by + swapping the location of +1 and -1 values? */ + if (vm1_neg) + { + cy = mpn_add_n (v1, v1, vm1, n); + hi += mpn_add_nc (pp + 2*n, pp + 2*n, vm1 + n, n, cy); + MPN_INCR_U (v1 + n, n+1, hi); + } + else + { + cy = mpn_sub_n (v1, v1, vm1, n); + hi += mpn_sub_nc (pp + 2*n, pp + 2*n, vm1 + n, n, cy); + MPN_DECR_U (v1 + n, n+1, hi); + } + + TOOM32_MUL_N_REC (pp, a0, b0, n, scratch_out); + /* vinf, s+t limbs. Use mpn_mul for now, to handle unbalanced operands */ + if (s > t) mpn_mul (pp+3*n, a2, s, b1, t); + else mpn_mul (pp+3*n, b1, t, a2, s); + + /* Remaining interpolation. + + y * B + x0 + x3 B^3 - x0 B^2 - x3 B + = (x1 + x3) B + (x0 + x2) B^2 + x0 + x3 B^3 - x0 B^2 - x3 B + = y0 B + y1 B^2 + y3 B^3 + Lx0 + H x0 B + + L x3 B^3 + H x3 B^4 - Lx0 B^2 - H x0 B^3 - L x3 B - H x3 B^2 + = L x0 + (y0 + H x0 - L x3) B + (y1 - L x0 - H x3) B^2 + + (y2 - (H x0 - L x3)) B^3 + H x3 B^4 + + B^4 B^3 B^2 B 1 + | | | | | | + +-------+ +---------+---------+ + | Hx3 | | Hx0-Lx3 | Lx0 | + +------+----------+---------+---------+---------+ + | y2 | y1 | y0 | + ++---------+---------+---------+ + -| Hx0-Lx3 | - Lx0 | + +---------+---------+ + | - Hx3 | + +--------+ + + We must take into account the carry from Hx0 - Lx3. */ - mpn_sub (vm1, vm1, 2 * n + 1, vinf, s + t); -#if HAVE_NATIVE_mpn_add_nc - cy = mpn_add_n (pp + n, pp + n, vm1, n); - cy = mpn_add_nc (pp + 2 * n, v1, vm1 + n, n, cy); - cy = mpn_add_nc (pp + 3 * n, pp + 3 * n, v1 + n, n, cy); - mpn_incr_u (pp + 3 * n, vm1[2 * n]); - if (LIKELY (n != s + t)) /* FIXME: Limit operand range to avoid condition */ - mpn_incr_u (pp + 4 * n, cy + v1[2 * n]); -#else - cy2 = mpn_add_n (pp + n, pp + n, vm1, n); - cy = mpn_add_n (pp + 2 * n, v1, vm1 + n, n); - mpn_incr_u (pp + 2 * n, cy2); - mpn_incr_u (pp + 3 * n, cy + vm1[2 * n]); - cy = mpn_add_n (pp + 3 * n, pp + 3 * n, v1 + n, n); - if (LIKELY (n != s + t)) /* FIXME: Limit operand range to avoid condition */ - mpn_incr_u (pp + 4 * n, cy + v1[2 * n]); -#endif + cy = mpn_sub_n (pp + n, pp + n, pp+3*n, n); + hi = scratch[2*n] + cy; + + cy = mpn_sub_nc (pp + 2*n, pp + 2*n, pp, n, cy); + hi -= mpn_sub_nc (pp + 3*n, scratch + n, pp + n, n, cy); - TMP_FREE; + hi += mpn_add (pp + n, pp + n, 3*n, scratch, n); + + /* FIXME: Is support for s + t == n needed? */ + if (LIKELY (s + t > n)) + { + hi -= mpn_sub (pp + 2*n, pp + 2*n, 2*n, pp + 4*n, s+t-n); + + if (hi < 0) + MPN_DECR_U (pp + 4*n, s+t-n, -hi); + else + MPN_INCR_U (pp + 4*n, s+t-n, hi); + } + else + ASSERT (hi == 0); } diff --git a/contrib/gmp/mpn/generic/toom33_mul.c b/contrib/gmp/mpn/generic/toom33_mul.c index 5fa2813c31..cb30df657d 100644 --- a/contrib/gmp/mpn/generic/toom33_mul.c +++ b/contrib/gmp/mpn/generic/toom33_mul.c @@ -1,13 +1,14 @@ -/* mpn_toom33_mul -- Multiply {ap,an} and {bp,bn} where an and bn are close in +/* mpn_toom33_mul -- Multiply {ap,an} and {p,bn} where an and bn are close in size. Or more accurately, bn <= an < (3/2)bn. Contributed to the GNU project by Torbjorn Granlund. + Additional improvements by Marco Bodrato. THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -25,24 +26,16 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch area. - 2. Use new toom functions for the recursive calls. -*/ - #include "gmp.h" #include "gmp-impl.h" /* Evaluate in: -1, 0, +1, +2, +inf - <-s-><--n--><--n--><--n--> - ___ ______ ______ ______ - |a3_|___a2_|___a1_|___a0_| - |_b1_|___b0_| - <-t--><--n--> + <-s--><--n--><--n--><--n--> + ____ ______ ______ ______ + |_a3_|___a2_|___a1_|___a0_| + |b3_|___b2_|___b1_|___b0_| + <-t-><--n--><--n--><--n--> v0 = a0 * b0 # A(0)*B(0) v1 = (a0+ a1+ a2)*(b0+ b1+ b2) # A(1)*B(1) ah <= 2 bh <= 2 @@ -56,21 +49,28 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MAYBE_mul_toom33 1 #else #define MAYBE_mul_basecase \ - (MUL_TOOM33_THRESHOLD < 3 * MUL_KARATSUBA_THRESHOLD) + (MUL_TOOM33_THRESHOLD < 3 * MUL_TOOM22_THRESHOLD) #define MAYBE_mul_toom33 \ (MUL_TOOM44_THRESHOLD >= 3 * MUL_TOOM33_THRESHOLD) #endif +/* FIXME: TOOM33_MUL_N_REC is not quite right for a balanced + multiplication at the infinity point. We may have + MAYBE_mul_basecase == 0, and still get s just below + MUL_TOOM22_THRESHOLD. If MUL_TOOM33_THRESHOLD == 7, we can even get + s == 1 and mpn_toom22_mul will crash. +*/ + #define TOOM33_MUL_N_REC(p, a, b, n, ws) \ do { \ if (MAYBE_mul_basecase \ - && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ + && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \ mpn_mul_basecase (p, a, n, b, n); \ else if (! MAYBE_mul_toom33 \ || BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \ - mpn_kara_mul_n (p, a, b, n, ws); \ + mpn_toom22_mul (p, a, n, b, n, ws); \ else \ - mpn_toom3_mul_n (p, a, b, n, ws); \ + mpn_toom33_mul (p, a, n, b, n, ws); \ } while (0) void @@ -85,7 +85,6 @@ mpn_toom33_mul (mp_ptr pp, mp_ptr gp; mp_ptr as1, asm1, as2; mp_ptr bs1, bsm1, bs2; - TMP_DECL; #define a0 ap #define a1 (ap + n) @@ -104,35 +103,34 @@ mpn_toom33_mul (mp_ptr pp, ASSERT (0 < s && s <= n); ASSERT (0 < t && t <= n); - TMP_MARK; - - as1 = TMP_SALLOC_LIMBS (n + 1); - asm1 = TMP_SALLOC_LIMBS (n + 1); - as2 = TMP_SALLOC_LIMBS (n + 1); + as1 = scratch + 4 * n + 4; + asm1 = scratch + 2 * n + 2; + as2 = pp + n + 1; - bs1 = TMP_SALLOC_LIMBS (n + 1); - bsm1 = TMP_SALLOC_LIMBS (n + 1); - bs2 = TMP_SALLOC_LIMBS (n + 1); + bs1 = pp; + bsm1 = scratch + 3 * n + 3; /* we need 4n+4 <= 4n+s+t */ + bs2 = pp + 2 * n + 2; - gp = pp; + gp = scratch; vm1_neg = 0; /* Compute as1 and asm1. */ cy = mpn_add (gp, a0, n, a2, s); -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (cy == 0 && mpn_cmp (gp, a1, n) < 0) { - cy = mpn_addsub_n (as1, asm1, a1, gp, n); - as1[n] = 0; + cy = mpn_add_n_sub_n (as1, asm1, a1, gp, n); + as1[n] = cy >> 1; asm1[n] = 0; vm1_neg = 1; } else { - cy2 = mpn_addsub_n (as1, asm1, gp, a1, n); + mp_limb_t cy2; + cy2 = mpn_add_n_sub_n (as1, asm1, gp, a1, n); as1[n] = cy + (cy2 >> 1); - asm1[n] = cy - (cy & 1); + asm1[n] = cy - (cy2 & 1); } #else as1[n] = cy + mpn_add_n (as1, gp, a1, n); @@ -150,36 +148,45 @@ mpn_toom33_mul (mp_ptr pp, #endif /* Compute as2. */ +#if HAVE_NATIVE_mpn_rsblsh1_n + cy = mpn_add_n (as2, a2, as1, s); + if (s != n) + cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy); + cy += as1[n]; + cy = 2 * cy + mpn_rsblsh1_n (as2, a0, as2, n); +#else #if HAVE_NATIVE_mpn_addlsh1_n cy = mpn_addlsh1_n (as2, a1, a2, s); if (s != n) cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy); cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); #else - cy = mpn_lshift (as2, a2, s, 1); - cy += mpn_add_n (as2, a1, as2, s); + cy = mpn_add_n (as2, a2, as1, s); if (s != n) - cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy); + cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy); + cy += as1[n]; cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a0, as2, n); + cy -= mpn_sub_n (as2, as2, a0, n); +#endif #endif as2[n] = cy; /* Compute bs1 and bsm1. */ cy = mpn_add (gp, b0, n, b2, t); -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (cy == 0 && mpn_cmp (gp, b1, n) < 0) { - cy = mpn_addsub_n (bs1, bsm1, b1, gp, n); - bs1[n] = 0; + cy = mpn_add_n_sub_n (bs1, bsm1, b1, gp, n); + bs1[n] = cy >> 1; bsm1[n] = 0; vm1_neg ^= 1; } else { - cy2 = mpn_addsub_n (bs1, bsm1, gp, b1, n); + mp_limb_t cy2; + cy2 = mpn_add_n_sub_n (bs1, bsm1, gp, b1, n); bs1[n] = cy + (cy2 >> 1); - bsm1[n] = cy - (cy & 1); + bsm1[n] = cy - (cy2 & 1); } #else bs1[n] = cy + mpn_add_n (bs1, gp, b1, n); @@ -197,18 +204,26 @@ mpn_toom33_mul (mp_ptr pp, #endif /* Compute bs2. */ +#if HAVE_NATIVE_mpn_rsblsh1_n + cy = mpn_add_n (bs2, b2, bs1, t); + if (t != n) + cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy); + cy += bs1[n]; + cy = 2 * cy + mpn_rsblsh1_n (bs2, b0, bs2, n); +#else #if HAVE_NATIVE_mpn_addlsh1_n cy = mpn_addlsh1_n (bs2, b1, b2, t); if (t != n) cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy); cy = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n); #else - cy = mpn_lshift (bs2, b2, t, 1); - cy += mpn_add_n (bs2, b1, bs2, t); + cy = mpn_add_n (bs2, bs1, b2, t); if (t != n) - cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy); + cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy); + cy += bs1[n]; cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1); - cy += mpn_add_n (bs2, b0, bs2, n); + cy -= mpn_sub_n (bs2, bs2, b0, n); +#endif #endif bs2[n] = cy; @@ -224,7 +239,7 @@ mpn_toom33_mul (mp_ptr pp, #define vinf (pp + 4 * n) /* s+t */ #define vm1 scratch /* 2n+1 */ #define v2 (scratch + 2 * n + 1) /* 2n+2 */ -#define scratch_out (scratch + 4 * n + 4) +#define scratch_out (scratch + 5 * n + 5) /* vm1, 2n+1 limbs */ #ifdef SMALLER_RECURSION @@ -285,7 +300,5 @@ mpn_toom33_mul (mp_ptr pp, TOOM33_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */ - mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, 1^vm1_neg, vinf0, scratch_out); - - TMP_FREE; + mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0); } diff --git a/contrib/gmp/mpn/generic/toom3_sqr.c b/contrib/gmp/mpn/generic/toom3_sqr.c index 0c8a4ff74d..5824b05d70 100644 --- a/contrib/gmp/mpn/generic/toom3_sqr.c +++ b/contrib/gmp/mpn/generic/toom3_sqr.c @@ -1,12 +1,13 @@ /* mpn_toom3_sqr -- Square {ap,an}. Contributed to the GNU project by Torbjorn Granlund. + Additional improvements by Marco Bodrato. THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -24,30 +25,20 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1 and asm1 could be - avoided by instead reusing the pp area and the scratch area. - 2. Use new toom functions for the recursive calls. -*/ - #include "gmp.h" #include "gmp-impl.h" /* Evaluate in: -1, 0, +1, +2, +inf - <-s-><--n--><--n--><--n--> - ___ ______ ______ ______ - |a3_|___a2_|___a1_|___a0_| - |_b1_|___b0_| - <-t--><--n--> - - v0 = a0 * b0 # A(0)*B(0) - v1 = (a0+ a1+ a2)*(b0+ b1+ b2) # A(1)*B(1) ah <= 2 bh <= 2 - vm1 = (a0- a1+ a2)*(b0- b1+ b2) # A(-1)*B(-1) |ah| <= 1 bh <= 1 - v2 = (a0+2a1+4a2)*(b0+2b1+4b2) # A(2)*B(2) ah <= 6 bh <= 6 - vinf= a2 * b2 # A(inf)*B(inf) + <-s--><--n--><--n--> + ____ ______ ______ + |_a2_|___a1_|___a0_| + + v0 = a0 ^2 # A(0)^2 + v1 = (a0+ a1+ a2)^2 # A(1)^2 ah <= 2 + vm1 = (a0- a1+ a2)^2 # A(-1)^2 |ah| <= 1 + v2 = (a0+2a1+4a2)^2 # A(2)^2 ah <= 6 + vinf= a2 ^2 # A(inf)^2 */ #if TUNE_PROGRAM_BUILD @@ -55,21 +46,21 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MAYBE_sqr_toom3 1 #else #define MAYBE_sqr_basecase \ - (SQR_TOOM3_THRESHOLD < 3 * SQR_KARATSUBA_THRESHOLD) + (SQR_TOOM3_THRESHOLD < 3 * SQR_TOOM2_THRESHOLD) #define MAYBE_sqr_toom3 \ (SQR_TOOM4_THRESHOLD >= 3 * SQR_TOOM3_THRESHOLD) #endif -#define TOOM3_SQR_N_REC(p, a, n, ws) \ +#define TOOM3_SQR_REC(p, a, n, ws) \ do { \ if (MAYBE_sqr_basecase \ - && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \ + && BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \ mpn_sqr_basecase (p, a, n); \ else if (! MAYBE_sqr_toom3 \ || BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \ - mpn_kara_sqr_n (p, a, n, ws); \ + mpn_toom2_sqr (p, a, n, ws); \ else \ - mpn_toom3_sqr_n (p, a, n, ws); \ + mpn_toom3_sqr (p, a, n, ws); \ } while (0) void @@ -81,7 +72,6 @@ mpn_toom3_sqr (mp_ptr pp, mp_limb_t cy, vinf0; mp_ptr gp; mp_ptr as1, asm1, as2; - TMP_DECL; #define a0 ap #define a1 (ap + n) @@ -93,28 +83,27 @@ mpn_toom3_sqr (mp_ptr pp, ASSERT (0 < s && s <= n); - TMP_MARK; - - as1 = TMP_SALLOC_LIMBS (n + 1); - asm1 = TMP_SALLOC_LIMBS (n + 1); - as2 = TMP_SALLOC_LIMBS (n + 1); + as1 = scratch + 4 * n + 4; + asm1 = scratch + 2 * n + 2; + as2 = pp + n + 1; - gp = pp; + gp = scratch; /* Compute as1 and asm1. */ cy = mpn_add (gp, a0, n, a2, s); -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (cy == 0 && mpn_cmp (gp, a1, n) < 0) { - cy = mpn_addsub_n (as1, asm1, a1, gp, n); - as1[n] = 0; + cy = mpn_add_n_sub_n (as1, asm1, a1, gp, n); + as1[n] = cy >> 1; asm1[n] = 0; } else { - cy2 = mpn_addsub_n (as1, asm1, gp, a1, n); + mp_limb_t cy2; + cy2 = mpn_add_n_sub_n (as1, asm1, gp, a1, n); as1[n] = cy + (cy2 >> 1); - asm1[n] = cy - (cy & 1); + asm1[n] = cy - (cy2 & 1); } #else as1[n] = cy + mpn_add_n (as1, gp, a1, n); @@ -131,18 +120,26 @@ mpn_toom3_sqr (mp_ptr pp, #endif /* Compute as2. */ +#if HAVE_NATIVE_mpn_rsblsh1_n + cy = mpn_add_n (as2, a2, as1, s); + if (s != n) + cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy); + cy += as1[n]; + cy = 2 * cy + mpn_rsblsh1_n (as2, a0, as2, n); +#else #if HAVE_NATIVE_mpn_addlsh1_n cy = mpn_addlsh1_n (as2, a1, a2, s); if (s != n) cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy); cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); #else - cy = mpn_lshift (as2, a2, s, 1); - cy += mpn_add_n (as2, a1, as2, s); + cy = mpn_add_n (as2, a2, as1, s); if (s != n) - cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy); + cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy); + cy += as1[n]; cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a0, as2, n); + cy -= mpn_sub_n (as2, as2, a0, n); +#endif #endif as2[n] = cy; @@ -154,11 +151,11 @@ mpn_toom3_sqr (mp_ptr pp, #define vinf (pp + 4 * n) /* s+s */ #define vm1 scratch /* 2n+1 */ #define v2 (scratch + 2 * n + 1) /* 2n+2 */ -#define scratch_out (scratch + 4 * n + 4) +#define scratch_out (scratch + 5 * n + 5) /* vm1, 2n+1 limbs */ #ifdef SMALLER_RECURSION - TOOM3_SQR_N_REC (vm1, asm1, n, scratch_out); + TOOM3_SQR_REC (vm1, asm1, n, scratch_out); cy = 0; if (asm1[n] != 0) cy = asm1[n] + mpn_add_n (vm1 + n, vm1 + n, asm1, n); @@ -166,18 +163,18 @@ mpn_toom3_sqr (mp_ptr pp, cy += mpn_add_n (vm1 + n, vm1 + n, asm1, n); vm1[2 * n] = cy; #else - TOOM3_SQR_N_REC (vm1, asm1, n + 1, scratch_out); + TOOM3_SQR_REC (vm1, asm1, n + 1, scratch_out); #endif - TOOM3_SQR_N_REC (v2, as2, n + 1, scratch_out); /* v2, 2n+1 limbs */ + TOOM3_SQR_REC (v2, as2, n + 1, scratch_out); /* v2, 2n+1 limbs */ - TOOM3_SQR_N_REC (vinf, a2, s, scratch_out); /* vinf, s+s limbs */ + TOOM3_SQR_REC (vinf, a2, s, scratch_out); /* vinf, s+s limbs */ vinf0 = vinf[0]; /* v1 overlaps with this */ #ifdef SMALLER_RECURSION /* v1, 2n+1 limbs */ - TOOM3_SQR_N_REC (v1, as1, n, scratch_out); + TOOM3_SQR_REC (v1, as1, n, scratch_out); if (as1[n] == 1) { cy = as1[n] + mpn_add_n (v1 + n, v1 + n, as1, n); @@ -207,13 +204,11 @@ mpn_toom3_sqr (mp_ptr pp, v1[2 * n] = cy; #else cy = vinf[1]; - TOOM3_SQR_N_REC (v1, as1, n + 1, scratch_out); + TOOM3_SQR_REC (v1, as1, n + 1, scratch_out); vinf[1] = cy; #endif - TOOM3_SQR_N_REC (v0, ap, n, scratch_out); /* v0, 2n limbs */ - - mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + s, 1, vinf0, scratch_out); + TOOM3_SQR_REC (v0, ap, n, scratch_out); /* v0, 2n limbs */ - TMP_FREE; + mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + s, 0, vinf0); } diff --git a/contrib/gmp/mpn/generic/toom42_mul.c b/contrib/gmp/mpn/generic/toom42_mul.c index 981b45df83..99ac175a04 100644 --- a/contrib/gmp/mpn/generic/toom42_mul.c +++ b/contrib/gmp/mpn/generic/toom42_mul.c @@ -29,15 +29,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch allocation. - - 2. Apply optimizations also to mul_toom32.c. -*/ - #include "gmp.h" #include "gmp-impl.h" @@ -56,20 +47,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ vinf= a3 * b1 # A(inf)*B(inf) */ -#if TUNE_PROGRAM_BUILD -#define MAYBE_mul_toom22 1 -#else -#define MAYBE_mul_toom22 \ - (MUL_TOOM33_THRESHOLD >= 2 * MUL_TOOM22_THRESHOLD) -#endif - -#define TOOM22_MUL_N_REC(p, a, b, n, ws) \ +#define TOOM42_MUL_N_REC(p, a, b, n, ws) \ do { \ - if (! MAYBE_mul_toom22 \ - || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ - mpn_mul_basecase (p, a, n, b, n); \ - else \ - mpn_toom22_mul (p, a, n, b, n, ws); \ + mpn_mul_n (p, a, b, n); \ } while (0) void @@ -115,32 +95,7 @@ mpn_toom42_mul (mp_ptr pp, a1_a3 = pp + n + 1; /* Compute as1 and asm1. */ - a0_a2[n] = mpn_add_n (a0_a2, a0, a2, n); - a1_a3[n] = mpn_add (a1_a3, a1, n, a3, s); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) - { - mpn_addsub_n (as1, asm1, a1_a3, a0_a2, n + 1); - vm1_neg = 1; - } - else - { - mpn_addsub_n (as1, asm1, a0_a2, a1_a3, n + 1); - vm1_neg = 0; - } -#else - mpn_add_n (as1, a0_a2, a1_a3, n + 1); - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) - { - mpn_sub_n (asm1, a1_a3, a0_a2, n + 1); - vm1_neg = 1; - } - else - { - mpn_sub_n (asm1, a0_a2, a1_a3, n + 1); - vm1_neg = 0; - } -#endif + vm1_neg = mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0_a2) & 1; /* Compute as2. */ #if HAVE_NATIVE_mpn_addlsh1_n @@ -164,15 +119,15 @@ mpn_toom42_mul (mp_ptr pp, /* Compute bs1 and bsm1. */ if (t == n) { -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (mpn_cmp (b0, b1, n) < 0) { - cy = mpn_addsub_n (bs1, bsm1, b1, b0, n); + cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n); vm1_neg ^= 1; } else { - cy = mpn_addsub_n (bs1, bsm1, b0, b1, n); + cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n); } bs1[n] = cy >> 1; #else @@ -220,16 +175,16 @@ mpn_toom42_mul (mp_ptr pp, #define vinf (pp + 4 * n) /* s+t */ #define vm1 scratch /* 2n+1 */ #define v2 (scratch + 2 * n + 1) /* 2n+2 */ -#define scratch_out scratch + 4 * n + 4 +#define scratch_out scratch + 4 * n + 4 /* Currently unused. */ /* vm1, 2n+1 limbs */ - TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out); + TOOM42_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out); cy = 0; if (asm1[n] != 0) cy = mpn_add_n (vm1 + n, vm1 + n, bsm1, n); vm1[2 * n] = cy; - TOOM22_MUL_N_REC (v2, as2, bs2, n + 1, scratch_out); /* v2, 2n+1 limbs */ + TOOM42_MUL_N_REC (v2, as2, bs2, n + 1, scratch_out); /* v2, 2n+1 limbs */ /* vinf, s+t limbs */ if (s > t) mpn_mul (vinf, a3, s, b1, t); @@ -238,7 +193,7 @@ mpn_toom42_mul (mp_ptr pp, vinf0 = vinf[0]; /* v1 overlaps with this */ /* v1, 2n+1 limbs */ - TOOM22_MUL_N_REC (v1, as1, bs1, n, scratch_out); + TOOM42_MUL_N_REC (v1, as1, bs1, n, scratch_out); if (as1[n] == 1) { cy = bs1[n] + mpn_add_n (v1 + n, v1 + n, bs1, n); @@ -261,9 +216,9 @@ mpn_toom42_mul (mp_ptr pp, cy += mpn_add_n (v1 + n, v1 + n, as1, n); v1[2 * n] = cy; - TOOM22_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */ + TOOM42_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */ - mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, 1^vm1_neg, vinf0, scratch + 4 * n + 4); + mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0); TMP_FREE; } diff --git a/contrib/gmp/mpn/generic/toom43_mul.c b/contrib/gmp/mpn/generic/toom43_mul.c new file mode 100644 index 0000000000..670049c394 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom43_mul.c @@ -0,0 +1,223 @@ +/* mpn_toom43_mul -- Multiply {ap,an} and {bp,bn} where an is nominally 4/3 + times as large as bn. Or more accurately, bn < an < 2 bn. + + Contributed to the GNU project by Marco Bodrato. + + The idea of applying toom to unbalanced multiplication is due to Marco + Bodrato and Alberto Zanoni. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Evaluate in: -2, -1, 0, +1, +2, +inf + + <-s-><--n--><--n--><--n--> + ___ ______ ______ ______ + |a3_|___a2_|___a1_|___a0_| + |_b2_|___b1_|___b0_| + <-t--><--n--><--n--> + + v0 = a0 * b0 # A(0)*B(0) + v1 = (a0+ a1+ a2+ a3)*(b0+ b1+ b2) # A(1)*B(1) ah <= 3 bh <= 2 + vm1 = (a0- a1+ a2- a3)*(b0- b1+ b2) # A(-1)*B(-1) |ah| <= 1 |bh|<= 1 + v2 = (a0+2a1+4a2+8a3)*(b0+2b1+4b2) # A(2)*B(2) ah <= 14 bh <= 6 + vm2 = (a0-2a1+4a2-8a3)*(b0-2b1+4b2) # A(-2)*B(-2) |ah| <= 9 |bh|<= 4 + vinf= a3 * b2 # A(inf)*B(inf) +*/ + +void +mpn_toom43_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn, mp_ptr scratch) +{ + mp_size_t n, s, t; + enum toom6_flags flags; + mp_limb_t cy; + +#define a0 ap +#define a1 (ap + n) +#define a2 (ap + 2 * n) +#define a3 (ap + 3 * n) +#define b0 bp +#define b1 (bp + n) +#define b2 (bp + 2 * n) + + n = 1 + (3 * an >= 4 * bn ? (an - 1) >> 2 : (bn - 1) / (size_t) 3); + + s = an - 3 * n; + t = bn - 2 * n; + + ASSERT (0 < s && s <= n); + ASSERT (0 < t && t <= n); + + /* This is true whenever an >= 25 or bn >= 19, I think. It + guarantees that we can fit 5 values of size n+1 in the product + area. */ + ASSERT (s+t >= 5); + +#define v0 pp /* 2n */ +#define vm1 (scratch) /* 2n+1 */ +#define v1 (pp + 2*n) /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define v2 (scratch + 4 * n + 2) /* 2n+1 */ +#define vinf (pp + 5 * n) /* s+t */ +#define bs1 pp /* n+1 */ +#define bsm1 (scratch + 2 * n + 2) /* n+1 */ +#define asm1 (scratch + 3 * n + 3) /* n+1 */ +#define asm2 (scratch + 4 * n + 4) /* n+1 */ +#define bsm2 (pp + n + 1) /* n+1 */ +#define bs2 (pp + 2 * n + 2) /* n+1 */ +#define as2 (pp + 3 * n + 3) /* n+1 */ +#define as1 (pp + 4 * n + 4) /* n+1 */ + + /* Total sccratch need is 6 * n + 3 + 1; we allocate one extra + limb, because products will overwrite 2n+2 limbs. */ + +#define a0a2 scratch +#define b0b2 scratch +#define a1a3 asm1 +#define b1d bsm1 + + /* Compute as2 and asm2. */ + flags = toom6_vm2_neg & mpn_toom_eval_dgr3_pm2 (as2, asm2, ap, n, s, a1a3); + + /* Compute bs2 and bsm2. */ + b1d[n] = mpn_lshift (b1d, b1, n, 1); /* 2b1 */ + cy = mpn_lshift (b0b2, b2, t, 2); /* 4b2 */ + cy += mpn_add_n (b0b2, b0b2, b0, t); /* 4b2 + b0 */ + if (t != n) + cy = mpn_add_1 (b0b2 + t, b0 + t, n - t, cy); + b0b2[n] = cy; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (mpn_cmp (b0b2, b1d, n+1) < 0) + { + mpn_add_n_sub_n (bs2, bsm2, b1d, b0b2, n+1); + flags ^= toom6_vm2_neg; + } + else + { + mpn_add_n_sub_n (bs2, bsm2, b0b2, b1d, n+1); + } +#else + mpn_add_n (bs2, b0b2, b1d, n+1); + if (mpn_cmp (b0b2, b1d, n+1) < 0) + { + mpn_sub_n (bsm2, b1d, b0b2, n+1); + flags ^= toom6_vm2_neg; + } + else + { + mpn_sub_n (bsm2, b0b2, b1d, n+1); + } +#endif + + /* Compute as1 and asm1. */ + flags ^= toom6_vm1_neg & mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0a2); + + /* Compute bs1 and bsm1. */ + bsm1[n] = mpn_add (bsm1, b0, n, b2, t); +#if HAVE_NATIVE_mpn_add_n_sub_n + if (bsm1[n] == 0 && mpn_cmp (bsm1, b1, n) < 0) + { + cy = mpn_add_n_sub_n (bs1, bsm1, b1, bsm1, n); + bs1[n] = cy >> 1; + flags ^= toom6_vm1_neg; + } + else + { + cy = mpn_add_n_sub_n (bs1, bsm1, bsm1, b1, n); + bs1[n] = bsm1[n] + (cy >> 1); + bsm1[n]-= cy & 1; + } +#else + bs1[n] = bsm1[n] + mpn_add_n (bs1, bsm1, b1, n); + if (bsm1[n] == 0 && mpn_cmp (bsm1, b1, n) < 0) + { + mpn_sub_n (bsm1, b1, bsm1, n); + flags ^= toom6_vm1_neg; + } + else + { + bsm1[n] -= mpn_sub_n (bsm1, bsm1, b1, n); + } +#endif + + ASSERT (as1[n] <= 3); + ASSERT (bs1[n] <= 2); + ASSERT (asm1[n] <= 1); + ASSERT (bsm1[n] <= 1); + ASSERT (as2[n] <=14); + ASSERT (bs2[n] <= 6); + ASSERT (asm2[n] <= 9); + ASSERT (bsm2[n] <= 4); + + /* vm1, 2n+1 limbs */ + mpn_mul_n (vm1, asm1, bsm1, n+1); /* W4 */ + + /* vm2, 2n+1 limbs */ + mpn_mul_n (vm2, asm2, bsm2, n+1); /* W2 */ + + /* v2, 2n+1 limbs */ + mpn_mul_n (v2, as2, bs2, n+1); /* W1 */ + + /* v1, 2n+1 limbs */ + mpn_mul_n (v1, as1, bs1, n+1); /* W3 */ + + /* vinf, s+t limbs */ /* W0 */ + if (s > t) mpn_mul (vinf, a3, s, b2, t); + else mpn_mul (vinf, b2, t, a3, s); + + /* v0, 2n limbs */ + mpn_mul_n (v0, ap, bp, n); /* W5 */ + + mpn_toom_interpolate_6pts (pp, n, flags, vm1, vm2, v2, t + s); + +#undef v0 +#undef vm1 +#undef v1 +#undef vm2 +#undef v2 +#undef vinf +#undef bs1 +#undef bs2 +#undef bsm1 +#undef bsm2 +#undef asm1 +#undef asm2 +/* #undef as1 */ +/* #undef as2 */ +#undef a0a2 +#undef b0b2 +#undef a1a3 +#undef b1d +#undef a0 +#undef a1 +#undef a2 +#undef a3 +#undef b0 +#undef b1 +#undef b2 +} diff --git a/contrib/gmp/mpn/generic/toom44_mul.c b/contrib/gmp/mpn/generic/toom44_mul.c index 37ff45279d..01a6053b78 100644 --- a/contrib/gmp/mpn/generic/toom44_mul.c +++ b/contrib/gmp/mpn/generic/toom44_mul.c @@ -25,18 +25,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch area. - 2. Use new toom functions for the recursive calls. -*/ - #include "gmp.h" #include "gmp-impl.h" -/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf +/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf <-s--><--n--><--n--><--n--> ____ ______ ______ ______ @@ -48,8 +40,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ v1 = ( a0+ a1+ a2+ a3)*( b0+ b1+ b2+ b3) # A(1)*B(1) ah <= 3 bh <= 3 vm1 = ( a0- a1+ a2- a3)*( b0- b1+ b2- b3) # A(-1)*B(-1) |ah| <= 1 |bh| <= 1 v2 = ( a0+2a1+4a2+8a3)*( b0+2b1+4b2+8b3) # A(2)*B(2) ah <= 14 bh <= 14 + vm2 = ( a0-2a1+4a2-8a3)*( b0-2b1+4b2-8b3) # A(2)*B(2) ah <= 9 |bh| <= 9 vh = (8a0+4a1+2a2+ a3)*(8b0+4b1+2b2+ b3) # A(1/2)*B(1/2) ah <= 14 bh <= 14 - vmh = (8a0-4a1+2a2- a3)*(8b0-4b1+2b2- b3) # A(-1/2)*B(-1/2) -4<=ah<=9 -4<=bh<=9 vinf= a3 * b2 # A(inf)*B(inf) */ @@ -59,7 +51,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MAYBE_mul_toom44 1 #else #define MAYBE_mul_basecase \ - (MUL_TOOM44_THRESHOLD < 4 * MUL_KARATSUBA_THRESHOLD) + (MUL_TOOM44_THRESHOLD < 4 * MUL_TOOM22_THRESHOLD) #define MAYBE_mul_toom22 \ (MUL_TOOM44_THRESHOLD < 4 * MUL_TOOM33_THRESHOLD) #define MAYBE_mul_toom44 \ @@ -69,18 +61,41 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define TOOM44_MUL_N_REC(p, a, b, n, ws) \ do { \ if (MAYBE_mul_basecase \ - && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \ + && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \ mpn_mul_basecase (p, a, n, b, n); \ else if (MAYBE_mul_toom22 \ && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \ - mpn_kara_mul_n (p, a, b, n, ws); \ + mpn_toom22_mul (p, a, n, b, n, ws); \ else if (! MAYBE_mul_toom44 \ || BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) \ - mpn_toom3_mul_n (p, a, b, n, ws); \ + mpn_toom33_mul (p, a, n, b, n, ws); \ else \ mpn_toom44_mul (p, a, n, b, n, ws); \ } while (0) +/* Use of scratch space. In the product area, we store + + ___________________ + |vinf|____|_v1_|_v0_| + s+t 2n-1 2n+1 2n + + The other recursive products, vm1, v2, vm2, vh are stored in the + scratch area. When computing them, we use the product area for + intermediate values. + + Next, we compute v1. We can store the intermediate factors at v0 + and at vh + 2n + 2. + + Finally, for v0 and vinf, factors are parts of the input operands, + and we need scratch space only for the recursive multiplication. + + In all, if S(an) is the scratch need, the needed space is bounded by + + S(an) <= 4 (2*ceil(an/4) + 1) + 1 + S(ceil(an/4) + 1) + + which should give S(n) = 8 n/3 + c log(n) for some constant c. +*/ + void mpn_toom44_mul (mp_ptr pp, mp_srcptr ap, mp_size_t an, @@ -89,11 +104,7 @@ mpn_toom44_mul (mp_ptr pp, { mp_size_t n, s, t; mp_limb_t cy; - mp_ptr gp, hp; - mp_ptr as1, asm1, as2, ash, asmh; - mp_ptr bs1, bsm1, bs2, bsh, bsmh; - enum toom4_flags flags; - TMP_DECL; + enum toom7_flags flags; #define a0 ap #define a1 (ap + n) @@ -104,227 +115,111 @@ mpn_toom44_mul (mp_ptr pp, #define b2 (bp + 2*n) #define b3 (bp + 3*n) + ASSERT (an >= bn); + n = (an + 3) >> 2; s = an - 3 * n; t = bn - 3 * n; - ASSERT (an >= bn); - ASSERT (0 < s && s <= n); ASSERT (0 < t && t <= n); + ASSERT (s >= t); - TMP_MARK; - - as1 = TMP_ALLOC_LIMBS (10 * n + 10); - asm1 = as1 + n + 1; - as2 = asm1 + n + 1; - ash = as2 + n + 1; - asmh = ash + n + 1; - bs1 = asmh + n + 1; - bsm1 = bs1 + n + 1; - bs2 = bsm1 + n + 1; - bsh = bs2 + n + 1; - bsmh = bsh + n + 1; - - gp = pp; - hp = pp + n + 1; - - flags = 0; - - /* Compute as1 and asm1. */ - gp[n] = mpn_add_n (gp, a0, a2, n); - hp[n] = mpn_add (hp, a1, n, a3, s); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_addsub_n (as1, asm1, hp, gp, n + 1); - flags ^= toom4_w3_neg; - } - else - { - mpn_addsub_n (as1, asm1, gp, hp, n + 1); - } -#else - mpn_add_n (as1, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asm1, hp, gp, n + 1); - flags ^= toom4_w3_neg; - } - else - { - mpn_sub_n (asm1, gp, hp, n + 1); - } -#endif + /* NOTE: The multiplications to v2, vm2, vh and vm1 overwrites the + * following limb, so these must be computed in order, and we need a + * one limb gap to tp. */ +#define v0 pp /* 2n */ +#define v1 (pp + 2 * n) /* 2n+1 */ +#define vinf (pp + 6 * n) /* s+t */ +#define v2 scratch /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define vh (scratch + 4 * n + 2) /* 2n+1 */ +#define vm1 (scratch + 6 * n + 3) /* 2n+1 */ +#define tp (scratch + 8*n + 5) - /* Compute as2. */ -#if HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (as2, a2, a3, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy); - cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); -#else - cy = mpn_lshift (as2, a3, s, 1); - cy += mpn_add_n (as2, a2, as2, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a1, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a0, as2, n); -#endif - as2[n] = cy; + /* apx and bpx must not overlap with v1 */ +#define apx pp /* n+1 */ +#define amx (pp + n + 1) /* n+1 */ +#define bmx (pp + 2*n + 2) /* n+1 */ +#define bpx (pp + 4*n + 2) /* n+1 */ - /* Compute ash and asmh. */ - cy = mpn_lshift (gp, a0, n, 3); /* 8a0 */ -#if HAVE_NATIVE_mpn_addlsh1_n - gp[n] = cy + mpn_addlsh1_n (gp, gp, a2, n); /* 8a0 + 2a2 */ -#else - cy += mpn_lshift (hp, a2, n, 1); /* 2a2 */ - gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8a0 + 2a2 */ -#endif - cy = mpn_lshift (hp, a1, n, 2); /* 4a1 */ - hp[n] = cy + mpn_add (hp, hp, n, a3, s); /* 4a1 + a3 */ -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_addsub_n (ash, asmh, hp, gp, n + 1); - flags ^= toom4_w1_neg; - } - else - { - mpn_addsub_n (ash, asmh, gp, hp, n + 1); - } -#else - mpn_add_n (ash, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asmh, hp, gp, n + 1); - flags ^= toom4_w1_neg; - } - else - { - mpn_sub_n (asmh, gp, hp, n + 1); - } -#endif + /* Total scratch need: 8*n + 5 + scratch for recursive calls. This + gives roughly 32 n/3 + log term. */ + + /* Compute apx = a0 + 2 a1 + 4 a2 + 8 a3 and amx = a0 - 2 a1 + 4 a2 - 8 a3. */ + flags = toom7_w1_neg & mpn_toom_eval_dgr3_pm2 (apx, amx, ap, n, s, tp); + + /* Compute bpx = b0 + 2 b1 + 4 b2 + 8 b3 and bmx = b0 - 2 b1 + 4 b2 - 8 b3. */ + flags ^= toom7_w1_neg & mpn_toom_eval_dgr3_pm2 (bpx, bmx, bp, n, t, tp); - /* Compute bs1 and bsm1. */ - gp[n] = mpn_add_n (gp, b0, b2, n); - hp[n] = mpn_add (hp, b1, n, b3, t); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) + TOOM44_MUL_N_REC (v2, apx, bpx, n + 1, tp); /* v2, 2n+1 limbs */ + TOOM44_MUL_N_REC (vm2, amx, bmx, n + 1, tp); /* vm2, 2n+1 limbs */ + + /* Compute apx = 8 a0 + 4 a1 + 2 a2 + a3 = (((2*a0 + a1) * 2 + a2) * 2 + a3 */ +#if HAVE_NATIVE_mpn_addlsh1_n + cy = mpn_addlsh1_n (apx, a1, a0, n); + cy = 2*cy + mpn_addlsh1_n (apx, a2, apx, n); + if (s < n) { - mpn_addsub_n (bs1, bsm1, hp, gp, n + 1); - flags ^= toom4_w3_neg; + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (apx, a3, apx, s); + apx[n] = 2*cy + mpn_lshift (apx + s, apx + s, n - s, 1); + MPN_INCR_U (apx + s, n+1-s, cy2); } else - { - mpn_addsub_n (bs1, bsm1, gp, hp, n + 1); - } + apx[n] = 2*cy + mpn_addlsh1_n (apx, a3, apx, n); #else - mpn_add_n (bs1, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (bsm1, hp, gp, n + 1); - flags ^= toom4_w3_neg; - } - else - { - mpn_sub_n (bsm1, gp, hp, n + 1); - } + cy = mpn_lshift (apx, a0, n, 1); + cy += mpn_add_n (apx, apx, a1, n); + cy = 2*cy + mpn_lshift (apx, apx, n, 1); + cy += mpn_add_n (apx, apx, a2, n); + cy = 2*cy + mpn_lshift (apx, apx, n, 1); + apx[n] = cy + mpn_add (apx, apx, n, a3, s); #endif - /* Compute bs2. */ + /* Compute bpx = 8 b0 + 4 b1 + 2 b2 + b3 = (((2*b0 + b1) * 2 + b2) * 2 + b3 */ #if HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (bs2, b2, b3, t); - if (t != n) - cy = mpn_add_1 (bs2 + t, b2 + t, n - t, cy); - cy = 2 * cy + mpn_addlsh1_n (bs2, b1, bs2, n); - cy = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n); -#else - cy = mpn_lshift (bs2, b3, t, 1); - cy += mpn_add_n (bs2, b2, bs2, t); - if (t != n) - cy = mpn_add_1 (bs2 + t, b2 + t, n - t, cy); - cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1); - cy += mpn_add_n (bs2, b1, bs2, n); - cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1); - cy += mpn_add_n (bs2, b0, bs2, n); -#endif - bs2[n] = cy; - - /* Compute bsh and bsmh. */ - cy = mpn_lshift (gp, b0, n, 3); /* 8b0 */ -#if HAVE_NATIVE_mpn_addlsh1_n - gp[n] = cy + mpn_addlsh1_n (gp, gp, b2, n); /* 8b0 + 2b2 */ -#else - cy += mpn_lshift (hp, b2, n, 1); /* 2b2 */ - gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8b0 + 2b2 */ -#endif - cy = mpn_lshift (hp, b1, n, 2); /* 4b1 */ - hp[n] = cy + mpn_add (hp, hp, n, b3, t); /* 4b1 + b3 */ -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) + cy = mpn_addlsh1_n (bpx, b1, b0, n); + cy = 2*cy + mpn_addlsh1_n (bpx, b2, bpx, n); + if (t < n) { - mpn_addsub_n (bsh, bsmh, hp, gp, n + 1); - flags ^= toom4_w1_neg; + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (bpx, b3, bpx, t); + bpx[n] = 2*cy + mpn_lshift (bpx + t, bpx + t, n - t, 1); + MPN_INCR_U (bpx + t, n+1-t, cy2); } else - { - mpn_addsub_n (bsh, bsmh, gp, hp, n + 1); - } + bpx[n] = 2*cy + mpn_addlsh1_n (bpx, b3, bpx, n); #else - mpn_add_n (bsh, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (bsmh, hp, gp, n + 1); - flags ^= toom4_w1_neg; - } - else - { - mpn_sub_n (bsmh, gp, hp, n + 1); - } + cy = mpn_lshift (bpx, b0, n, 1); + cy += mpn_add_n (bpx, bpx, b1, n); + cy = 2*cy + mpn_lshift (bpx, bpx, n, 1); + cy += mpn_add_n (bpx, bpx, b2, n); + cy = 2*cy + mpn_lshift (bpx, bpx, n, 1); + bpx[n] = cy + mpn_add (bpx, bpx, n, b3, t); #endif - ASSERT (as1[n] <= 3); - ASSERT (bs1[n] <= 3); - ASSERT (asm1[n] <= 1); - ASSERT (bsm1[n] <= 1); - ASSERT (as2[n] <= 14); - ASSERT (bs2[n] <= 14); - ASSERT (ash[n] <= 14); - ASSERT (bsh[n] <= 14); - ASSERT (asmh[n] <= 9); - ASSERT (bsmh[n] <= 9); - -#define v0 pp /* 2n */ -#define v1 (scratch + 6 * n + 6) /* 2n+1 */ -#define vm1 scratch /* 2n+1 */ -#define v2 (scratch + 2 * n + 2) /* 2n+1 */ -#define vinf (pp + 6 * n) /* s+t */ -#define vh (pp + 2 * n) /* 2n+1 */ -#define vmh (scratch + 4 * n + 4) -#define scratch_out (scratch + 8 * n + 8) + ASSERT (apx[n] < 15); + ASSERT (bpx[n] < 15); - /* vm1, 2n+1 limbs */ - TOOM44_MUL_N_REC (vm1, asm1, bsm1, n + 1, scratch_out); /* vm1, 2n+1 limbs */ + TOOM44_MUL_N_REC (vh, apx, bpx, n + 1, tp); /* vh, 2n+1 limbs */ - TOOM44_MUL_N_REC (v2 , as2 , bs2 , n + 1, scratch_out); /* v2, 2n+1 limbs */ + /* Compute apx = a0 + a1 + a2 + a3 and amx = a0 - a1 + a2 - a3. */ + flags |= toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp); - if (s > t) mpn_mul (vinf, a3, s, b3, t); - else TOOM44_MUL_N_REC (vinf, a3, b3, s, scratch_out); /* vinf, s+t limbs */ + /* Compute bpx = b0 + b1 + b2 + b3 bnd bmx = b0 - b1 + b2 - b3. */ + flags ^= toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (bpx, bmx, bp, n, t, tp); - TOOM44_MUL_N_REC (v1 , as1 , bs1 , n + 1, scratch_out); /* v1, 2n+1 limbs */ + TOOM44_MUL_N_REC (vm1, amx, bmx, n + 1, tp); /* vm1, 2n+1 limbs */ + /* Clobbers amx, bmx. */ + TOOM44_MUL_N_REC (v1, apx, bpx, n + 1, tp); /* v1, 2n+1 limbs */ - TOOM44_MUL_N_REC (vh , ash , bsh , n + 1, scratch_out); - - TOOM44_MUL_N_REC (vmh, asmh, bsmh, n + 1, scratch_out); - - TOOM44_MUL_N_REC (v0 , ap , bp , n , scratch_out); /* v0, 2n limbs */ - - mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch_out); + TOOM44_MUL_N_REC (v0, a0, b0, n, tp); + if (s > t) + mpn_mul (vinf, a3, s, b3, t); + else + TOOM44_MUL_N_REC (vinf, a3, b3, s, tp); /* vinf, s+t limbs */ - TMP_FREE; + mpn_toom_interpolate_7pts (pp, n, flags, vm2, vm1, v2, vh, s + t, tp); } diff --git a/contrib/gmp/mpn/generic/toom4_sqr.c b/contrib/gmp/mpn/generic/toom4_sqr.c index 911b5548d7..4050c45807 100644 --- a/contrib/gmp/mpn/generic/toom4_sqr.c +++ b/contrib/gmp/mpn/generic/toom4_sqr.c @@ -6,7 +6,7 @@ SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -24,14 +24,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch area. - 2. Use new toom functions for the recursive calls. -*/ - #include "gmp.h" #include "gmp-impl.h" @@ -40,16 +32,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ <-s--><--n--><--n--><--n--> ____ ______ ______ ______ |_a3_|___a2_|___a1_|___a0_| - |b3_|___b2_|___b1_|___b0_| - <-t-><--n--><--n--><--n--> - - v0 = a0 * b0 # A(0)*B(0) - v1 = ( a0+ a1+ a2+ a3)*( b0+ b1+ b2+ b3) # A(1)*B(1) ah <= 3 bh <= 3 - vm1 = ( a0- a1+ a2- a3)*( b0- b1+ b2- b3) # A(-1)*B(-1) |ah| <= 1 |bh| <= 1 - v2 = ( a0+2a1+4a2+8a3)*( b0+2b1+4b2+8b3) # A(2)*B(2) ah <= 14 bh <= 14 - vh = (8a0+4a1+2a2+ a3)*(8b0+4b1+2b2+ b3) # A(1/2)*B(1/2) ah <= 14 bh <= 14 - vmh = (8a0-4a1+2a2- a3)*(8b0-4b1+2b2- b3) # A(-1/2)*B(-1/2) -4<=ah<=9 -4<=bh<=9 - vinf= a3 * b2 # A(inf)*B(inf) + + v0 = a0 ^2 # A(0)^2 + v1 = ( a0+ a1+ a2+ a3)^2 # A(1)^2 ah <= 3 + vm1 = ( a0- a1+ a2- a3)^2 # A(-1)^2 |ah| <= 1 + v2 = ( a0+2a1+4a2+8a3)^2 # A(2)^2 ah <= 14 + vh = (8a0+4a1+2a2+ a3)^2 # A(1/2)^2 ah <= 14 + vmh = (8a0-4a1+2a2- a3)^2 # A(-1/2)^2 -4<=ah<=9 + vinf= a3 ^2 # A(inf)^2 */ #if TUNE_PROGRAM_BUILD @@ -58,24 +48,24 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define MAYBE_sqr_toom4 1 #else #define MAYBE_sqr_basecase \ - (SQR_TOOM4_THRESHOLD < 4 * SQR_KARATSUBA_THRESHOLD) + (SQR_TOOM4_THRESHOLD < 4 * SQR_TOOM2_THRESHOLD) #define MAYBE_sqr_toom2 \ (SQR_TOOM4_THRESHOLD < 4 * SQR_TOOM3_THRESHOLD) #define MAYBE_sqr_toom4 \ (SQR_FFT_THRESHOLD >= 4 * SQR_TOOM4_THRESHOLD) #endif -#define TOOM4_SQR_N_REC(p, a, n, ws) \ +#define TOOM4_SQR_REC(p, a, n, ws) \ do { \ if (MAYBE_sqr_basecase \ - && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \ + && BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \ mpn_sqr_basecase (p, a, n); \ else if (MAYBE_sqr_toom2 \ && BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \ - mpn_kara_sqr_n (p, a, n, ws); \ + mpn_toom2_sqr (p, a, n, ws); \ else if (! MAYBE_sqr_toom4 \ || BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD)) \ - mpn_toom3_sqr_n (p, a, n, ws); \ + mpn_toom3_sqr (p, a, n, ws); \ else \ mpn_toom4_sqr (p, a, n, ws); \ } while (0) @@ -87,9 +77,6 @@ mpn_toom4_sqr (mp_ptr pp, { mp_size_t n, s; mp_limb_t cy; - mp_ptr gp, hp; - mp_ptr as1, asm1, as2, ash, asmh; - TMP_DECL; #define a0 ap #define a1 (ap + n) @@ -102,122 +89,65 @@ mpn_toom4_sqr (mp_ptr pp, ASSERT (0 < s && s <= n); - TMP_MARK; + /* NOTE: The multiplications to v2, vm2, vh and vm1 overwrites the + * following limb, so these must be computed in order, and we need a + * one limb gap to tp. */ +#define v0 pp /* 2n */ +#define v1 (pp + 2 * n) /* 2n+1 */ +#define vinf (pp + 6 * n) /* s+t */ +#define v2 scratch /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define vh (scratch + 4 * n + 2) /* 2n+1 */ +#define vm1 (scratch + 6 * n + 3) /* 2n+1 */ +#define tp (scratch + 8*n + 5) - as1 = TMP_SALLOC_LIMBS (n + 1); - asm1 = TMP_SALLOC_LIMBS (n + 1); - as2 = TMP_SALLOC_LIMBS (n + 1); - ash = TMP_SALLOC_LIMBS (n + 1); - asmh = TMP_SALLOC_LIMBS (n + 1); + /* No overlap with v1 */ +#define apx pp /* n+1 */ +#define amx (pp + 4*n + 2) /* n+1 */ - gp = pp; - hp = pp + n + 1; + /* Total scratch need: 8*n + 5 + scratch for recursive calls. This + gives roughly 32 n/3 + log term. */ - /* Compute as1 and asm1. */ - gp[n] = mpn_add_n (gp, a0, a2, n); - hp[n] = mpn_add (hp, a1, n, a3, s); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_addsub_n (as1, asm1, hp, gp, n + 1); - } - else - { - mpn_addsub_n (as1, asm1, gp, hp, n + 1); - } -#else - mpn_add_n (as1, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asm1, hp, gp, n + 1); - } - else - { - mpn_sub_n (asm1, gp, hp, n + 1); - } -#endif + /* Compute apx = a0 + 2 a1 + 4 a2 + 8 a3 and amx = a0 - 2 a1 + 4 a2 - 8 a3. */ + mpn_toom_eval_dgr3_pm2 (apx, amx, ap, n, s, tp); - /* Compute as2. */ -#if HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (as2, a2, a3, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy); - cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); -#else - cy = mpn_lshift (as2, a3, s, 1); - cy += mpn_add_n (as2, a2, as2, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a1, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a0, as2, n); -#endif - as2[n] = cy; + TOOM4_SQR_REC (v2, apx, n + 1, tp); /* v2, 2n+1 limbs */ + TOOM4_SQR_REC (vm2, amx, n + 1, tp); /* vm2, 2n+1 limbs */ - /* Compute ash and asmh. */ - cy = mpn_lshift (gp, a0, n, 3); /* 8a0 */ + /* Compute apx = 8 a0 + 4 a1 + 2 a2 + a3 = (((2*a0 + a1) * 2 + a2) * 2 + a3 */ #if HAVE_NATIVE_mpn_addlsh1_n - gp[n] = cy + mpn_addlsh1_n (gp, gp, a2, n); /* 8a0 + 2a2 */ -#else - cy += mpn_lshift (hp, a2, n, 1); /* 2a2 */ - gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8a0 + 2a2 */ -#endif - cy = mpn_lshift (hp, a1, n, 2); /* 4a1 */ - hp[n] = cy + mpn_add (hp, hp, n, a3, s); /* 4a1 + a3 */ -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) + cy = mpn_addlsh1_n (apx, a1, a0, n); + cy = 2*cy + mpn_addlsh1_n (apx, a2, apx, n); + if (s < n) { - mpn_addsub_n (ash, asmh, hp, gp, n + 1); + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (apx, a3, apx, s); + apx[n] = 2*cy + mpn_lshift (apx + s, apx + s, n - s, 1); + MPN_INCR_U (apx + s, n+1-s, cy2); } else - { - mpn_addsub_n (ash, asmh, gp, hp, n + 1); - } + apx[n] = 2*cy + mpn_addlsh1_n (apx, a3, apx, n); #else - mpn_add_n (ash, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asmh, hp, gp, n + 1); - } - else - { - mpn_sub_n (asmh, gp, hp, n + 1); - } + cy = mpn_lshift (apx, a0, n, 1); + cy += mpn_add_n (apx, apx, a1, n); + cy = 2*cy + mpn_lshift (apx, apx, n, 1); + cy += mpn_add_n (apx, apx, a2, n); + cy = 2*cy + mpn_lshift (apx, apx, n, 1); + apx[n] = cy + mpn_add (apx, apx, n, a3, s); #endif - ASSERT (as1[n] <= 3); - ASSERT (asm1[n] <= 1); - ASSERT (as2[n] <= 14); - ASSERT (ash[n] <= 14); - ASSERT (asmh[n] <= 9); - -#define v0 pp /* 2n */ -#define v1 (scratch + 6 * n + 6) /* 2n+1 */ -#define vm1 scratch /* 2n+1 */ -#define v2 (scratch + 2 * n + 2) /* 2n+1 */ -#define vinf (pp + 6 * n) /* s+t */ -#define vh (pp + 2 * n) /* 2n+1 */ -#define vmh (scratch + 4 * n + 4) -#define scratch_out (scratch + 8 * n + 8) - - /* vm1, 2n+1 limbs */ - TOOM4_SQR_N_REC (vm1, asm1, n + 1, scratch_out); /* vm1, 2n+1 limbs */ - - TOOM4_SQR_N_REC (v2 , as2 , n + 1, scratch_out); /* v2, 2n+1 limbs */ - - TOOM4_SQR_N_REC (vinf, a3 , s, scratch_out); /* vinf, 2s limbs */ - - TOOM4_SQR_N_REC (v1 , as1 , n + 1, scratch_out); /* v1, 2n+1 limbs */ + ASSERT (apx[n] < 15); - TOOM4_SQR_N_REC (vh , ash , n + 1, scratch_out); + TOOM4_SQR_REC (vh, apx, n + 1, tp); /* vh, 2n+1 limbs */ - TOOM4_SQR_N_REC (vmh, asmh, n + 1, scratch_out); + /* Compute apx = a0 + a1 + a2 + a3 and amx = a0 - a1 + a2 - a3. */ + mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp); - TOOM4_SQR_N_REC (v0 , ap , n , scratch_out); /* v0, 2n limbs */ + TOOM4_SQR_REC (v1, apx, n + 1, tp); /* v1, 2n+1 limbs */ + TOOM4_SQR_REC (vm1, amx, n + 1, tp); /* vm1, 2n+1 limbs */ - mpn_toom_interpolate_7pts (pp, n, 0, vmh, vm1, v1, v2, s + s, scratch_out); + TOOM4_SQR_REC (v0, a0, n, tp); + TOOM4_SQR_REC (vinf, a3, s, tp); /* vinf, 2s limbs */ - TMP_FREE; + mpn_toom_interpolate_7pts (pp, n, 0, vm2, vm1, v2, vh, 2*s, tp); } diff --git a/contrib/gmp/mpn/generic/toom52_mul.c b/contrib/gmp/mpn/generic/toom52_mul.c new file mode 100644 index 0000000000..21040fdbd4 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom52_mul.c @@ -0,0 +1,246 @@ +/* mpn_toom52_mul -- Multiply {ap,an} and {bp,bn} where an is nominally 4/3 + times as large as bn. Or more accurately, bn < an < 2 bn. + + Contributed to the GNU project by Marco Bodrato. + + The idea of applying toom to unbalanced multiplication is due to Marco + Bodrato and Alberto Zanoni. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Evaluate in: -2, -1, 0, +1, +2, +inf + + <-s-><--n--><--n--><--n--><--n--> + ___ ______ ______ ______ ______ + |a4_|___a3_|___a2_|___a1_|___a0_| + |b1|___b0_| + <--n--> + + v0 = a0 * b0 # A(0)*B(0) + v1 = (a0+ a1+ a2+ a3+ a4)*(b0+ b1) # A(1)*B(1) ah <= 4 bh <= 1 + vm1 = (a0- a1+ a2- a3+ a4)*(b0- b1) # A(-1)*B(-1) |ah| <= 2 bh = 0 + v2 = (a0+2a1+4a2+8a3+16a4)*(b0+2b1) # A(2)*B(2) ah <= 30 bh <= 2 + vm2 = (a0-2a1+4a2-8a3+16a4)*(b0-2b1) # A(-2)*B(-2) |ah| <= 20 |bh|<= 1 + vinf= a4 * b1 # A(inf)*B(inf) + + Some slight optimization in evaluation are taken from the paper: + "Towards Optimal Toom-Cook Multiplication for Univariate and + Multivariate Polynomials in Characteristic 2 and 0." +*/ + +void +mpn_toom52_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn, mp_ptr scratch) +{ + mp_size_t n, s, t; + enum toom6_flags flags; + +#define a0 ap +#define a1 (ap + n) +#define a2 (ap + 2 * n) +#define a3 (ap + 3 * n) +#define a4 (ap + 4 * n) +#define b0 bp +#define b1 (bp + n) + + n = 1 + (2 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) >> 1); + + s = an - 4 * n; + t = bn - n; + + ASSERT (0 < s && s <= n); + ASSERT (0 < t && t <= n); + + /* Ensures that 5 values of n+1 limbs each fits in the product area. + Borderline cases are an = 32, bn = 8, n = 7, and an = 36, bn = 9, + n = 8. */ + ASSERT (s+t >= 5); + +#define v0 pp /* 2n */ +#define vm1 (scratch) /* 2n+1 */ +#define v1 (pp + 2 * n) /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define v2 (scratch + 4 * n + 2) /* 2n+1 */ +#define vinf (pp + 5 * n) /* s+t */ +#define bs1 pp /* n+1 */ +#define bsm1 (scratch + 2 * n + 2) /* n */ +#define asm1 (scratch + 3 * n + 3) /* n+1 */ +#define asm2 (scratch + 4 * n + 4) /* n+1 */ +#define bsm2 (pp + n + 1) /* n+1 */ +#define bs2 (pp + 2 * n + 2) /* n+1 */ +#define as2 (pp + 3 * n + 3) /* n+1 */ +#define as1 (pp + 4 * n + 4) /* n+1 */ + + /* Scratch need is 6 * n + 3 + 1. We need one extra limb, because + products will overwrite 2n+2 limbs. */ + +#define a0a2 scratch +#define a1a3 asm1 + + /* Compute as2 and asm2. */ + flags = toom6_vm2_neg & mpn_toom_eval_pm2 (as2, asm2, 4, ap, n, s, a1a3); + + /* Compute bs1 and bsm1. */ + if (t == n) + { +#if HAVE_NATIVE_mpn_add_n_sub_n + mp_limb_t cy; + + if (mpn_cmp (b0, b1, n) < 0) + { + cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n); + flags ^= toom6_vm1_neg; + } + else + { + cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n); + } + bs1[n] = cy >> 1; +#else + bs1[n] = mpn_add_n (bs1, b0, b1, n); + if (mpn_cmp (b0, b1, n) < 0) + { + mpn_sub_n (bsm1, b1, b0, n); + flags ^= toom6_vm1_neg; + } + else + { + mpn_sub_n (bsm1, b0, b1, n); + } +#endif + } + else + { + bs1[n] = mpn_add (bs1, b0, n, b1, t); + if (mpn_zero_p (b0 + t, n - t) && mpn_cmp (b0, b1, t) < 0) + { + mpn_sub_n (bsm1, b1, b0, t); + MPN_ZERO (bsm1 + t, n - t); + flags ^= toom6_vm1_neg; + } + else + { + mpn_sub (bsm1, b0, n, b1, t); + } + } + + /* Compute bs2 and bsm2, recycling bs1 and bsm1. bs2=bs1+b1; bsm2=bsm1-b1 */ + mpn_add (bs2, bs1, n+1, b1, t); + if (flags & toom6_vm1_neg ) + { + bsm2[n] = mpn_add (bsm2, bsm1, n, b1, t); + flags ^= toom6_vm2_neg; + } + else + { + bsm2[n] = 0; + if (t == n) + { + if (mpn_cmp (bsm1, b1, n) < 0) + { + mpn_sub_n (bsm2, b1, bsm1, n); + flags ^= toom6_vm2_neg; + } + else + { + mpn_sub_n (bsm2, bsm1, b1, n); + } + } + else + { + if (mpn_zero_p (bsm1 + t, n - t) && mpn_cmp (bsm1, b1, t) < 0) + { + mpn_sub_n (bsm2, b1, bsm1, t); + MPN_ZERO (bsm2 + t, n - t); + flags ^= toom6_vm2_neg; + } + else + { + mpn_sub (bsm2, bsm1, n, b1, t); + } + } + } + + /* Compute as1 and asm1. */ + flags ^= toom6_vm1_neg & mpn_toom_eval_pm1 (as1, asm1, 4, ap, n, s, a0a2); + + ASSERT (as1[n] <= 4); + ASSERT (bs1[n] <= 1); + ASSERT (asm1[n] <= 2); +/* ASSERT (bsm1[n] <= 1); */ + ASSERT (as2[n] <=30); + ASSERT (bs2[n] <= 2); + ASSERT (asm2[n] <= 20); + ASSERT (bsm2[n] <= 1); + + /* vm1, 2n+1 limbs */ + mpn_mul (vm1, asm1, n+1, bsm1, n); /* W4 */ + + /* vm2, 2n+1 limbs */ + mpn_mul_n (vm2, asm2, bsm2, n+1); /* W2 */ + + /* v2, 2n+1 limbs */ + mpn_mul_n (v2, as2, bs2, n+1); /* W1 */ + + /* v1, 2n+1 limbs */ + mpn_mul_n (v1, as1, bs1, n+1); /* W3 */ + + /* vinf, s+t limbs */ /* W0 */ + if (s > t) mpn_mul (vinf, a4, s, b1, t); + else mpn_mul (vinf, b1, t, a4, s); + + /* v0, 2n limbs */ + mpn_mul_n (v0, ap, bp, n); /* W5 */ + + mpn_toom_interpolate_6pts (pp, n, flags, vm1, vm2, v2, t + s); + +#undef v0 +#undef vm1 +#undef v1 +#undef vm2 +#undef v2 +#undef vinf +#undef bs1 +#undef bs2 +#undef bsm1 +#undef bsm2 +#undef asm1 +#undef asm2 +#undef as1 +#undef as2 +#undef a0a2 +#undef b0b2 +#undef a1a3 +#undef a0 +#undef a1 +#undef a2 +#undef a3 +#undef b0 +#undef b1 +#undef b2 + +} diff --git a/contrib/gmp/mpn/generic/toom53_mul.c b/contrib/gmp/mpn/generic/toom53_mul.c index 4483d4dfb7..8a0807a4c6 100644 --- a/contrib/gmp/mpn/generic/toom53_mul.c +++ b/contrib/gmp/mpn/generic/toom53_mul.c @@ -28,17 +28,10 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch allocation. -*/ - #include "gmp.h" #include "gmp-impl.h" -/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf +/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf <-s-><--n--><--n--><--n--><--n--> ___ ______ ______ ______ ______ @@ -50,8 +43,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ v1 = ( a0+ a1+ a2+ a3+ a4)*( b0+ b1+ b2) # A(1)*B(1) ah <= 4 bh <= 2 vm1 = ( a0- a1+ a2- a3+ a4)*( b0- b1+ b2) # A(-1)*B(-1) |ah| <= 2 bh <= 1 v2 = ( a0+2a1+4a2+8a3+16a4)*( b0+2b1+4b2) # A(2)*B(2) ah <= 30 bh <= 6 + vm2 = ( a0-2a1+4a2-8a3+16a4)*( b0-2b1+4b2) # A(2)*B(2) -9<=ah<=20 -1<=bh<=4 vh = (16a0+8a1+4a2+2a3+ a4)*(4b0+2b1+ b2) # A(1/2)*B(1/2) ah <= 30 bh <= 6 - vmh = (16a0-8a1+4a2-2a3+ a4)*(4b0-2b1+ b2) # A(-1/2)*B(-1/2) -9<=ah<=20 -1<=bh<=4 vinf= a4 * b2 # A(inf)*B(inf) */ @@ -62,12 +55,11 @@ mpn_toom53_mul (mp_ptr pp, mp_ptr scratch) { mp_size_t n, s, t; - int vm1_neg, vmh_neg; mp_limb_t cy; - mp_ptr gp, hp; - mp_ptr as1, asm1, as2, ash, asmh; - mp_ptr bs1, bsm1, bs2, bsh, bsmh; - enum toom4_flags flags; + mp_ptr gp; + mp_ptr as1, asm1, as2, asm2, ash; + mp_ptr bs1, bsm1, bs2, bsm2, bsh; + enum toom7_flags flags; TMP_DECL; #define a0 ap @@ -92,124 +84,61 @@ mpn_toom53_mul (mp_ptr pp, as1 = TMP_SALLOC_LIMBS (n + 1); asm1 = TMP_SALLOC_LIMBS (n + 1); as2 = TMP_SALLOC_LIMBS (n + 1); + asm2 = TMP_SALLOC_LIMBS (n + 1); ash = TMP_SALLOC_LIMBS (n + 1); - asmh = TMP_SALLOC_LIMBS (n + 1); bs1 = TMP_SALLOC_LIMBS (n + 1); bsm1 = TMP_SALLOC_LIMBS (n + 1); bs2 = TMP_SALLOC_LIMBS (n + 1); + bsm2 = TMP_SALLOC_LIMBS (n + 1); bsh = TMP_SALLOC_LIMBS (n + 1); - bsmh = TMP_SALLOC_LIMBS (n + 1); gp = pp; - hp = pp + n + 1; /* Compute as1 and asm1. */ - gp[n] = mpn_add_n (gp, a0, a2, n); - gp[n] += mpn_add (gp, gp, n, a4, s); - hp[n] = mpn_add_n (hp, a1, a3, n); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_addsub_n (as1, asm1, hp, gp, n + 1); - vm1_neg = 1; - } - else - { - mpn_addsub_n (as1, asm1, gp, hp, n + 1); - vm1_neg = 0; - } -#else - mpn_add_n (as1, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asm1, hp, gp, n + 1); - vm1_neg = 1; - } - else - { - mpn_sub_n (asm1, gp, hp, n + 1); - vm1_neg = 0; - } -#endif + flags = toom7_w3_neg & mpn_toom_eval_pm1 (as1, asm1, 4, ap, n, s, gp); - /* Compute as2. */ -#if !HAVE_NATIVE_mpn_addlsh_n - ash[n] = mpn_lshift (ash, a2, n, 2); /* 4a2 */ -#endif -#if HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (as2, a3, a4, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a3 + s, n - s, cy); - cy = 2 * cy + mpn_addlsh1_n (as2, a2, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n); - as2[n] = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); -#else - cy = mpn_lshift (as2, a4, s, 1); - cy += mpn_add_n (as2, a3, as2, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a3 + s, n - s, cy); - cy = 4 * cy + mpn_lshift (as2, as2, n, 2); - cy += mpn_add_n (as2, a1, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - as2[n] = cy + mpn_add_n (as2, a0, as2, n); - mpn_add_n (as2, ash, as2, n + 1); -#endif + /* Compute as2 and asm2. */ + flags |= toom7_w1_neg & mpn_toom_eval_pm2 (as2, asm2, 4, ap, n, s, gp); - /* Compute ash and asmh. */ -#if HAVE_NATIVE_mpn_addlsh_n - cy = mpn_addlsh_n (gp, a2, a0, n, 2); /* 4a0 + a2 */ - cy = 4 * cy + mpn_addlsh_n (gp, a4, gp, n, 2); /* 16a0 + 4a2 + a4 */ /* FIXME s */ - gp[n] = cy; - cy = mpn_addlsh_n (hp, a3, a1, n, 2); /* 4a1 + a3 */ - cy = 2 * cy + mpn_lshift (hp, hp, n, 1); /* 8a1 + 2a3 */ - hp[n] = cy; -#else - gp[n] = mpn_lshift (gp, a0, n, 4); /* 16a0 */ - mpn_add (gp, gp, n + 1, a4, s); /* 16a0 + a4 */ - mpn_add_n (gp, ash, gp, n+1); /* 16a0 + 4a2 + a4 */ - cy = mpn_lshift (hp, a1, n, 3); /* 8a1 */ - cy += mpn_lshift (ash, a3, n, 1); /* 2a3 */ - cy += mpn_add_n (hp, ash, hp, n); /* 8a1 + 2a3 */ - hp[n] = cy; -#endif -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) + /* Compute ash = 16 a0 + 8 a1 + 4 a2 + 2 a3 + a4 + = 2*(2*(2*(2*a0 + a1) + a2) + a3) + a4 */ +#if HAVE_NATIVE_mpn_addlsh1_n + cy = mpn_addlsh1_n (ash, a1, a0, n); + cy = 2*cy + mpn_addlsh1_n (ash, a2, ash, n); + cy = 2*cy + mpn_addlsh1_n (ash, a3, ash, n); + if (s < n) { - mpn_addsub_n (ash, asmh, hp, gp, n + 1); - vmh_neg = 1; + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (ash, a4, ash, s); + ash[n] = 2*cy + mpn_lshift (ash + s, ash + s, n - s, 1); + MPN_INCR_U (ash + s, n+1-s, cy2); } else - { - mpn_addsub_n (ash, asmh, gp, hp, n + 1); - vmh_neg = 0; - } + ash[n] = 2*cy + mpn_addlsh1_n (ash, a4, ash, n); #else - mpn_add_n (ash, gp, hp, n + 1); - if (mpn_cmp (gp, hp, n + 1) < 0) - { - mpn_sub_n (asmh, hp, gp, n + 1); - vmh_neg = 1; - } - else - { - mpn_sub_n (asmh, gp, hp, n + 1); - vmh_neg = 0; - } + cy = mpn_lshift (ash, a0, n, 1); + cy += mpn_add_n (ash, ash, a1, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + cy += mpn_add_n (ash, ash, a2, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + cy += mpn_add_n (ash, ash, a3, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + ash[n] = cy + mpn_add (ash, ash, n, a4, s); #endif /* Compute bs1 and bsm1. */ bs1[n] = mpn_add (bs1, b0, n, b2, t); /* b0 + b2 */ -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (bs1[n] == 0 && mpn_cmp (bs1, b1, n) < 0) { - bs1[n] = mpn_addsub_n (bs1, bsm1, b1, bs1, n) >> 1; + bs1[n] = mpn_add_n_sub_n (bs1, bsm1, b1, bs1, n) >> 1; bsm1[n] = 0; - vm1_neg ^= 1; + flags ^= toom7_w3_neg; } else { - cy = mpn_addsub_n (bs1, bsm1, bs1, b1, n); + cy = mpn_add_n_sub_n (bs1, bsm1, bs1, b1, n); bsm1[n] = bs1[n] - (cy & 1); bs1[n] += (cy >> 1); } @@ -218,7 +147,7 @@ mpn_toom53_mul (mp_ptr pp, { mpn_sub_n (bsm1, b1, bs1, n); bsm1[n] = 0; - vm1_neg ^= 1; + flags ^= toom7_w3_neg; } else { @@ -227,46 +156,64 @@ mpn_toom53_mul (mp_ptr pp, bs1[n] += mpn_add_n (bs1, bs1, b1, n); /* b0+b1+b2 */ #endif - /* Compute bs2 */ - hp[n] = mpn_lshift (hp, b1, n, 1); /* 2b1 */ - -#ifdef HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (bs2, b1, b2, t); - if (t != n) - cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy); - bs2[n] = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n); -#else - bs2[t] = mpn_lshift (bs2, b2, t, 2); - mpn_add (bs2, hp, n + 1, bs2, t + 1); - bs2[n] += mpn_add_n (bs2, bs2, b0, n); + /* Compute bs2 and bsm2. */ +#if HAVE_NATIVE_mpn_addlsh_n || HAVE_NATIVE_mpn_addlsh2_n +#if HAVE_NATIVE_mpn_addlsh2_n + cy = mpn_addlsh2_n (bs2, b0, b2, t); +#else /* HAVE_NATIVE_mpn_addlsh_n */ + cy = mpn_addlsh_n (bs2, b0, b2, t, 2); #endif - - /* Compute bsh and bsmh. */ -#if HAVE_NATIVE_mpn_addlsh_n - gp[n] = mpn_addlsh_n (gp, b2, b0, n, 2); /* 4a0 + a2 */ + if (t < n) + cy = mpn_add_1 (bs2 + t, b0 + t, n - t, cy); + bs2[n] = cy; #else - cy = mpn_lshift (gp, b0, n, 2); /* 4b0 */ - gp[n] = cy + mpn_add (gp, gp, n, b2, t); /* 4b0 + b2 */ + cy = mpn_lshift (gp, b2, t, 2); + bs2[n] = mpn_add (bs2, b0, n, gp, t); + MPN_INCR_U (bs2 + t, n+1-t, cy); #endif -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (gp, hp, n + 1) < 0) + + gp[n] = mpn_lshift (gp, b1, n, 1); + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (mpn_cmp (bs2, gp, n+1) < 0) { - mpn_addsub_n (bsh, bsmh, hp, gp, n + 1); - vmh_neg^= 1; + ASSERT_NOCARRY (mpn_add_n_sub_n (bs2, bsm2, gp, bs2, n+1)); + flags ^= toom7_w1_neg; } else - mpn_addsub_n (bsh, bsmh, gp, hp, n + 1); + { + ASSERT_NOCARRY (mpn_add_n_sub_n (bs2, bsm2, bs2, gp, n+1)); + } #else - mpn_add_n (bsh, gp, hp, n + 1); /* 4b0 + 2b1 + b2 */ - if (mpn_cmp (gp, hp, n + 1) < 0) + if (mpn_cmp (bs2, gp, n+1) < 0) { - mpn_sub_n (bsmh, hp, gp, n + 1); - vmh_neg ^= 1; + ASSERT_NOCARRY (mpn_sub_n (bsm2, gp, bs2, n+1)); + flags ^= toom7_w1_neg; } else { - mpn_sub_n (bsmh, gp, hp, n + 1); + ASSERT_NOCARRY (mpn_sub_n (bsm2, bs2, gp, n+1)); } + mpn_add_n (bs2, bs2, gp, n+1); +#endif + + /* Compute bsh = 4 b0 + 2 b1 + b0 = 2*(2*b0 + b1)+b0. */ +#if HAVE_NATIVE_mpn_addlsh1_n + cy = mpn_addlsh1_n (bsh, b1, b0, n); + if (t < n) + { + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (bsh, b2, bsh, t); + bsh[n] = 2*cy + mpn_lshift (bsh + t, bsh + t, n - t, 1); + MPN_INCR_U (bsh + t, n+1-t, cy2); + } + else + bsh[n] = 2*cy + mpn_addlsh1_n (bsh, b2, bsh, n); +#else + cy = mpn_lshift (bsh, b0, n, 1); + cy += mpn_add_n (bsh, bsh, b1, n); + cy = 2*cy + mpn_lshift (bsh, bsh, n, 1); + bsh[n] = cy + mpn_add (bsh, bsh, n, b2, t); #endif ASSERT (as1[n] <= 4); @@ -275,18 +222,26 @@ mpn_toom53_mul (mp_ptr pp, ASSERT (bsm1[n] <= 1); ASSERT (as2[n] <= 30); ASSERT (bs2[n] <= 6); + ASSERT (asm2[n] <= 20); + ASSERT (bsm2[n] <= 4); ASSERT (ash[n] <= 30); ASSERT (bsh[n] <= 6); - ASSERT (asmh[n] <= 20); - ASSERT (bsmh[n] <= 4); #define v0 pp /* 2n */ -#define v1 (scratch + 6 * n + 6) /* 2n+1 */ -#define vm1 scratch /* 2n+1 */ -#define v2 (scratch + 2 * n + 2) /* 2n+1 */ +#define v1 (pp + 2 * n) /* 2n+1 */ #define vinf (pp + 6 * n) /* s+t */ -#define vh (pp + 2 * n) /* 2n+1 */ -#define vmh (scratch + 4 * n + 4) +#define v2 scratch /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define vh (scratch + 4 * n + 2) /* 2n+1 */ +#define vm1 (scratch + 6 * n + 3) /* 2n+1 */ +#define scratch_out (scratch + 8 * n + 4) /* 2n+1 */ + /* Total scratch need: 10*n+5 */ + + /* Must be in allocation order, as they overwrite one limb beyond + * 2n+1. */ + mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */ + mpn_mul_n (vm2, asm2, bsm2, n + 1); /* vm2, 2n+1 limbs */ + mpn_mul_n (vh, ash, bsh, n + 1); /* vh, 2n+1 limbs */ /* vm1, 2n+1 limbs */ #ifdef SMALLER_RECURSION @@ -313,12 +268,6 @@ mpn_toom53_mul (mp_ptr pp, mpn_mul_n (vm1, asm1, bsm1, n + ((asm1[n] | bsm1[n]) != 0)); #endif /* SMALLER_RECURSION */ - mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */ - - /* vinf, s+t limbs */ - if (s > t) mpn_mul (vinf, a4, s, b2, t); - else mpn_mul (vinf, b2, t, a4, s); - /* v1, 2n+1 limbs */ #ifdef SMALLER_RECURSION mpn_mul_n (v1, as1, bs1, n); @@ -358,16 +307,14 @@ mpn_toom53_mul (mp_ptr pp, mpn_mul_n (v1, as1, bs1, n + ((as1[n] | bs1[n]) != 0)); #endif /* SMALLER_RECURSION */ - mpn_mul_n (vh, ash, bsh, n + 1); - - mpn_mul_n (vmh, asmh, bsmh, n + 1); - - mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */ + mpn_mul_n (v0, a0, b0, n); /* v0, 2n limbs */ - flags = vm1_neg ? toom4_w3_neg : 0; - flags |= vmh_neg ? toom4_w1_neg : 0; + /* vinf, s+t limbs */ + if (s > t) mpn_mul (vinf, a4, s, b2, t); + else mpn_mul (vinf, b2, t, a4, s); - mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch + 8 * n + 8); + mpn_toom_interpolate_7pts (pp, n, flags, vm2, vm1, v2, vh, s + t, + scratch_out); TMP_FREE; } diff --git a/contrib/gmp/mpn/generic/toom62_mul.c b/contrib/gmp/mpn/generic/toom62_mul.c index 944b3feffd..c01cfba2c7 100644 --- a/contrib/gmp/mpn/generic/toom62_mul.c +++ b/contrib/gmp/mpn/generic/toom62_mul.c @@ -28,20 +28,13 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - Things to work on: - - 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be - avoided by instead reusing the pp area and the scratch allocation. -*/ - #include "gmp.h" #include "gmp-impl.h" +/* Evaluate in: + 0, +1, -1, +2, -2, 1/2, +inf -/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf - - <-s-><--n--><--n--><--n--> + <-s-><--n--><--n--><--n--><--n--><--n--> ___ ______ ______ ______ ______ ______ |a5_|___a4_|___a3_|___a2_|___a1_|___a0_| |_b1_|___b0_| @@ -51,8 +44,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ v1 = ( a0+ a1+ a2+ a3+ a4+ a5)*( b0+ b1) # A(1)*B(1) ah <= 5 bh <= 1 vm1 = ( a0- a1+ a2- a3+ a4- a5)*( b0- b1) # A(-1)*B(-1) |ah| <= 2 bh = 0 v2 = ( a0+ 2a1+4a2+8a3+16a4+32a5)*( b0+2b1) # A(2)*B(2) ah <= 62 bh <= 2 + vm2 = ( a0- 2a1+4a2-8a3+16a4-32a5)*( b0-2b1) # A(-2)*B(-2) -41<=ah<=20 -1<=bh<=0 vh = (32a0+16a1+8a2+4a3+ 2a4+ a5)*(2b0+ b1) # A(1/2)*B(1/2) ah <= 62 bh <= 2 - vmh = (32a0-16a1+8a2-4a3+ 2a4- a5)*(2b0- b1) # A(-1/2)*B(-1/2) -20<=ah<=41 0<=bh<=1 vinf= a5 * b1 # A(inf)*B(inf) */ @@ -63,12 +56,11 @@ mpn_toom62_mul (mp_ptr pp, mp_ptr scratch) { mp_size_t n, s, t; - int vm1_neg, vmh_neg, bsm_neg; mp_limb_t cy; - mp_ptr a0_a2, a1_a3; - mp_ptr as1, asm1, as2, ash, asmh; - mp_ptr bs1, bsm1, bs2, bsh, bsmh; - enum toom4_flags flags; + mp_ptr as1, asm1, as2, asm2, ash; + mp_ptr bs1, bsm1, bs2, bsm2, bsh; + mp_ptr gp; + enum toom7_flags aflags, bflags; TMP_DECL; #define a0 ap @@ -80,7 +72,7 @@ mpn_toom62_mul (mp_ptr pp, #define b0 bp #define b1 (bp + n) - n = 1 + (an >= 3 * bn ? (an - 1) / (unsigned long) 6 : (bn - 1) >> 1); + n = 1 + (an >= 3 * bn ? (an - 1) / (size_t) 6 : (bn - 1) >> 1); s = an - 5 * n; t = bn - n; @@ -93,133 +85,66 @@ mpn_toom62_mul (mp_ptr pp, as1 = TMP_SALLOC_LIMBS (n + 1); asm1 = TMP_SALLOC_LIMBS (n + 1); as2 = TMP_SALLOC_LIMBS (n + 1); + asm2 = TMP_SALLOC_LIMBS (n + 1); ash = TMP_SALLOC_LIMBS (n + 1); - asmh = TMP_SALLOC_LIMBS (n + 1); bs1 = TMP_SALLOC_LIMBS (n + 1); bsm1 = TMP_SALLOC_LIMBS (n); bs2 = TMP_SALLOC_LIMBS (n + 1); + bsm2 = TMP_SALLOC_LIMBS (n + 1); bsh = TMP_SALLOC_LIMBS (n + 1); - bsmh = TMP_SALLOC_LIMBS (n + 1); - a0_a2 = pp; - a1_a3 = pp + n + 1; + gp = pp; /* Compute as1 and asm1. */ - a0_a2[n] = mpn_add_n (a0_a2, a0, a2, n); - a0_a2[n] += mpn_add_n (a0_a2, a0_a2, a4, n); - a1_a3[n] = mpn_add_n (a1_a3, a1, a3, n); - a1_a3[n] += mpn_add (a1_a3, a1_a3, n, a5, s); -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) - { - mpn_addsub_n (as1, asm1, a1_a3, a0_a2, n + 1); - vm1_neg = 1; - } - else - { - mpn_addsub_n (as1, asm1, a0_a2, a1_a3, n + 1); - vm1_neg = 0; - } -#else - mpn_add_n (as1, a0_a2, a1_a3, n + 1); - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) - { - mpn_sub_n (asm1, a1_a3, a0_a2, n + 1); - vm1_neg = 1; - } - else - { - mpn_sub_n (asm1, a0_a2, a1_a3, n + 1); - vm1_neg = 0; - } -#endif + aflags = toom7_w3_neg & mpn_toom_eval_pm1 (as1, asm1, 5, ap, n, s, gp); + + /* Compute as2 and asm2. */ + aflags |= toom7_w1_neg & mpn_toom_eval_pm2 (as2, asm2, 5, ap, n, s, gp); + + /* Compute ash = 32 a0 + 16 a1 + 8 a2 + 4 a3 + 2 a4 + a5 + = 2*(2*(2*(2*(2*a0 + a1) + a2) + a3) + a4) + a5 */ - /* Compute as2. */ #if HAVE_NATIVE_mpn_addlsh1_n - cy = mpn_addlsh1_n (as2, a4, a5, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a4 + s, n - s, cy); - cy = 2 * cy + mpn_addlsh1_n (as2, a3, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a2, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n); - cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n); -#else - cy = mpn_lshift (as2, a5, s, 1); - cy += mpn_add_n (as2, a4, as2, s); - if (s != n) - cy = mpn_add_1 (as2 + s, a4 + s, n - s, cy); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a3, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a2, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a1, as2, n); - cy = 2 * cy + mpn_lshift (as2, as2, n, 1); - cy += mpn_add_n (as2, a0, as2, n); -#endif - as2[n] = cy; - - /* Compute ash and asmh. */ -#if HAVE_NATIVE_mpn_addlsh_n - cy = mpn_addlsh_n (a0_a2, a2, a0, n, 2); /* 4a0 + a2 */ - cy = 4 * cy + mpn_addlsh_n (a0_a2, a4, a0_a2, n, 2); /* 16a0 + 4a2 + a4 */ - cy = 2 * cy + mpn_lshift (a0_a2, a0_a2, n, 1); /* 32a0 + 8a2 + 2a4 */ - a0_a2[n] = cy; - cy = mpn_addlsh_n (a1_a3, a3, a1, n, 2); /* 4a1 */ - cy = 4 * cy + mpn_addlsh_n (a1_a3, a5, a1_a3, n, 2); /* 16a1 + 4a3 */ - a1_a3[n] = cy; -#else - cy = mpn_lshift (a0_a2, a0, n, 2); /* 4a0 */ - cy += mpn_add_n (a0_a2, a2, a0_a2, n); /* 4a0 + a2 */ - cy = 4 * cy + mpn_lshift (a0_a2, a0_a2, n, 2); /* 16a0 + 4a2 */ - cy += mpn_add_n (a0_a2, a4, a0_a2, n); /* 16a0 + 4a2 + a4 */ - cy = 2 * cy + mpn_lshift (a0_a2, a0_a2, n, 1); /* 32a0 + 8a2 + 2a4 */ - a0_a2[n] = cy; - cy = mpn_lshift (a1_a3, a1, n, 2); /* 4a1 */ - cy += mpn_add_n (a1_a3, a3, a1_a3, n); /* 4a1 + a3 */ - cy = 4 * cy + mpn_lshift (a1_a3, a1_a3, n, 2); /* 16a1 + 4a3 */ - cy += mpn_add (a1_a3, a1_a3, n, a5, s); /* 16a1 + 4a3 + a5 */ - a1_a3[n] = cy; -#endif -#if HAVE_NATIVE_mpn_addsub_n - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) + cy = mpn_addlsh1_n (ash, a1, a0, n); + cy = 2*cy + mpn_addlsh1_n (ash, a2, ash, n); + cy = 2*cy + mpn_addlsh1_n (ash, a3, ash, n); + cy = 2*cy + mpn_addlsh1_n (ash, a4, ash, n); + if (s < n) { - mpn_addsub_n (ash, asmh, a1_a3, a0_a2, n + 1); - vmh_neg = 1; + mp_limb_t cy2; + cy2 = mpn_addlsh1_n (ash, a5, ash, s); + ash[n] = 2*cy + mpn_lshift (ash + s, ash + s, n - s, 1); + MPN_INCR_U (ash + s, n+1-s, cy2); } else - { - mpn_addsub_n (ash, asmh, a0_a2, a1_a3, n + 1); - vmh_neg = 0; - } + ash[n] = 2*cy + mpn_addlsh1_n (ash, a5, ash, n); #else - mpn_add_n (ash, a0_a2, a1_a3, n + 1); - if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0) - { - mpn_sub_n (asmh, a1_a3, a0_a2, n + 1); - vmh_neg = 1; - } - else - { - mpn_sub_n (asmh, a0_a2, a1_a3, n + 1); - vmh_neg = 0; - } + cy = mpn_lshift (ash, a0, n, 1); + cy += mpn_add_n (ash, ash, a1, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + cy += mpn_add_n (ash, ash, a2, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + cy += mpn_add_n (ash, ash, a3, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + cy += mpn_add_n (ash, ash, a4, n); + cy = 2*cy + mpn_lshift (ash, ash, n, 1); + ash[n] = cy + mpn_add (ash, ash, n, a5, s); #endif /* Compute bs1 and bsm1. */ if (t == n) { -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n if (mpn_cmp (b0, b1, n) < 0) { - cy = mpn_addsub_n (bs1, bsm1, b1, b0, n); - bsm_neg = 1; + cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n); + bflags = toom7_w3_neg; } else { - cy = mpn_addsub_n (bs1, bsm1, b0, b1, n); - bsm_neg = 0; + cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n); + bflags = 0; } bs1[n] = cy >> 1; #else @@ -227,12 +152,12 @@ mpn_toom62_mul (mp_ptr pp, if (mpn_cmp (b0, b1, n) < 0) { mpn_sub_n (bsm1, b1, b0, n); - bsm_neg = 1; + bflags = toom7_w3_neg; } else { mpn_sub_n (bsm1, b0, b1, n); - bsm_neg = 0; + bflags = 0; } #endif } @@ -243,56 +168,83 @@ mpn_toom62_mul (mp_ptr pp, { mpn_sub_n (bsm1, b1, b0, t); MPN_ZERO (bsm1 + t, n - t); - bsm_neg = 1; + bflags = toom7_w3_neg; } else { mpn_sub (bsm1, b0, n, b1, t); - bsm_neg = 0; + bflags = 0; } } - vm1_neg ^= bsm_neg; - - /* Compute bs2, recycling bs1. bs2=bs1+b1 */ + /* Compute bs2 and bsm2. Recycling bs1 and bsm1; bs2=bs1+b1, bsm2 = + bsm1 - b1 */ mpn_add (bs2, bs1, n + 1, b1, t); - - /* Compute bsh and bsmh, recycling bs1 and bsm1. bsh=bs1+b0; bsmh=bsmh+b0 */ - if (bsm_neg == 1) + if (bflags & toom7_w3_neg) { - bsmh[n] = 0; - if (mpn_cmp (bsm1, b0, n) < 0) + bsm2[n] = mpn_add (bsm2, bsm1, n, b1, t); + bflags |= toom7_w1_neg; + } + else + { + /* FIXME: Simplify this logic? */ + if (t < n) { - bsm_neg = 0; - mpn_sub_n (bsmh, b0, bsm1, n); + if (mpn_zero_p (bsm1 + t, n - t) && mpn_cmp (bsm1, b1, t) < 0) + { + ASSERT_NOCARRY (mpn_sub_n (bsm2, b1, bsm1, t)); + MPN_ZERO (bsm2 + t, n + 1 - t); + bflags |= toom7_w1_neg; + } + else + { + ASSERT_NOCARRY (mpn_sub (bsm2, bsm1, n, b1, t)); + bsm2[n] = 0; + } } else - mpn_sub_n (bsmh, bsm1, b0, n); + { + if (mpn_cmp (bsm1, b1, n) < 0) + { + ASSERT_NOCARRY (mpn_sub_n (bsm2, b1, bsm1, n)); + bflags |= toom7_w1_neg; + } + else + { + ASSERT_NOCARRY (mpn_sub (bsm2, bsm1, n, b1, n)); + } + bsm2[n] = 0; + } } - else - bsmh[n] = mpn_add_n (bsmh, bsm1, b0, n); - mpn_add (bsh, bs1, n + 1, b0, n); - vmh_neg ^= bsm_neg; + /* Compute bsh, recycling bs1 and bsm1. bsh=bs1+b0; */ + mpn_add (bsh, bs1, n + 1, b0, n); ASSERT (as1[n] <= 5); ASSERT (bs1[n] <= 1); ASSERT (asm1[n] <= 2); -/*ASSERT (bsm1[n] == 0);*/ ASSERT (as2[n] <= 62); ASSERT (bs2[n] <= 2); + ASSERT (asm2[n] <= 41); + ASSERT (bsm2[n] <= 1); ASSERT (ash[n] <= 62); ASSERT (bsh[n] <= 2); - ASSERT (asmh[n] <= 41); - ASSERT (bsmh[n] <= 1); #define v0 pp /* 2n */ -#define v1 (scratch + 6 * n + 6) /* 2n+1 */ +#define v1 (pp + 2 * n) /* 2n+1 */ #define vinf (pp + 6 * n) /* s+t */ -#define vm1 scratch /* 2n+1 */ -#define v2 (scratch + 2 * n + 2) /* 2n+1 */ -#define vh (pp + 2 * n) /* 2n+1 */ -#define vmh (scratch + 4 * n + 4) +#define v2 scratch /* 2n+1 */ +#define vm2 (scratch + 2 * n + 1) /* 2n+1 */ +#define vh (scratch + 4 * n + 2) /* 2n+1 */ +#define vm1 (scratch + 6 * n + 3) /* 2n+1 */ +#define scratch_out (scratch + 8 * n + 4) /* 2n+1 */ + /* Total scratch need: 10*n+5 */ + + /* Must be in allocation order, as they overwrite one limb beyond + * 2n+1. */ + mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */ + mpn_mul_n (vm2, asm2, bsm2, n + 1); /* vm2, 2n+1 limbs */ + mpn_mul_n (vh, ash, bsh, n + 1); /* vh, 2n+1 limbs */ /* vm1, 2n+1 limbs */ mpn_mul_n (vm1, asm1, bsm1, n); @@ -311,12 +263,6 @@ mpn_toom62_mul (mp_ptr pp, } vm1[2 * n] = cy; - mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */ - - /* vinf, s+t limbs */ - if (s > t) mpn_mul (vinf, a5, s, b1, t); - else mpn_mul (vinf, b1, t, a5, s); - /* v1, 2n+1 limbs */ mpn_mul_n (v1, as1, bs1, n); if (as1[n] == 1) @@ -341,16 +287,14 @@ mpn_toom62_mul (mp_ptr pp, cy += mpn_add_n (v1 + n, v1 + n, as1, n); v1[2 * n] = cy; - mpn_mul_n (vh, ash, bsh, n + 1); - - mpn_mul_n (vmh, asmh, bsmh, n + 1); - - mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */ + mpn_mul_n (v0, a0, b0, n); /* v0, 2n limbs */ - flags = vm1_neg ? toom4_w3_neg : 0; - flags |= vmh_neg ? toom4_w1_neg : 0; + /* vinf, s+t limbs */ + if (s > t) mpn_mul (vinf, a5, s, b1, t); + else mpn_mul (vinf, b1, t, a5, s); - mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch + 8 * n + 8); + mpn_toom_interpolate_7pts (pp, n, aflags ^ bflags, + vm2, vm1, v2, vh, s + t, scratch_out); TMP_FREE; } diff --git a/contrib/gmp/mpn/generic/toom63_mul.c b/contrib/gmp/mpn/generic/toom63_mul.c new file mode 100644 index 0000000000..f4bb3deeac --- /dev/null +++ b/contrib/gmp/mpn/generic/toom63_mul.c @@ -0,0 +1,221 @@ +/* Implementation of the algorithm for Toom-Cook 4.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Stores |{ap,n}-{bp,n}| in {rp,n}, returns the sign. */ +static int +abs_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n) +{ + mp_limb_t x, y; + while (--n >= 0) + { + x = ap[n]; + y = bp[n]; + if (x != y) + { + n++; + if (x > y) + { + mpn_sub_n (rp, ap, bp, n); + return 0; + } + else + { + mpn_sub_n (rp, bp, ap, n); + return ~0; + } + } + rp[n] = 0; + } + return 0; +} + +static int +abs_sub_add_n (mp_ptr rm, mp_ptr rp, mp_srcptr rs, mp_size_t n) { + int result; + result = abs_sub_n (rm, rp, rs, n); + ASSERT_NOCARRY(mpn_add_n (rp, rp, rs, n)); + return result; +} + + +/* Toom-4.5, the splitting 6x3 unbalanced version. + Evaluate in: infinity, +4, -4, +2, -2, +1, -1, 0. + + <--s-><--n--><--n--><--n--><--n--><--n--> + ____ ______ ______ ______ ______ ______ + |_a5_|__a4__|__a3__|__a2__|__a1__|__a0__| + |b2_|__b1__|__b0__| + <-t-><--n--><--n--> + +*/ +#define TOOM_63_MUL_N_REC(p, a, b, n, ws) \ + do { mpn_mul_n (p, a, b, n); \ + } while (0) + +#define TOOM_63_MUL_REC(p, a, na, b, nb, ws) \ + do { mpn_mul (p, a, na, b, nb); \ + } while (0) + +void +mpn_toom63_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn, mp_ptr scratch) +{ + mp_size_t n, s, t; + mp_limb_t cy; + int sign; + + /***************************** decomposition *******************************/ +#define a5 (ap + 5 * n) +#define b0 (bp + 0 * n) +#define b1 (bp + 1 * n) +#define b2 (bp + 2 * n) + + ASSERT (an >= bn); + n = 1 + (an >= 2 * bn ? (an - 1) / (size_t) 6 : (bn - 1) / (size_t) 3); + + s = an - 5 * n; + t = bn - 2 * n; + + ASSERT (0 < s && s <= n); + ASSERT (0 < t && t <= n); + /* WARNING! it assumes s+t>n */ + ASSERT ( s + t > n ); + ASSERT ( s + t > 4); + /* WARNING! it assumes n>1 */ + ASSERT ( n > 2); + +#define r8 pp /* 2n */ +#define r7 scratch /* 3n+1 */ +#define r5 (pp + 3*n) /* 3n+1 */ +#define v0 (pp + 3*n) /* n+1 */ +#define v1 (pp + 4*n+1) /* n+1 */ +#define v2 (pp + 5*n+2) /* n+1 */ +#define v3 (pp + 6*n+3) /* n+1 */ +#define r3 (scratch + 3 * n + 1) /* 3n+1 */ +#define r1 (pp + 7*n) /* s+t <= 2*n */ +#define ws (scratch + 6 * n + 2) /* ??? */ + + /* Alloc also 3n+1 limbs for ws... mpn_toom_interpolate_8pts may + need all of them, when DO_mpn_sublsh_n usea a scratch */ +/* if (scratch == NULL) scratch = TMP_SALLOC_LIMBS (9 * n + 3); */ + + /********************** evaluation and recursive calls *********************/ + /* $\pm4$ */ + sign = mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp); + pp[n] = mpn_lshift (pp, b1, n, 2); /* 4b1 */ + /* FIXME: use addlsh */ + v3[t] = mpn_lshift (v3, b2, t, 4);/* 16b2 */ + if ( n == t ) + v3[n]+= mpn_add_n (v3, v3, b0, n); /* 16b2+b0 */ + else + v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 16b2+b0 */ + sign ^= abs_sub_add_n (v1, v3, pp, n + 1); + TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-4)*B(-4) */ + TOOM_63_MUL_N_REC(r3, v2, v3, n + 1, ws); /* A(+4)*B(+4) */ + mpn_toom_couple_handling (r3, 2*n+1, pp, sign, n, 2, 4); + + /* $\pm1$ */ + sign = mpn_toom_eval_pm1 (v2, v0, 5, ap, n, s, pp); + /* Compute bs1 and bsm1. Code taken from toom33 */ + cy = mpn_add (ws, b0, n, b2, t); +#if HAVE_NATIVE_mpn_add_n_sub_n + if (cy == 0 && mpn_cmp (ws, b1, n) < 0) + { + cy = mpn_add_n_sub_n (v3, v1, b1, ws, n); + v3[n] = cy >> 1; + v1[n] = 0; + sign = ~sign; + } + else + { + mp_limb_t cy2; + cy2 = mpn_add_n_sub_n (v3, v1, ws, b1, n); + v3[n] = cy + (cy2 >> 1); + v1[n] = cy - (cy2 & 1); + } +#else + v3[n] = cy + mpn_add_n (v3, ws, b1, n); + if (cy == 0 && mpn_cmp (ws, b1, n) < 0) + { + mpn_sub_n (v1, b1, ws, n); + v1[n] = 0; + sign = ~sign; + } + else + { + cy -= mpn_sub_n (v1, ws, b1, n); + v1[n] = cy; + } +#endif + TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-1)*B(-1) */ + TOOM_63_MUL_N_REC(r7, v2, v3, n + 1, ws); /* A(1)*B(1) */ + mpn_toom_couple_handling (r7, 2*n+1, pp, sign, n, 0, 0); + + /* $\pm2$ */ + sign = mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp); + pp[n] = mpn_lshift (pp, b1, n, 1); /* 2b1 */ + /* FIXME: use addlsh or addlsh2 */ + v3[t] = mpn_lshift (v3, b2, t, 2);/* 4b2 */ + if ( n == t ) + v3[n]+= mpn_add_n (v3, v3, b0, n); /* 4b2+b0 */ + else + v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 4b2+b0 */ + sign ^= abs_sub_add_n (v1, v3, pp, n + 1); + TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-2)*B(-2) */ + TOOM_63_MUL_N_REC(r5, v2, v3, n + 1, ws); /* A(+2)*B(+2) */ + mpn_toom_couple_handling (r5, 2*n+1, pp, sign, n, 1, 2); + + /* A(0)*B(0) */ + TOOM_63_MUL_N_REC(pp, ap, bp, n, ws); + + /* Infinity */ + if (s > t) { + TOOM_63_MUL_REC(r1, a5, s, b2, t, ws); + } else { + TOOM_63_MUL_REC(r1, b2, t, a5, s, ws); + }; + + mpn_toom_interpolate_8pts (pp, n, r3, r7, s + t, ws); + +#undef a5 +#undef b0 +#undef b1 +#undef b2 +#undef r1 +#undef r3 +#undef r5 +#undef v0 +#undef v1 +#undef v2 +#undef v3 +#undef r7 +#undef r8 +#undef ws +} diff --git a/contrib/gmp/mpn/generic/toom6_sqr.c b/contrib/gmp/mpn/generic/toom6_sqr.c new file mode 100644 index 0000000000..9fd3a56d6a --- /dev/null +++ b/contrib/gmp/mpn/generic/toom6_sqr.c @@ -0,0 +1,171 @@ +/* Implementation of the squaring algorithm with Toom-Cook 6.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + + +#if GMP_NUMB_BITS < 21 +#error Not implemented. +#endif + + +#if TUNE_PROGRAM_BUILD +#define MAYBE_sqr_basecase 1 +#define MAYBE_sqr_above_basecase 1 +#define MAYBE_sqr_toom2 1 +#define MAYBE_sqr_above_toom2 1 +#define MAYBE_sqr_toom3 1 +#define MAYBE_sqr_above_toom3 1 +#define MAYBE_sqr_above_toom4 1 +#else +#ifdef SQR_TOOM8_THRESHOLD +#define SQR_TOOM6_MAX ((SQR_TOOM8_THRESHOLD+6*2-1+5)/6) +#else +#define SQR_TOOM6_MAX \ + ((SQR_FFT_THRESHOLD <= MP_SIZE_T_MAX - (6*2-1+5)) ? \ + ((SQR_FFT_THRESHOLD+6*2-1+5)/6) \ + : MP_SIZE_T_MAX ) +#endif +#define MAYBE_sqr_basecase \ + (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM2_THRESHOLD) +#define MAYBE_sqr_above_basecase \ + (SQR_TOOM6_MAX >= SQR_TOOM2_THRESHOLD) +#define MAYBE_sqr_toom2 \ + (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM3_THRESHOLD) +#define MAYBE_sqr_above_toom2 \ + (SQR_TOOM6_MAX >= SQR_TOOM3_THRESHOLD) +#define MAYBE_sqr_toom3 \ + (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM4_THRESHOLD) +#define MAYBE_sqr_above_toom3 \ + (SQR_TOOM6_MAX >= SQR_TOOM4_THRESHOLD) +#define MAYBE_sqr_above_toom4 \ + (SQR_TOOM6_MAX >= SQR_TOOM6_THRESHOLD) +#endif + +#define TOOM6_SQR_REC(p, a, n, ws) \ + do { \ + if (MAYBE_sqr_basecase && ( !MAYBE_sqr_above_basecase \ + || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))) \ + mpn_sqr_basecase (p, a, n); \ + else if (MAYBE_sqr_toom2 && ( !MAYBE_sqr_above_toom2 \ + || BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))) \ + mpn_toom2_sqr (p, a, n, ws); \ + else if (MAYBE_sqr_toom3 && ( !MAYBE_sqr_above_toom3 \ + || BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))) \ + mpn_toom3_sqr (p, a, n, ws); \ + else if (! MAYBE_sqr_above_toom4 \ + || BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD)) \ + mpn_toom4_sqr (p, a, n, ws); \ + else \ + mpn_toom6_sqr (p, a, n, ws); \ + } while (0) + +void +mpn_toom6_sqr (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch) +{ + mp_size_t n, s; + + /***************************** decomposition *******************************/ + + ASSERT( an >= 18 ); + + n = 1 + (an - 1) / (size_t) 6; + + s = an - 5 * n; + + ASSERT (0 < s && s <= n); + +#define r4 (pp + 3 * n) /* 3n+1 */ +#define r2 (pp + 7 * n) /* 3n+1 */ +#define r0 (pp +11 * n) /* s+t <= 2*n */ +#define r5 (scratch) /* 3n+1 */ +#define r3 (scratch + 3 * n + 1) /* 3n+1 */ +#define r1 (scratch + 6 * n + 2) /* 3n+1 */ +#define v0 (pp + 7 * n) /* n+1 */ +#define v2 (pp + 9 * n+2) /* n+1 */ +#define wse (scratch + 9 * n + 3) /* 3n+1 */ + + /* Alloc also 3n+1 limbs for ws... toom_interpolate_12pts may + need all of them, when DO_mpn_sublsh_n usea a scratch */ +/* if (scratch== NULL) */ +/* scratch = TMP_SALLOC_LIMBS (12 * n + 6); */ + + /********************** evaluation and recursive calls *********************/ + /* $\pm1/2$ */ + mpn_toom_eval_pm2rexp (v2, v0, 5, ap, n, s, 1, pp); + TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */ + TOOM6_SQR_REC(r5, v2, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */ + mpn_toom_couple_handling (r5, 2 * n + 1, pp, 0, n, 1, 0); + + /* $\pm1$ */ + mpn_toom_eval_pm1 (v2, v0, 5, ap, n, s, pp); + TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1)*B(-1) */ + TOOM6_SQR_REC(r3, v2, n + 1, wse); /* A(1)*B(1) */ + mpn_toom_couple_handling (r3, 2 * n + 1, pp, 0, n, 0, 0); + + /* $\pm4$ */ + mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp); + TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-4)*B(-4) */ + TOOM6_SQR_REC(r1, v2, n + 1, wse); /* A(+4)*B(+4) */ + mpn_toom_couple_handling (r1, 2 * n + 1, pp, 0, n, 2, 4); + + /* $\pm1/4$ */ + mpn_toom_eval_pm2rexp (v2, v0, 5, ap, n, s, 2, pp); + TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */ + TOOM6_SQR_REC(r4, v2, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */ + mpn_toom_couple_handling (r4, 2 * n + 1, pp, 0, n, 2, 0); + + /* $\pm2$ */ + mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp); + TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-2)*B(-2) */ + TOOM6_SQR_REC(r2, v2, n + 1, wse); /* A(+2)*B(+2) */ + mpn_toom_couple_handling (r2, 2 * n + 1, pp, 0, n, 1, 2); + +#undef v0 +#undef v2 + + /* A(0)*B(0) */ + TOOM6_SQR_REC(pp, ap, n, wse); + + mpn_toom_interpolate_12pts (pp, r1, r3, r5, n, 2 * s, 0, wse); + +#undef r0 +#undef r1 +#undef r2 +#undef r3 +#undef r4 +#undef r5 + +} +#undef TOOM6_SQR_REC +#undef MAYBE_sqr_basecase +#undef MAYBE_sqr_above_basecase +#undef MAYBE_sqr_toom2 +#undef MAYBE_sqr_above_toom2 +#undef MAYBE_sqr_toom3 +#undef MAYBE_sqr_above_toom3 +#undef MAYBE_sqr_above_toom4 diff --git a/contrib/gmp/mpn/generic/toom6h_mul.c b/contrib/gmp/mpn/generic/toom6h_mul.c new file mode 100644 index 0000000000..91ff8330ef --- /dev/null +++ b/contrib/gmp/mpn/generic/toom6h_mul.c @@ -0,0 +1,232 @@ +/* Implementation of the multiplication algorithm for Toom-Cook 6.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + + +#if GMP_NUMB_BITS < 21 +#error Not implemented. +#endif + +#if TUNE_PROGRAM_BUILD +#define MAYBE_mul_basecase 1 +#define MAYBE_mul_toom22 1 +#define MAYBE_mul_toom33 1 +#define MAYBE_mul_toom6h 1 +#else +#define MAYBE_mul_basecase \ + (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM22_THRESHOLD) +#define MAYBE_mul_toom22 \ + (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM33_THRESHOLD) +#define MAYBE_mul_toom33 \ + (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM44_THRESHOLD) +#define MAYBE_mul_toom6h \ + (MUL_FFT_THRESHOLD >= 6 * MUL_TOOM6H_THRESHOLD) +#endif + +#define TOOM6H_MUL_N_REC(p, a, b, n, ws) \ + do { \ + if (MAYBE_mul_basecase \ + && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \ + mpn_mul_basecase (p, a, n, b, n); \ + else if (MAYBE_mul_toom22 \ + && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \ + mpn_toom22_mul (p, a, n, b, n, ws); \ + else if (MAYBE_mul_toom33 \ + && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) \ + mpn_toom33_mul (p, a, n, b, n, ws); \ + else if (! MAYBE_mul_toom6h \ + || BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) \ + mpn_toom44_mul (p, a, n, b, n, ws); \ + else \ + mpn_toom6h_mul (p, a, n, b, n, ws); \ + } while (0) + +#define TOOM6H_MUL_REC(p, a, na, b, nb, ws) \ + do { mpn_mul (p, a, na, b, nb); \ + } while (0) + +/* Toom-6.5 , compute the product {pp,an+bn} <- {ap,an} * {bp,bn} + With: an >= bn >= 46, an*6 < bn * 17. + It _may_ work with bn<=46 and bn*17 < an*6 < bn*18 + + Evaluate in: infinity, +4, -4, +2, -2, +1, -1, +1/2, -1/2, +1/4, -1/4, 0. +*/ +/* Estimate on needed scratch: + S(n) <= (n+5)\6*10+4+MAX(S((n+5)\6),1+2*(n+5)\6), + since n>42; S(n) <= ceil(log(n)/log(6))*(10+4)+n*12\6 < n*2 + lg2(n)*6 + */ + +void +mpn_toom6h_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn, mp_ptr scratch) +{ + mp_size_t n, s, t; + int p, q, half; + int sign; + + /***************************** decomposition *******************************/ + + ASSERT( an >= bn); + /* Can not handle too much unbalancement */ + ASSERT( bn >= 42 ); + /* Can not handle too much unbalancement */ + ASSERT((an*3 < bn * 8) || ( bn >= 46 && an*6 < bn * 17 )); + + /* Limit num/den is a rational number between + (12/11)^(log(4)/log(2*4-1)) and (12/11)^(log(6)/log(2*6-1)) */ +#define LIMIT_numerator (18) +#define LIMIT_denominat (17) + + if( an * LIMIT_denominat < LIMIT_numerator * bn ) /* is 6*... < 6*... */ + { p = q = 6; } + else if( an * 5 * LIMIT_numerator < LIMIT_denominat * 7 * bn ) + { p = 7; q = 6; } + else if( an * 5 * LIMIT_denominat < LIMIT_numerator * 7 * bn ) + { p = 7; q = 5; } + else if( an * LIMIT_numerator < LIMIT_denominat * 2 * bn ) /* is 4*... < 8*... */ + { p = 8; q = 5; } + else if( an * LIMIT_denominat < LIMIT_numerator * 2 * bn ) /* is 4*... < 8*... */ + { p = 8; q = 4; } + else + { p = 9; q = 4; } + + half = (p ^ q) & 1; + n = 1 + (q * an >= p * bn ? (an - 1) / (size_t) p : (bn - 1) / (size_t) q); + p--; q--; + + s = an - p * n; + t = bn - q * n; + + /* With LIMIT = 16/15, the following recover is needed only if bn<=73*/ + if (half) { /* Recover from badly chosen splitting */ + if (s<1) {p--; s+=n; half=0;} + else if (t<1) {q--; t+=n; half=0;} + } +#undef LIMIT_numerator +#undef LIMIT_denominat + + ASSERT (0 < s && s <= n); + ASSERT (0 < t && t <= n); + ASSERT (half || s + t > 3); + ASSERT (n > 2); + +#define r4 (pp + 3 * n) /* 3n+1 */ +#define r2 (pp + 7 * n) /* 3n+1 */ +#define r0 (pp +11 * n) /* s+t <= 2*n */ +#define r5 (scratch) /* 3n+1 */ +#define r3 (scratch + 3 * n + 1) /* 3n+1 */ +#define r1 (scratch + 6 * n + 2) /* 3n+1 */ +#define v0 (pp + 7 * n) /* n+1 */ +#define v1 (pp + 8 * n+1) /* n+1 */ +#define v2 (pp + 9 * n+2) /* n+1 */ +#define v3 (scratch + 9 * n + 3) /* n+1 */ +#define wsi (scratch + 9 * n + 3) /* 3n+1 */ +#define wse (scratch +10 * n + 4) /* 2n+1 */ + + /* Alloc also 3n+1 limbs for wsi... toom_interpolate_12pts may + need all of them */ +/* if (scratch == NULL) */ +/* scratch = TMP_SALLOC_LIMBS(mpn_toom6_sqr_itch(n * 6)); */ + ASSERT (12 * n + 6 <= mpn_toom6h_mul_itch(an,bn)); + ASSERT (12 * n + 6 <= mpn_toom6_sqr_itch(n * 6)); + + /********************** evaluation and recursive calls *********************/ + /* $\pm1/2$ */ + sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 1, pp) ^ + mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 1, pp); + TOOM6H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */ + TOOM6H_MUL_N_REC(r5, v2, v3, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */ + mpn_toom_couple_handling (r5, 2 * n + 1, pp, sign, n, 1+half , half); + + /* $\pm1$ */ + sign = mpn_toom_eval_pm1 (v2, v0, p, ap, n, s, pp); + if (q == 3) + sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t, pp); + else + sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t, pp); + TOOM6H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1)*B(-1) */ + TOOM6H_MUL_N_REC(r3, v2, v3, n + 1, wse); /* A(1)*B(1) */ + mpn_toom_couple_handling (r3, 2 * n + 1, pp, sign, n, 0, 0); + + /* $\pm4$ */ + sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 2, pp) ^ + mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 2, pp); + TOOM6H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-4)*B(-4) */ + TOOM6H_MUL_N_REC(r1, v2, v3, n + 1, wse); /* A(+4)*B(+4) */ + mpn_toom_couple_handling (r1, 2 * n + 1, pp, sign, n, 2, 4); + + /* $\pm1/4$ */ + sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 2, pp) ^ + mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 2, pp); + TOOM6H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */ + TOOM6H_MUL_N_REC(r4, v2, v3, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */ + mpn_toom_couple_handling (r4, 2 * n + 1, pp, sign, n, 2*(1+half), 2*(half)); + + /* $\pm2$ */ + sign = mpn_toom_eval_pm2 (v2, v0, p, ap, n, s, pp) ^ + mpn_toom_eval_pm2 (v3, v1, q, bp, n, t, pp); + TOOM6H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-2)*B(-2) */ + TOOM6H_MUL_N_REC(r2, v2, v3, n + 1, wse); /* A(+2)*B(+2) */ + mpn_toom_couple_handling (r2, 2 * n + 1, pp, sign, n, 1, 2); + +#undef v0 +#undef v1 +#undef v2 +#undef v3 +#undef wse + + /* A(0)*B(0) */ + TOOM6H_MUL_N_REC(pp, ap, bp, n, wsi); + + /* Infinity */ + if( half != 0) { + if(s>t) { + TOOM6H_MUL_REC(r0, ap + p * n, s, bp + q * n, t, wsi); + } else { + TOOM6H_MUL_REC(r0, bp + q * n, t, ap + p * n, s, wsi); + }; + }; + + mpn_toom_interpolate_12pts (pp, r1, r3, r5, n, s+t, half, wsi); + +#undef r0 +#undef r1 +#undef r2 +#undef r3 +#undef r4 +#undef r5 +#undef wsi +} + +#undef TOOM6H_MUL_N_REC +#undef TOOM6H_MUL_REC +#undef MAYBE_mul_basecase +#undef MAYBE_mul_toom22 +#undef MAYBE_mul_toom33 +#undef MAYBE_mul_toom6h diff --git a/contrib/gmp/mpn/generic/toom8_sqr.c b/contrib/gmp/mpn/generic/toom8_sqr.c new file mode 100644 index 0000000000..e098d2e263 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom8_sqr.c @@ -0,0 +1,208 @@ +/* Implementation of the squaring algorithm with Toom-Cook 8.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +#if GMP_NUMB_BITS < 29 +#error Not implemented. +#endif + +#if GMP_NUMB_BITS < 43 +#define BIT_CORRECTION 1 +#define CORRECTION_BITS GMP_NUMB_BITS +#else +#define BIT_CORRECTION 0 +#define CORRECTION_BITS 0 +#endif + +#ifndef SQR_TOOM8_THRESHOLD +#define SQR_TOOM8_THRESHOLD MUL_TOOM8H_THRESHOLD +#endif + +#ifndef SQR_TOOM6_THRESHOLD +#define SQR_TOOM6_THRESHOLD MUL_TOOM6H_THRESHOLD +#endif + +#if TUNE_PROGRAM_BUILD +#define MAYBE_sqr_basecase 1 +#define MAYBE_sqr_above_basecase 1 +#define MAYBE_sqr_toom2 1 +#define MAYBE_sqr_above_toom2 1 +#define MAYBE_sqr_toom3 1 +#define MAYBE_sqr_above_toom3 1 +#define MAYBE_sqr_toom4 1 +#define MAYBE_sqr_above_toom4 1 +#define MAYBE_sqr_above_toom6 1 +#else +#define SQR_TOOM8_MAX \ + ((SQR_FFT_THRESHOLD <= MP_SIZE_T_MAX - (8*2-1+7)) ? \ + ((SQR_FFT_THRESHOLD+8*2-1+7)/8) \ + : MP_SIZE_T_MAX ) +#define MAYBE_sqr_basecase \ + (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM2_THRESHOLD) +#define MAYBE_sqr_above_basecase \ + (SQR_TOOM8_MAX >= SQR_TOOM2_THRESHOLD) +#define MAYBE_sqr_toom2 \ + (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM3_THRESHOLD) +#define MAYBE_sqr_above_toom2 \ + (SQR_TOOM8_MAX >= SQR_TOOM3_THRESHOLD) +#define MAYBE_sqr_toom3 \ + (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM4_THRESHOLD) +#define MAYBE_sqr_above_toom3 \ + (SQR_TOOM8_MAX >= SQR_TOOM4_THRESHOLD) +#define MAYBE_sqr_toom4 \ + (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM6_THRESHOLD) +#define MAYBE_sqr_above_toom4 \ + (SQR_TOOM8_MAX >= SQR_TOOM6_THRESHOLD) +#define MAYBE_sqr_above_toom6 \ + (SQR_TOOM8_MAX >= SQR_TOOM8_THRESHOLD) +#endif + +#define TOOM8_SQR_REC(p, a, n, ws) \ + do { \ + if (MAYBE_sqr_basecase && ( !MAYBE_sqr_above_basecase \ + || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))) \ + mpn_sqr_basecase (p, a, n); \ + else if (MAYBE_sqr_toom2 && ( !MAYBE_sqr_above_toom2 \ + || BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))) \ + mpn_toom2_sqr (p, a, n, ws); \ + else if (MAYBE_sqr_toom3 && ( !MAYBE_sqr_above_toom3 \ + || BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))) \ + mpn_toom3_sqr (p, a, n, ws); \ + else if (MAYBE_sqr_toom4 && ( !MAYBE_sqr_above_toom4 \ + || BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD))) \ + mpn_toom4_sqr (p, a, n, ws); \ + else if (! MAYBE_sqr_above_toom6 \ + || BELOW_THRESHOLD (n, SQR_TOOM8_THRESHOLD)) \ + mpn_toom6_sqr (p, a, n, ws); \ + else \ + mpn_toom8_sqr (p, a, n, ws); \ + } while (0) + +void +mpn_toom8_sqr (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch) +{ + mp_size_t n, s; + + /***************************** decomposition *******************************/ + + ASSERT ( an >= 40 ); + + n = 1 + ((an - 1)>>3); + + s = an - 7 * n; + + ASSERT (0 < s && s <= n); + ASSERT ( s + s > 3 ); + +#define r6 (pp + 3 * n) /* 3n+1 */ +#define r4 (pp + 7 * n) /* 3n+1 */ +#define r2 (pp +11 * n) /* 3n+1 */ +#define r0 (pp +15 * n) /* s+t <= 2*n */ +#define r7 (scratch) /* 3n+1 */ +#define r5 (scratch + 3 * n + 1) /* 3n+1 */ +#define r3 (scratch + 6 * n + 2) /* 3n+1 */ +#define r1 (scratch + 9 * n + 3) /* 3n+1 */ +#define v0 (pp +11 * n) /* n+1 */ +#define v2 (pp +13 * n+2) /* n+1 */ +#define wse (scratch +12 * n + 4) /* 3n+1 */ + + /* Alloc also 3n+1 limbs for ws... toom_interpolate_16pts may + need all of them, when DO_mpn_sublsh_n usea a scratch */ +/* if (scratch == NULL) */ +/* scratch = TMP_SALLOC_LIMBS (30 * n + 6); */ + + /********************** evaluation and recursive calls *********************/ + /* $\pm1/8$ */ + mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 3, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-1/8)*B(-1/8)*8^. */ + TOOM8_SQR_REC(r7, v2, n + 1, wse); /* A(+1/8)*B(+1/8)*8^. */ + mpn_toom_couple_handling (r7, 2 * n + 1 + BIT_CORRECTION, pp, 0, n, 3, 0); + + /* $\pm1/4$ */ + mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 2, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */ + TOOM8_SQR_REC(r5, v2, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */ + mpn_toom_couple_handling (r5, 2 * n + 1, pp, 0, n, 2, 0); + + /* $\pm2$ */ + mpn_toom_eval_pm2 (v2, v0, 7, ap, n, s, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-2)*B(-2) */ + TOOM8_SQR_REC(r3, v2, n + 1, wse); /* A(+2)*B(+2) */ + mpn_toom_couple_handling (r3, 2 * n + 1, pp, 0, n, 1, 2); + + /* $\pm8$ */ + mpn_toom_eval_pm2exp (v2, v0, 7, ap, n, s, 3, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-8)*B(-8) */ + TOOM8_SQR_REC(r1, v2, n + 1, wse); /* A(+8)*B(+8) */ + mpn_toom_couple_handling (r1, 2 * n + 1 + BIT_CORRECTION, pp, 0, n, 3, 6); + + /* $\pm1/2$ */ + mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 1, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */ + TOOM8_SQR_REC(r6, v2, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */ + mpn_toom_couple_handling (r6, 2 * n + 1, pp, 0, n, 1, 0); + + /* $\pm1$ */ + mpn_toom_eval_pm1 (v2, v0, 7, ap, n, s, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-1)*B(-1) */ + TOOM8_SQR_REC(r4, v2, n + 1, wse); /* A(1)*B(1) */ + mpn_toom_couple_handling (r4, 2 * n + 1, pp, 0, n, 0, 0); + + /* $\pm4$ */ + mpn_toom_eval_pm2exp (v2, v0, 7, ap, n, s, 2, pp); + TOOM8_SQR_REC(pp, v0, n + 1, wse); /* A(-4)*B(-4) */ + TOOM8_SQR_REC(r2, v2, n + 1, wse); /* A(+4)*B(+4) */ + mpn_toom_couple_handling (r2, 2 * n + 1, pp, 0, n, 2, 4); + +#undef v0 +#undef v2 + + /* A(0)*B(0) */ + TOOM8_SQR_REC(pp, ap, n, wse); + + mpn_toom_interpolate_16pts (pp, r1, r3, r5, r7, n, 2 * s, 0, wse); + +#undef r0 +#undef r1 +#undef r2 +#undef r3 +#undef r4 +#undef r5 +#undef r6 +#undef wse + +} + +#undef TOOM8_SQR_REC +#undef MAYBE_sqr_basecase +#undef MAYBE_sqr_above_basecase +#undef MAYBE_sqr_toom2 +#undef MAYBE_sqr_above_toom2 +#undef MAYBE_sqr_toom3 +#undef MAYBE_sqr_above_toom3 +#undef MAYBE_sqr_above_toom4 diff --git a/contrib/gmp/mpn/generic/toom8h_mul.c b/contrib/gmp/mpn/generic/toom8h_mul.c new file mode 100644 index 0000000000..c73cf6f5c0 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom8h_mul.c @@ -0,0 +1,290 @@ +/* Implementation of the multiplication algorithm for Toom-Cook 8.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + + +#if GMP_NUMB_BITS < 29 +#error Not implemented. +#endif + +#if GMP_NUMB_BITS < 43 +#define BIT_CORRECTION 1 +#define CORRECTION_BITS GMP_NUMB_BITS +#else +#define BIT_CORRECTION 0 +#define CORRECTION_BITS 0 +#endif + + +#if TUNE_PROGRAM_BUILD +#define MAYBE_mul_basecase 1 +#define MAYBE_mul_toom22 1 +#define MAYBE_mul_toom33 1 +#define MAYBE_mul_toom44 1 +#define MAYBE_mul_toom8h 1 +#else +#define MAYBE_mul_basecase \ + (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM22_THRESHOLD) +#define MAYBE_mul_toom22 \ + (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM33_THRESHOLD) +#define MAYBE_mul_toom33 \ + (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM44_THRESHOLD) +#define MAYBE_mul_toom44 \ + (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM6H_THRESHOLD) +#define MAYBE_mul_toom8h \ + (MUL_FFT_THRESHOLD >= 8 * MUL_TOOM8H_THRESHOLD) +#endif + +#define TOOM8H_MUL_N_REC(p, a, b, n, ws) \ + do { \ + if (MAYBE_mul_basecase \ + && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \ + mpn_mul_basecase (p, a, n, b, n); \ + else if (MAYBE_mul_toom22 \ + && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \ + mpn_toom22_mul (p, a, n, b, n, ws); \ + else if (MAYBE_mul_toom33 \ + && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) \ + mpn_toom33_mul (p, a, n, b, n, ws); \ + else if (MAYBE_mul_toom44 \ + && BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) \ + mpn_toom44_mul (p, a, n, b, n, ws); \ + else if (! MAYBE_mul_toom8h \ + || BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD)) \ + mpn_toom6h_mul (p, a, n, b, n, ws); \ + else \ + mpn_toom8h_mul (p, a, n, b, n, ws); \ + } while (0) + +#define TOOM8H_MUL_REC(p, a, na, b, nb, ws) \ + do { mpn_mul (p, a, na, b, nb); \ + } while (0) + +/* Toom-8.5 , compute the product {pp,an+bn} <- {ap,an} * {bp,bn} + With: an >= bn >= 86, an*5 < bn * 11. + It _may_ work with bn<=?? and bn*?? < an*? < bn*?? + + Evaluate in: infinity, +8,-8,+4,-4,+2,-2,+1,-1,+1/2,-1/2,+1/4,-1/4,+1/8,-1/8,0. +*/ +/* Estimate on needed scratch: + S(n) <= (n+7)\8*13+5+MAX(S((n+7)\8),1+2*(n+7)\8), + since n>80; S(n) <= ceil(log(n/10)/log(8))*(13+5)+n*15\8 < n*15\8 + lg2(n)*6 + */ + +void +mpn_toom8h_mul (mp_ptr pp, + mp_srcptr ap, mp_size_t an, + mp_srcptr bp, mp_size_t bn, mp_ptr scratch) +{ + mp_size_t n, s, t; + int p, q, half; + int sign; + + /***************************** decomposition *******************************/ + + ASSERT (an >= bn); + /* Can not handle too small operands */ + ASSERT (bn >= 86); + /* Can not handle too much unbalancement */ + ASSERT (an*4 <= bn*13); + ASSERT (GMP_NUMB_BITS > 12*3 || an*4 <= bn*12); + ASSERT (GMP_NUMB_BITS > 11*3 || an*5 <= bn*11); + ASSERT (GMP_NUMB_BITS > 10*3 || an*6 <= bn*10); + ASSERT (GMP_NUMB_BITS > 9*3 || an*7 <= bn* 9); + + /* Limit num/den is a rational number between + (16/15)^(log(6)/log(2*6-1)) and (16/15)^(log(8)/log(2*8-1)) */ +#define LIMIT_numerator (21) +#define LIMIT_denominat (20) + + if (LIKELY (an == bn) || an * (LIMIT_denominat>>1) < LIMIT_numerator * (bn>>1) ) /* is 8*... < 8*... */ + { + half = 0; + n = 1 + ((an - 1)>>3); + p = q = 7; + s = an - p * n; + t = bn - q * n; + } + else + { + if (an * 13 < 16 * bn) /* (an*7*LIMIT_numerator>1) < (LIMIT_numerator/7*9) * (bn>>1)) + { p = 9; q = 7; } + else if (an * 10 < 33 * (bn>>1)) /* (an*3*LIMIT_numerator= p * bn ? (an - 1) / (size_t) p : (bn - 1) / (size_t) q); + p--; q--; + + s = an - p * n; + t = bn - q * n; + + if(half) { /* Recover from badly chosen splitting */ + if (s<1) {p--; s+=n; half=0;} + else if (t<1) {q--; t+=n; half=0;} + } + } +#undef LIMIT_numerator +#undef LIMIT_denominat + + ASSERT (0 < s && s <= n); + ASSERT (0 < t && t <= n); + ASSERT (half || s + t > 3); + ASSERT (n > 2); + +#define r6 (pp + 3 * n) /* 3n+1 */ +#define r4 (pp + 7 * n) /* 3n+1 */ +#define r2 (pp +11 * n) /* 3n+1 */ +#define r0 (pp +15 * n) /* s+t <= 2*n */ +#define r7 (scratch) /* 3n+1 */ +#define r5 (scratch + 3 * n + 1) /* 3n+1 */ +#define r3 (scratch + 6 * n + 2) /* 3n+1 */ +#define r1 (scratch + 9 * n + 3) /* 3n+1 */ +#define v0 (pp +11 * n) /* n+1 */ +#define v1 (pp +12 * n+1) /* n+1 */ +#define v2 (pp +13 * n+2) /* n+1 */ +#define v3 (scratch +12 * n + 4) /* n+1 */ +#define wsi (scratch +12 * n + 4) /* 3n+1 */ +#define wse (scratch +13 * n + 5) /* 2n+1 */ + + /* Alloc also 3n+1 limbs for wsi... toom_interpolate_16pts may + need all of them */ +/* if (scratch == NULL) */ +/* scratch = TMP_SALLOC_LIMBS(mpn_toom8_sqr_itch(n * 8)); */ + ASSERT (15 * n + 6 <= mpn_toom8h_mul_itch (an, bn)); + ASSERT (15 * n + 6 <= mpn_toom8_sqr_itch (n * 8)); + + /********************** evaluation and recursive calls *********************/ + + /* $\pm1/8$ */ + sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 3, pp) ^ + mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 3, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/8)*B(-1/8)*8^. */ + TOOM8H_MUL_N_REC(r7, v2, v3, n + 1, wse); /* A(+1/8)*B(+1/8)*8^. */ + mpn_toom_couple_handling (r7, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3*(1+half), 3*(half)); + + /* $\pm1/4$ */ + sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 2, pp) ^ + mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 2, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */ + TOOM8H_MUL_N_REC(r5, v2, v3, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */ + mpn_toom_couple_handling (r5, 2 * n + 1, pp, sign, n, 2*(1+half), 2*(half)); + + /* $\pm2$ */ + sign = mpn_toom_eval_pm2 (v2, v0, p, ap, n, s, pp) ^ + mpn_toom_eval_pm2 (v3, v1, q, bp, n, t, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-2)*B(-2) */ + TOOM8H_MUL_N_REC(r3, v2, v3, n + 1, wse); /* A(+2)*B(+2) */ + mpn_toom_couple_handling (r3, 2 * n + 1, pp, sign, n, 1, 2); + + /* $\pm8$ */ + sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 3, pp) ^ + mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 3, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-8)*B(-8) */ + TOOM8H_MUL_N_REC(r1, v2, v3, n + 1, wse); /* A(+8)*B(+8) */ + mpn_toom_couple_handling (r1, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3, 6); + + /* $\pm1/2$ */ + sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 1, pp) ^ + mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 1, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */ + TOOM8H_MUL_N_REC(r6, v2, v3, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */ + mpn_toom_couple_handling (r6, 2 * n + 1, pp, sign, n, 1+half, half); + + /* $\pm1$ */ + sign = mpn_toom_eval_pm1 (v2, v0, p, ap, n, s, pp); + if (q == 3) + sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t, pp); + else + sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1)*B(-1) */ + TOOM8H_MUL_N_REC(r4, v2, v3, n + 1, wse); /* A(1)*B(1) */ + mpn_toom_couple_handling (r4, 2 * n + 1, pp, sign, n, 0, 0); + + /* $\pm4$ */ + sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 2, pp) ^ + mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 2, pp); + TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-4)*B(-4) */ + TOOM8H_MUL_N_REC(r2, v2, v3, n + 1, wse); /* A(+4)*B(+4) */ + mpn_toom_couple_handling (r2, 2 * n + 1, pp, sign, n, 2, 4); + +#undef v0 +#undef v1 +#undef v2 +#undef v3 +#undef wse + + /* A(0)*B(0) */ + TOOM8H_MUL_N_REC(pp, ap, bp, n, wsi); + + /* Infinity */ + if( half != 0) { + if(s>t) { + TOOM8H_MUL_REC(r0, ap + p * n, s, bp + q * n, t, wsi); + } else { + TOOM8H_MUL_REC(r0, bp + q * n, t, ap + p * n, s, wsi); + }; + }; + + mpn_toom_interpolate_16pts (pp, r1, r3, r5, r7, n, s+t, half, wsi); + +#undef r0 +#undef r1 +#undef r2 +#undef r3 +#undef r4 +#undef r5 +#undef r6 +#undef wsi +} + +#undef TOOM8H_MUL_N_REC +#undef TOOM8H_MUL_REC +#undef MAYBE_mul_basecase +#undef MAYBE_mul_toom22 +#undef MAYBE_mul_toom33 +#undef MAYBE_mul_toom44 +#undef MAYBE_mul_toom8h diff --git a/contrib/gmp/mpn/generic/toom_couple_handling.c b/contrib/gmp/mpn/generic/toom_couple_handling.c new file mode 100644 index 0000000000..c347297504 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_couple_handling.c @@ -0,0 +1,70 @@ +/* Helper function for high degree Toom-Cook algorithms. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Gets {pp,n} and (sign?-1:1)*{np,n}. Computes at once: + {pp,n} <- ({pp,n}+{np,n})/2^{ps+1} + {pn,n} <- ({pp,n}-{np,n})/2^{ns+1} + Finally recompose them obtaining: + {pp,n+off} <- {pp,n}+{np,n}*2^{off*GMP_NUMB_BITS} +*/ +void +mpn_toom_couple_handling (mp_ptr pp, mp_size_t n, mp_ptr np, + int nsign, mp_size_t off, int ps, int ns) +{ + if (nsign) { +#ifdef HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (np, pp, np, n); +#else + mpn_sub_n (np, pp, np, n); + mpn_rshift (np, np, n, 1); +#endif + } else { +#ifdef HAVE_NATIVE_mpn_rsh1add_n + mpn_rsh1add_n (np, pp, np, n); +#else + mpn_add_n (np, pp, np, n); + mpn_rshift (np, np, n, 1); +#endif + } + +#ifdef HAVE_NATIVE_mpn_rsh1sub_n + if (ps == 1) + mpn_rsh1sub_n (pp, pp, np, n); + else +#endif + { + mpn_sub_n (pp, pp, np, n); + if (ps > 0) + mpn_rshift (pp, pp, n, ps); + } + if (ns > 0) + mpn_rshift (np, np, n, ns); + pp[n] = mpn_add_n (pp+off, pp+off, np, n-off); + ASSERT_NOCARRY (mpn_add_1(pp+n, np+n-off, off, pp[n]) ); +} diff --git a/contrib/gmp/mpn/generic/toom_eval_dgr3_pm1.c b/contrib/gmp/mpn/generic/toom_eval_dgr3_pm1.c new file mode 100644 index 0000000000..67395068d6 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_eval_dgr3_pm1.c @@ -0,0 +1,62 @@ +/* mpn_toom_eval_dgr3_pm1 -- Evaluate a degree 3 polynomial in +1 and -1 + + Contributed to the GNU project by Niels Möller + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +int +mpn_toom_eval_dgr3_pm1 (mp_ptr xp1, mp_ptr xm1, + mp_srcptr xp, mp_size_t n, mp_size_t x3n, mp_ptr tp) +{ + int neg; + + ASSERT (x3n > 0); + ASSERT (x3n <= n); + + xp1[n] = mpn_add_n (xp1, xp, xp + 2*n, n); + tp[n] = mpn_add (tp, xp + n, n, xp + 3*n, x3n); + + neg = (mpn_cmp (xp1, tp, n + 1) < 0) ? ~0 : 0; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (neg) + mpn_add_n_sub_n (xp1, xm1, tp, xp1, n + 1); + else + mpn_add_n_sub_n (xp1, xm1, xp1, tp, n + 1); +#else + if (neg) + mpn_sub_n (xm1, tp, xp1, n + 1); + else + mpn_sub_n (xm1, xp1, tp, n + 1); + + mpn_add_n (xp1, xp1, tp, n + 1); +#endif + + ASSERT (xp1[n] <= 3); + ASSERT (xm1[n] <= 1); + + return neg; +} diff --git a/contrib/gmp/mpn/generic/toom_eval_dgr3_pm2.c b/contrib/gmp/mpn/generic/toom_eval_dgr3_pm2.c new file mode 100644 index 0000000000..0148600c96 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_eval_dgr3_pm2.c @@ -0,0 +1,87 @@ +/* mpn_toom_eval_dgr3_pm2 -- Evaluate a degree 3 polynomial in +2 and -2 + + Contributed to the GNU project by Niels Möller + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Needs n+1 limbs of temporary storage. */ +int +mpn_toom_eval_dgr3_pm2 (mp_ptr xp2, mp_ptr xm2, + mp_srcptr xp, mp_size_t n, mp_size_t x3n, mp_ptr tp) +{ + mp_limb_t cy; + int neg; + + ASSERT (x3n > 0); + ASSERT (x3n <= n); + + /* (x0 + 4 * x2) +/- (2 x1 + 8 x_3) */ +#if HAVE_NATIVE_mpn_addlsh_n || HAVE_NATIVE_mpn_addlsh2_n +#if HAVE_NATIVE_mpn_addlsh2_n + xp2[n] = mpn_addlsh2_n (xp2, xp, xp + 2*n, n); + + cy = mpn_addlsh2_n (tp, xp + n, xp + 3*n, x3n); +#else /* HAVE_NATIVE_mpn_addlsh_n */ + xp2[n] = mpn_addlsh_n (xp2, xp, xp + 2*n, n, 2); + + cy = mpn_addlsh_n (tp, xp + n, xp + 3*n, x3n, 2); +#endif + if (x3n < n) + cy = mpn_add_1 (tp + x3n, xp + n + x3n, n - x3n, cy); + tp[n] = cy; +#else + cy = mpn_lshift (tp, xp + 2*n, n, 2); + xp2[n] = cy + mpn_add_n (xp2, tp, xp, n); + + tp[x3n] = mpn_lshift (tp, xp + 3*n, x3n, 2); + if (x3n < n) + tp[n] = mpn_add (tp, xp + n, n, tp, x3n + 1); + else + tp[n] += mpn_add_n (tp, xp + n, tp, n); +#endif + mpn_lshift (tp, tp, n+1, 1); + + neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (neg) + mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1); + else + mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1); +#else + if (neg) + mpn_sub_n (xm2, tp, xp2, n + 1); + else + mpn_sub_n (xm2, xp2, tp, n + 1); + + mpn_add_n (xp2, xp2, tp, n + 1); +#endif + + ASSERT (xp2[n] < 15); + ASSERT (xm2[n] < 10); + + return neg; +} diff --git a/contrib/gmp/mpn/generic/toom_eval_pm1.c b/contrib/gmp/mpn/generic/toom_eval_pm1.c new file mode 100644 index 0000000000..1c63efda58 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_eval_pm1.c @@ -0,0 +1,79 @@ +/* mpn_toom_eval_pm1 -- Evaluate a polynomial in +1 and -1 + + Contributed to the GNU project by Niels Möller + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Evaluates a polynomial of degree k > 3, in the points +1 and -1. */ +int +mpn_toom_eval_pm1 (mp_ptr xp1, mp_ptr xm1, unsigned k, + mp_srcptr xp, mp_size_t n, mp_size_t hn, mp_ptr tp) +{ + unsigned i; + int neg; + + ASSERT (k >= 4); + + ASSERT (hn > 0); + ASSERT (hn <= n); + + /* The degree k is also the number of full-size coefficients, so + * that last coefficient, of size hn, starts at xp + k*n. */ + + xp1[n] = mpn_add_n (xp1, xp, xp + 2*n, n); + for (i = 4; i < k; i += 2) + ASSERT_NOCARRY (mpn_add (xp1, xp1, n+1, xp+i*n, n)); + + tp[n] = mpn_add_n (tp, xp + n, xp + 3*n, n); + for (i = 5; i < k; i += 2) + ASSERT_NOCARRY (mpn_add (tp, tp, n+1, xp+i*n, n)); + + if (k & 1) + ASSERT_NOCARRY (mpn_add (tp, tp, n+1, xp+k*n, hn)); + else + ASSERT_NOCARRY (mpn_add (xp1, xp1, n+1, xp+k*n, hn)); + + neg = (mpn_cmp (xp1, tp, n + 1) < 0) ? ~0 : 0; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (neg) + mpn_add_n_sub_n (xp1, xm1, tp, xp1, n + 1); + else + mpn_add_n_sub_n (xp1, xm1, xp1, tp, n + 1); +#else + if (neg) + mpn_sub_n (xm1, tp, xp1, n + 1); + else + mpn_sub_n (xm1, xp1, tp, n + 1); + + mpn_add_n (xp1, xp1, tp, n + 1); +#endif + + ASSERT (xp1[n] <= k); + ASSERT (xm1[n] <= k/2 + 1); + + return neg; +} diff --git a/contrib/gmp/mpn/generic/toom_eval_pm2.c b/contrib/gmp/mpn/generic/toom_eval_pm2.c new file mode 100644 index 0000000000..7795b0bc0e --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_eval_pm2.c @@ -0,0 +1,120 @@ +/* mpn_toom_eval_pm2 -- Evaluate a polynomial in +2 and -2 + + Contributed to the GNU project by Niels Möller and Marco Bodrato + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +/* DO_addlsh2(d,a,b,n,cy) computes cy,{d,n} <- {a,n} + 4*(cy,{b,n}), it + can be used as DO_addlsh2(d,a,d,n,d[n]), for accumulation on {d,n+1}. */ +#if HAVE_NATIVE_mpn_addlsh2_n +#define DO_addlsh2(d, a, b, n, cy) \ +do { \ + (cy) <<= 2; \ + (cy) += mpn_addlsh2_n(d, a, b, n); \ +} while (0) +#else +#if HAVE_NATIVE_mpn_addlsh_n +#define DO_addlsh2(d, a, b, n, cy) \ +do { \ + (cy) <<= 2; \ + (cy) += mpn_addlsh_n(d, a, b, n, 2); \ +} while (0) +#else +/* The following is not a general substitute for addlsh2. + It is correct if d == b, but it is not if d == a. */ +#define DO_addlsh2(d, a, b, n, cy) \ +do { \ + (cy) <<= 2; \ + (cy) += mpn_lshift(d, b, n, 2); \ + (cy) += mpn_add_n(d, d, a, n); \ +} while (0) +#endif +#endif + +/* Evaluates a polynomial of degree 2 < k < GMP_NUMB_BITS, in the + points +2 and -2. */ +int +mpn_toom_eval_pm2 (mp_ptr xp2, mp_ptr xm2, unsigned k, + mp_srcptr xp, mp_size_t n, mp_size_t hn, mp_ptr tp) +{ + int i; + int neg; + mp_limb_t cy; + + ASSERT (k >= 3); + ASSERT (k < GMP_NUMB_BITS); + + ASSERT (hn > 0); + ASSERT (hn <= n); + + /* The degree k is also the number of full-size coefficients, so + * that last coefficient, of size hn, starts at xp + k*n. */ + + cy = 0; + DO_addlsh2 (xp2, xp + (k-2) * n, xp + k * n, hn, cy); + if (hn != n) + cy = mpn_add_1 (xp2 + hn, xp + (k-2) * n + hn, n - hn, cy); + for (i = k - 4; i >= 0; i -= 2) + DO_addlsh2 (xp2, xp + i * n, xp2, n, cy); + xp2[n] = cy; + + k--; + + cy = 0; + DO_addlsh2 (tp, xp + (k-2) * n, xp + k * n, n, cy); + for (i = k - 4; i >= 0; i -= 2) + DO_addlsh2 (tp, xp + i * n, tp, n, cy); + tp[n] = cy; + + if (k & 1) + ASSERT_NOCARRY(mpn_lshift (tp , tp , n + 1, 1)); + else + ASSERT_NOCARRY(mpn_lshift (xp2, xp2, n + 1, 1)); + + neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (neg) + mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1); + else + mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1); +#else /* !HAVE_NATIVE_mpn_add_n_sub_n */ + if (neg) + mpn_sub_n (xm2, tp, xp2, n + 1); + else + mpn_sub_n (xm2, xp2, tp, n + 1); + + mpn_add_n (xp2, xp2, tp, n + 1); +#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */ + + ASSERT (xp2[n] < (1<<(k+2))-1); + ASSERT (xm2[n] < ((1<<(k+3))-1 - (1^k&1))/3); + + neg ^= ((k & 1) - 1); + + return neg; +} + +#undef DO_addlsh2 diff --git a/contrib/gmp/mpn/generic/toom_eval_pm2exp.c b/contrib/gmp/mpn/generic/toom_eval_pm2exp.c new file mode 100644 index 0000000000..26c1edb03a --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_eval_pm2exp.c @@ -0,0 +1,117 @@ +/* mpn_toom_eval_pm2exp -- Evaluate a polynomial in +2^k and -2^k + + Contributed to the GNU project by Niels Möller + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +/* Evaluates a polynomial of degree k > 2, in the points +2^shift and -2^shift. */ +int +mpn_toom_eval_pm2exp (mp_ptr xp2, mp_ptr xm2, unsigned k, + mp_srcptr xp, mp_size_t n, mp_size_t hn, unsigned shift, + mp_ptr tp) +{ + unsigned i; + int neg; +#if HAVE_NATIVE_mpn_addlsh_n + mp_limb_t cy; +#endif + + ASSERT (k >= 3); + ASSERT (shift*k < GMP_NUMB_BITS); + + ASSERT (hn > 0); + ASSERT (hn <= n); + + /* The degree k is also the number of full-size coefficients, so + * that last coefficient, of size hn, starts at xp + k*n. */ + +#if HAVE_NATIVE_mpn_addlsh_n + xp2[n] = mpn_addlsh_n (xp2, xp, xp + 2*n, n, 2*shift); + for (i = 4; i < k; i += 2) + xp2[n] += mpn_addlsh_n (xp2, xp2, xp + i*n, n, i*shift); + + tp[n] = mpn_lshift (tp, xp+n, n, shift); + for (i = 3; i < k; i+= 2) + tp[n] += mpn_addlsh_n (tp, tp, xp+i*n, n, i*shift); + + if (k & 1) + { + cy = mpn_addlsh_n (tp, tp, xp+k*n, hn, k*shift); + MPN_INCR_U (tp + hn, n+1 - hn, cy); + } + else + { + cy = mpn_addlsh_n (xp2, xp2, xp+k*n, hn, k*shift); + MPN_INCR_U (xp2 + hn, n+1 - hn, cy); + } + +#else /* !HAVE_NATIVE_mpn_addlsh_n */ + xp2[n] = mpn_lshift (tp, xp+2*n, n, 2*shift); + xp2[n] += mpn_add_n (xp2, xp, tp, n); + for (i = 4; i < k; i += 2) + { + xp2[n] += mpn_lshift (tp, xp + i*n, n, i*shift); + xp2[n] += mpn_add_n (xp2, xp2, tp, n); + } + + tp[n] = mpn_lshift (tp, xp+n, n, shift); + for (i = 3; i < k; i+= 2) + { + tp[n] += mpn_lshift (xm2, xp + i*n, n, i*shift); + tp[n] += mpn_add_n (tp, tp, xm2, n); + } + + xm2[hn] = mpn_lshift (xm2, xp + k*n, hn, k*shift); + if (k & 1) + mpn_add (tp, tp, n+1, xm2, hn+1); + else + mpn_add (xp2, xp2, n+1, xm2, hn+1); +#endif /* !HAVE_NATIVE_mpn_addlsh_n */ + + neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0; + +#if HAVE_NATIVE_mpn_add_n_sub_n + if (neg) + mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1); + else + mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1); +#else /* !HAVE_NATIVE_mpn_add_n_sub_n */ + if (neg) + mpn_sub_n (xm2, tp, xp2, n + 1); + else + mpn_sub_n (xm2, xp2, tp, n + 1); + + mpn_add_n (xp2, xp2, tp, n + 1); +#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */ + + /* FIXME: the following asserts are useless if (k+1)*shift >= GMP_LIMB_BITS */ + ASSERT ((k+1)*shift >= GMP_LIMB_BITS || + xp2[n] < ((CNST_LIMB(1)<<((k+1)*shift))-1)/((CNST_LIMB(1)<= GMP_LIMB_BITS || + xm2[n] < ((CNST_LIMB(1)<<((k+2)*shift))-((k&1)?(CNST_LIMB(1)<= 3. */ +int +mpn_toom_eval_pm2rexp (mp_ptr rp, mp_ptr rm, + unsigned int q, mp_srcptr ap, mp_size_t n, mp_size_t t, + unsigned int s, mp_ptr ws) +{ + unsigned int i; + int neg; + /* {ap,q*n+t} -> {rp,n+1} {rm,n+1} , with {ws, n+1}*/ + ASSERT (n >= t); + ASSERT (s != 0); /* or _eval_pm1 should be used */ + ASSERT (q > 1); + ASSERT (s*q < GMP_NUMB_BITS); + rp[n] = mpn_lshift(rp, ap, n, s*q); + ws[n] = mpn_lshift(ws, ap+n, n, s*(q-1)); + if( (q & 1) != 0) { + ASSERT_NOCARRY(mpn_add(ws,ws,n+1,ap+n*q,t)); + rp[n] += DO_mpn_addlsh_n(rp, ap+n*(q-1), n, s, rm); + } else { + ASSERT_NOCARRY(mpn_add(rp,rp,n+1,ap+n*q,t)); + } + for(i=2; i> s); \ + __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \ + MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \ +} while (0) +#endif + + +#if GMP_NUMB_BITS < 21 +#error Not implemented: Both sublsh_n(,,,20) should be corrected. +#endif + +#if GMP_NUMB_BITS < 16 +#error Not implemented: divexact_by42525 needs splitting. +#endif + +#if GMP_NUMB_BITS < 12 +#error Not implemented: Hard to adapt... +#endif + +/* FIXME: tuneup should decide the best variant */ +#ifndef AORSMUL_FASTER_AORS_AORSLSH +#define AORSMUL_FASTER_AORS_AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_AORS_2AORSLSH +#define AORSMUL_FASTER_AORS_2AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_2AORSLSH +#define AORSMUL_FASTER_2AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_3AORSLSH +#define AORSMUL_FASTER_3AORSLSH 1 +#endif + +#define BINVERT_9 \ + ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39) + +#define BINVERT_255 \ + (GMP_NUMB_MAX - ((GMP_NUMB_MAX / 255) << (8 - GMP_NUMB_BITS % 8))) + + /* FIXME: find some more general expressions for 2835^-1, 42525^-1 */ +#if GMP_LIMB_BITS == 32 +#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x53E3771B)) +#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0x9F314C35)) +#else +#if GMP_LIMB_BITS == 64 +#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x938CC70553E3771B)) +#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0xE7B40D449F314C35)) +#endif +#endif + +#ifndef mpn_divexact_by255 +#if GMP_NUMB_BITS % 8 == 0 +#define mpn_divexact_by255(dst,src,size) \ + (255 & 1 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 255))) +#else +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by255(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,0) +#else +#define mpn_divexact_by255(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255)) +#endif +#endif +#endif + +#ifndef mpn_divexact_by9x4 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by9x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(9),BINVERT_9,2) +#else +#define mpn_divexact_by9x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(9)<<2) +#endif +#endif + +#ifndef mpn_divexact_by42525 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_42525) +#define mpn_divexact_by42525(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(42525),BINVERT_42525,0) +#else +#define mpn_divexact_by42525(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(42525)) +#endif +#endif + +#ifndef mpn_divexact_by2835x4 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_2835) +#define mpn_divexact_by2835x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(2835),BINVERT_2835,2) +#else +#define mpn_divexact_by2835x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(2835)<<2) +#endif +#endif + +/* Interpolation for Toom-6.5 (or Toom-6), using the evaluation + points: infinity(6.5 only), +-4, +-2, +-1, +-1/4, +-1/2, 0. More precisely, + we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of + degree 11 (or 10), given the 12 (rsp. 11) values: + + r0 = limit at infinity of f(x) / x^7, + r1 = f(4),f(-4), + r2 = f(2),f(-2), + r3 = f(1),f(-1), + r4 = f(1/4),f(-1/4), + r5 = f(1/2),f(-1/2), + r6 = f(0). + + All couples of the form f(n),f(-n) must be already mixed with + toom_couple_handling(f(n),...,f(-n),...) + + The result is stored in {pp, spt + 7*n (or 6*n)}. + At entry, r6 is stored at {pp, 2n}, + r4 is stored at {pp + 3n, 3n + 1}. + r2 is stored at {pp + 7n, 3n + 1}. + r0 is stored at {pp +11n, spt}. + + The other values are 3n+1 limbs each (with most significant limbs small). + + Negative intermediate results are stored two-complemented. + Inputs are destroyed. +*/ + +void +mpn_toom_interpolate_12pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5, + mp_size_t n, mp_size_t spt, int half, mp_ptr wsi) +{ + mp_limb_t cy; + mp_size_t n3; + mp_size_t n3p1; + n3 = 3 * n; + n3p1 = n3 + 1; + +#define r4 (pp + n3) /* 3n+1 */ +#define r2 (pp + 7 * n) /* 3n+1 */ +#define r0 (pp +11 * n) /* s+t <= 2*n */ + + /******************************* interpolation *****************************/ + if (half != 0) { + cy = mpn_sub_n (r3, r3, r0, spt); + MPN_DECR_U (r3 + spt, n3p1 - spt, cy); + + cy = DO_mpn_sublsh_n (r2, r0, spt, 10, wsi); + MPN_DECR_U (r2 + spt, n3p1 - spt, cy); + DO_mpn_subrsh(r5, n3p1, r0, spt, 2, wsi); + + cy = DO_mpn_sublsh_n (r1, r0, spt, 20, wsi); + MPN_DECR_U (r1 + spt, n3p1 - spt, cy); + DO_mpn_subrsh(r4, n3p1, r0, spt, 4, wsi); + }; + + r4[n3] -= DO_mpn_sublsh_n (r4 + n, pp, 2 * n, 20, wsi); + DO_mpn_subrsh(r1 + n, 2 * n + 1, pp, 2 * n, 4, wsi); + +#if HAVE_NATIVE_mpn_add_n_sub_n + mpn_add_n_sub_n (r1, r4, r4, r1, n3p1); +#else + ASSERT_NOCARRY(mpn_add_n (wsi, r1, r4, n3p1)); + mpn_sub_n (r4, r4, r1, n3p1); /* can be negative */ + MP_PTR_SWAP(r1, wsi); +#endif + + r5[n3] -= DO_mpn_sublsh_n (r5 + n, pp, 2 * n, 10, wsi); + DO_mpn_subrsh(r2 + n, 2 * n + 1, pp, 2 * n, 2, wsi); + +#if HAVE_NATIVE_mpn_add_n_sub_n + mpn_add_n_sub_n (r2, r5, r5, r2, n3p1); +#else + mpn_sub_n (wsi, r5, r2, n3p1); /* can be negative */ + ASSERT_NOCARRY(mpn_add_n (r2, r2, r5, n3p1)); + MP_PTR_SWAP(r5, wsi); +#endif + + r3[n3] -= mpn_sub_n (r3+n, r3+n, pp, 2 * n); + +#if AORSMUL_FASTER_AORS_AORSLSH + mpn_submul_1 (r4, r5, n3p1, 257); /* can be negative */ +#else + mpn_sub_n (r4, r4, r5, n3p1); /* can be negative */ + DO_mpn_sublsh_n (r4, r5, n3p1, 8, wsi); /* can be negative */ +#endif + /* A division by 2835x4 followsi. Warning: the operand can be negative! */ + mpn_divexact_by2835x4(r4, r4, n3p1); + if ((r4[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0) + r4[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2)); + +#if AORSMUL_FASTER_2AORSLSH + mpn_addmul_1 (r5, r4, n3p1, 60); /* can be negative */ +#else + DO_mpn_sublsh_n (r5, r4, n3p1, 2, wsi); /* can be negative */ + DO_mpn_addlsh_n (r5, r4, n3p1, 6, wsi); /* can give a carry */ +#endif + mpn_divexact_by255(r5, r5, n3p1); + + ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r3, n3p1, 5, wsi)); + +#if AORSMUL_FASTER_3AORSLSH + ASSERT_NOCARRY(mpn_submul_1 (r1, r2, n3p1, 100)); +#else + ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 6, wsi)); + ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 5, wsi)); + ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 2, wsi)); +#endif + ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r3, n3p1, 9, wsi)); + mpn_divexact_by42525(r1, r1, n3p1); + +#if AORSMUL_FASTER_AORS_2AORSLSH + ASSERT_NOCARRY(mpn_submul_1 (r2, r1, n3p1, 225)); +#else + ASSERT_NOCARRY(mpn_sub_n (r2, r2, r1, n3p1)); + ASSERT_NOCARRY(DO_mpn_addlsh_n (r2, r1, n3p1, 5, wsi)); + ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r1, n3p1, 8, wsi)); +#endif + mpn_divexact_by9x4(r2, r2, n3p1); + + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r2, n3p1)); + + mpn_sub_n (r4, r2, r4, n3p1); + ASSERT_NOCARRY(mpn_rshift(r4, r4, n3p1, 1)); + ASSERT_NOCARRY(mpn_sub_n (r2, r2, r4, n3p1)); + + mpn_add_n (r5, r5, r1, n3p1); + ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1)); + + /* last interpolation steps... */ + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r1, n3p1)); + ASSERT_NOCARRY(mpn_sub_n (r1, r1, r5, n3p1)); + /* ... could be mixed with recomposition + ||H-r5|M-r5|L-r5| ||H-r1|M-r1|L-r1| + */ + + /***************************** recomposition *******************************/ + /* + pp[] prior to operations: + |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|____|H_r6|L r6|pp + + summation scheme for remaining operations: + |__12|n_11|n_10|n__9|n__8|n__7|n__6|n__5|n__4|n__3|n__2|n___|n___|pp + |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|____|H_r6|L r6|pp + ||H r1|M r1|L r1| ||H r3|M r3|L r3| ||H_r5|M_r5|L_r5| + */ + + cy = mpn_add_n (pp + n, pp + n, r5, n); + cy = mpn_add_1 (pp + 2 * n, r5 + n, n, cy); +#if HAVE_NATIVE_mpn_add_nc + cy = r5[n3] + mpn_add_nc(pp + n3, pp + n3, r5 + 2 * n, n, cy); +#else + MPN_INCR_U (r5 + 2 * n, n + 1, cy); + cy = r5[n3] + mpn_add_n (pp + n3, pp + n3, r5 + 2 * n, n); +#endif + MPN_INCR_U (pp + n3 + n, 2 * n + 1, cy); + + pp[2 * n3]+= mpn_add_n (pp + 5 * n, pp + 5 * n, r3, n); + cy = mpn_add_1 (pp + 2 * n3, r3 + n, n, pp[2 * n3]); +#if HAVE_NATIVE_mpn_add_nc + cy = r3[n3] + mpn_add_nc(pp + 7 * n, pp + 7 * n, r3 + 2 * n, n, cy); +#else + MPN_INCR_U (r3 + 2 * n, n + 1, cy); + cy = r3[n3] + mpn_add_n (pp + 7 * n, pp + 7 * n, r3 + 2 * n, n); +#endif + MPN_INCR_U (pp + 8 * n, 2 * n + 1, cy); + + pp[10*n]+=mpn_add_n (pp + 9 * n, pp + 9 * n, r1, n); + if (half) { + cy = mpn_add_1 (pp + 10 * n, r1 + n, n, pp[10 * n]); +#if HAVE_NATIVE_mpn_add_nc + if (LIKELY (spt > n)) { + cy = r1[n3] + mpn_add_nc(pp + 11 * n, pp + 11 * n, r1 + 2 * n, n, cy); + MPN_INCR_U (pp + 4 * n3, spt - n, cy); + } else { + ASSERT_NOCARRY(mpn_add_nc(pp + 11 * n, pp + 11 * n, r1 + 2 * n, spt, cy)); + } +#else + MPN_INCR_U (r1 + 2 * n, n + 1, cy); + if (LIKELY (spt > n)) { + cy = r1[n3] + mpn_add_n (pp + 11 * n, pp + 11 * n, r1 + 2 * n, n); + MPN_INCR_U (pp + 4 * n3, spt - n, cy); + } else { + ASSERT_NOCARRY(mpn_add_n (pp + 11 * n, pp + 11 * n, r1 + 2 * n, spt)); + } +#endif + } else { + ASSERT_NOCARRY(mpn_add_1 (pp + 10 * n, r1 + n, spt, pp[10 * n])); + } + +#undef r0 +#undef r2 +#undef r4 +} diff --git a/contrib/gmp/mpn/generic/toom_interpolate_16pts.c b/contrib/gmp/mpn/generic/toom_interpolate_16pts.c new file mode 100644 index 0000000000..3b26bc165d --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_interpolate_16pts.c @@ -0,0 +1,512 @@ +/* Interpolaton for the algorithm Toom-Cook 8.5-way. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + +#if GMP_NUMB_BITS < 29 +#error Not implemented: Both sublsh_n(,,,28) should be corrected; r2 and r5 need one more LIMB. +#endif + +#if GMP_NUMB_BITS < 28 +#error Not implemented: divexact_by188513325 and _by182712915 will not work. +#endif + + +#if HAVE_NATIVE_mpn_sublsh_n +#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n(dst,dst,src,n,s) +#else +static mp_limb_t +DO_mpn_sublsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws) +{ +#if USE_MUL_1 && 0 + return mpn_submul_1(dst,src,n,CNST_LIMB(1) <<(s)); +#else + mp_limb_t __cy; + __cy = mpn_lshift(ws,src,n,s); + return __cy + mpn_sub_n(dst,dst,ws,n); +#endif +} +#endif + +#if HAVE_NATIVE_mpn_addlsh_n +#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s) +#else +static mp_limb_t +DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws) +{ +#if USE_MUL_1 && 0 + return mpn_addmul_1(dst,src,n,CNST_LIMB(1) <<(s)); +#else + mp_limb_t __cy; + __cy = mpn_lshift(ws,src,n,s); + return __cy + mpn_add_n(dst,dst,ws,n); +#endif +} +#endif + +#if HAVE_NATIVE_mpn_subrsh +#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh(dst,nd,src,ns,s) +#else +/* FIXME: This is not a correct definition, it assumes no carry */ +#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) \ +do { \ + mp_limb_t __cy; \ + MPN_DECR_U (dst, nd, src[0] >> s); \ + __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \ + MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \ +} while (0) +#endif + + +/* FIXME: tuneup should decide the best variant */ +#ifndef AORSMUL_FASTER_AORS_AORSLSH +#define AORSMUL_FASTER_AORS_AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_AORS_2AORSLSH +#define AORSMUL_FASTER_AORS_2AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_2AORSLSH +#define AORSMUL_FASTER_2AORSLSH 1 +#endif +#ifndef AORSMUL_FASTER_3AORSLSH +#define AORSMUL_FASTER_3AORSLSH 1 +#endif + +#if GMP_NUMB_BITS < 43 +#define BIT_CORRECTION 1 +#define CORRECTION_BITS GMP_NUMB_BITS +#else +#define BIT_CORRECTION 0 +#define CORRECTION_BITS 0 +#endif + +#define BINVERT_9 \ + ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39) + +#define BINVERT_255 \ + (GMP_NUMB_MAX - ((GMP_NUMB_MAX / 255) << (8 - GMP_NUMB_BITS % 8))) + + /* FIXME: find some more general expressions for inverses */ +#if GMP_LIMB_BITS == 32 +#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x53E3771B)) +#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0x9F314C35)) +#define BINVERT_182712915 (GMP_NUMB_MASK & CNST_LIMB(0x550659DB)) +#define BINVERT_188513325 (GMP_NUMB_MASK & CNST_LIMB(0xFBC333A5)) +#define BINVERT_255x182712915L (GMP_NUMB_MASK & CNST_LIMB(0x6FC4CB25)) +#define BINVERT_255x188513325L (GMP_NUMB_MASK & CNST_LIMB(0x6864275B)) +#if GMP_NAIL_BITS == 0 +#define BINVERT_255x182712915H CNST_LIMB(0x1B649A07) +#define BINVERT_255x188513325H CNST_LIMB(0x06DB993A) +#else /* GMP_NAIL_BITS != 0 */ +#define BINVERT_255x182712915H \ + (GMP_NUMB_MASK & CNST_LIMB((0x1B649A07<>GMP_NUMB_BITS))) +#define BINVERT_255x188513325H \ + (GMP_NUMB_MASK & CNST_LIMB((0x06DB993A<>GMP_NUMB_BITS))) +#endif +#else +#if GMP_LIMB_BITS == 64 +#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x938CC70553E3771B)) +#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0xE7B40D449F314C35)) +#define BINVERT_255x182712915 (GMP_NUMB_MASK & CNST_LIMB(0x1B649A076FC4CB25)) +#define BINVERT_255x188513325 (GMP_NUMB_MASK & CNST_LIMB(0x06DB993A6864275B)) +#endif +#endif + +#ifndef mpn_divexact_by255 +#if GMP_NUMB_BITS % 8 == 0 +#define mpn_divexact_by255(dst,src,size) \ + (255 & 1 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 255))) +#else +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by255(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,0) +#else +#define mpn_divexact_by255(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255)) +#endif +#endif +#endif + +#ifndef mpn_divexact_by255x4 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by255x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,2) +#else +#define mpn_divexact_by255x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255)<<2) +#endif +#endif + +#ifndef mpn_divexact_by9x16 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by9x16(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(9),BINVERT_9,4) +#else +#define mpn_divexact_by9x16(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(9)<<4) +#endif +#endif + +#ifndef mpn_divexact_by42525x16 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_42525) +#define mpn_divexact_by42525x16(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(42525),BINVERT_42525,4) +#else +#define mpn_divexact_by42525x16(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(42525)<<4) +#endif +#endif + +#ifndef mpn_divexact_by2835x64 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_2835) +#define mpn_divexact_by2835x64(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(2835),BINVERT_2835,6) +#else +#define mpn_divexact_by2835x64(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(2835)<<6) +#endif +#endif + +#ifndef mpn_divexact_by255x182712915 +#if GMP_NUMB_BITS < 36 +#if HAVE_NATIVE_mpn_bdiv_q_2_pi2 && defined(BINVERT_255x182712915H) +/* FIXME: use mpn_bdiv_q_2_pi2 */ +#endif +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_182712915) +#define mpn_divexact_by255x182712915(dst,src,size) \ + do { \ + mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(182712915),BINVERT_182712915,0); \ + mpn_divexact_by255(dst,dst,size); \ + } while(0) +#else +#define mpn_divexact_by255x182712915(dst,src,size) \ + do { \ + mpn_divexact_1(dst,src,size,CNST_LIMB(182712915)); \ + mpn_divexact_by255(dst,dst,size); \ + } while(0) +#endif +#else /* GMP_NUMB_BITS > 35 */ +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_255x182712915) +#define mpn_divexact_by255x182712915(dst,src,size) \ + mpn_pi1_bdiv_q_1(dst,src,size,255*CNST_LIMB(182712915),BINVERT_255x182712915,0) +#else +#define mpn_divexact_by255x182712915(dst,src,size) mpn_divexact_1(dst,src,size,255*CNST_LIMB(182712915)) +#endif +#endif /* GMP_NUMB_BITS >?< 36 */ +#endif + +#ifndef mpn_divexact_by255x188513325 +#if GMP_NUMB_BITS < 36 +#if HAVE_NATIVE_mpn_bdiv_q_1_pi2 && defined(BINVERT_255x188513325H) +/* FIXME: use mpn_bdiv_q_1_pi2 */ +#endif +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_188513325) +#define mpn_divexact_by255x188513325(dst,src,size) \ + do { \ + mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(188513325),BINVERT_188513325,0); \ + mpn_divexact_by255(dst,dst,size); \ + } while(0) +#else +#define mpn_divexact_by255x188513325(dst,src,size) \ + do { \ + mpn_divexact_1(dst,src,size,CNST_LIMB(188513325)); \ + mpn_divexact_by255(dst,dst,size); \ + } while(0) +#endif +#else /* GMP_NUMB_BITS > 35 */ +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_255x188513325) +#define mpn_divexact_by255x188513325(dst,src,size) \ + mpn_pi1_bdiv_q_1(dst,src,size,255*CNST_LIMB(188513325),BINVERT_255x188513325,0) +#else +#define mpn_divexact_by255x188513325(dst,src,size) mpn_divexact_1(dst,src,size,255*CNST_LIMB(188513325)) +#endif +#endif /* GMP_NUMB_BITS >?< 36 */ +#endif + +/* Interpolation for Toom-8.5 (or Toom-8), using the evaluation + points: infinity(8.5 only), +-8, +-4, +-2, +-1, +-1/4, +-1/2, + +-1/8, 0. More precisely, we want to compute + f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 15 (or + 14), given the 16 (rsp. 15) values: + + r0 = limit at infinity of f(x) / x^7, + r1 = f(8),f(-8), + r2 = f(4),f(-4), + r3 = f(2),f(-2), + r4 = f(1),f(-1), + r5 = f(1/4),f(-1/4), + r6 = f(1/2),f(-1/2), + r7 = f(1/8),f(-1/8), + r8 = f(0). + + All couples of the form f(n),f(-n) must be already mixed with + toom_couple_handling(f(n),...,f(-n),...) + + The result is stored in {pp, spt + 7*n (or 8*n)}. + At entry, r8 is stored at {pp, 2n}, + r6 is stored at {pp + 3n, 3n + 1}. + r4 is stored at {pp + 7n, 3n + 1}. + r2 is stored at {pp +11n, 3n + 1}. + r0 is stored at {pp +15n, spt}. + + The other values are 3n+1 limbs each (with most significant limbs small). + + Negative intermediate results are stored two-complemented. + Inputs are destroyed. +*/ + +void +mpn_toom_interpolate_16pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5, mp_ptr r7, + mp_size_t n, mp_size_t spt, int half, mp_ptr wsi) +{ + mp_limb_t cy; + mp_size_t n3; + mp_size_t n3p1; + n3 = 3 * n; + n3p1 = n3 + 1; + +#define r6 (pp + n3) /* 3n+1 */ +#define r4 (pp + 7 * n) /* 3n+1 */ +#define r2 (pp +11 * n) /* 3n+1 */ +#define r0 (pp +15 * n) /* s+t <= 2*n */ + + ASSERT( spt <= 2 * n ); + /******************************* interpolation *****************************/ + if( half != 0) { + cy = mpn_sub_n (r4, r4, r0, spt); + MPN_DECR_U (r4 + spt, n3p1 - spt, cy); + + cy = DO_mpn_sublsh_n (r3, r0, spt, 14, wsi); + MPN_DECR_U (r3 + spt, n3p1 - spt, cy); + DO_mpn_subrsh(r6, n3p1, r0, spt, 2, wsi); + + cy = DO_mpn_sublsh_n (r2, r0, spt, 28, wsi); + MPN_DECR_U (r2 + spt, n3p1 - spt, cy); + DO_mpn_subrsh(r5, n3p1, r0, spt, 4, wsi); + + cy = DO_mpn_sublsh_n (r1 + BIT_CORRECTION, r0, spt, 42 - CORRECTION_BITS, wsi); + MPN_DECR_U (r1 + spt + BIT_CORRECTION, n3p1 - spt - BIT_CORRECTION, cy); +#if BIT_CORRECTION + /* FIXME: assumes r7[n3p1] is writable (it is if r5 follows). */ + cy = r7[n3p1]; + r7[n3p1] = 0x80; +#endif + DO_mpn_subrsh(r7, n3p1 + BIT_CORRECTION, r0, spt, 6, wsi); +#if BIT_CORRECTION + /* FIXME: assumes r7[n3p1] is writable. */ + ASSERT ( BIT_CORRECTION > 0 || r7[n3p1] == 0x80 ); + r7[n3p1] = cy; +#endif + }; + + r5[n3] -= DO_mpn_sublsh_n (r5 + n, pp, 2 * n, 28, wsi); + DO_mpn_subrsh(r2 + n, 2 * n + 1, pp, 2 * n, 4, wsi); + +#if HAVE_NATIVE_mpn_add_n_sub_n + mpn_add_n_sub_n (r2, r5, r5, r2, n3p1); +#else + mpn_sub_n (wsi, r5, r2, n3p1); /* can be negative */ + ASSERT_NOCARRY(mpn_add_n (r2, r2, r5, n3p1)); + MP_PTR_SWAP(r5, wsi); +#endif + + r6[n3] -= DO_mpn_sublsh_n (r6 + n, pp, 2 * n, 14, wsi); + DO_mpn_subrsh(r3 + n, 2 * n + 1, pp, 2 * n, 2, wsi); + +#if HAVE_NATIVE_mpn_add_n_sub_n + mpn_add_n_sub_n (r3, r6, r6, r3, n3p1); +#else + ASSERT_NOCARRY(mpn_add_n (wsi, r3, r6, n3p1)); + mpn_sub_n (r6, r6, r3, n3p1); /* can be negative */ + MP_PTR_SWAP(r3, wsi); +#endif + + cy = DO_mpn_sublsh_n (r7 + n + BIT_CORRECTION, pp, 2 * n, 42 - CORRECTION_BITS, wsi); +#if BIT_CORRECTION + MPN_DECR_U (r1 + n, 2 * n + 1, pp[0] >> 6); + cy = DO_mpn_sublsh_n (r1 + n, pp + 1, 2 * n - 1, GMP_NUMB_BITS - 6, wsi); + cy = mpn_sub_1(r1 + 3 * n - 1, r1 + 3 * n - 1, 2, cy); + ASSERT ( BIT_CORRECTION > 0 || cy != 0 ); +#else + r7[n3] -= cy; + DO_mpn_subrsh(r1 + n, 2 * n + 1, pp, 2 * n, 6, wsi); +#endif + +#if HAVE_NATIVE_mpn_add_n_sub_n + mpn_add_n_sub_n (r1, r7, r7, r1, n3p1); +#else + mpn_sub_n (wsi, r7, r1, n3p1); /* can be negative */ + mpn_add_n (r1, r1, r7, n3p1); /* if BIT_CORRECTION != 0, can give a carry. */ + MP_PTR_SWAP(r7, wsi); +#endif + + r4[n3] -= mpn_sub_n (r4+n, r4+n, pp, 2 * n); + +#if AORSMUL_FASTER_2AORSLSH + mpn_submul_1 (r5, r6, n3p1, 1028); /* can be negative */ +#else + DO_mpn_sublsh_n (r5, r6, n3p1, 2, wsi); /* can be negative */ + DO_mpn_sublsh_n (r5, r6, n3p1,10, wsi); /* can be negative */ +#endif + + mpn_submul_1 (r7, r5, n3p1, 1300); /* can be negative */ +#if AORSMUL_FASTER_3AORSLSH + mpn_submul_1 (r7, r6, n3p1, 1052688); /* can be negative */ +#else + DO_mpn_sublsh_n (r7, r6, n3p1, 4, wsi); /* can be negative */ + DO_mpn_sublsh_n (r7, r6, n3p1,12, wsi); /* can be negative */ + DO_mpn_sublsh_n (r7, r6, n3p1,20, wsi); /* can be negative */ +#endif + mpn_divexact_by255x188513325(r7, r7, n3p1); + + mpn_submul_1 (r5, r7, n3p1, 12567555); /* can be negative */ + /* A division by 2835x64 followsi. Warning: the operand can be negative! */ + mpn_divexact_by2835x64(r5, r5, n3p1); + if ((r5[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-7))) != 0) + r5[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-6)); + +#if AORSMUL_FASTER_AORS_AORSLSH + mpn_submul_1 (r6, r7, n3p1, 4095); /* can be negative */ +#else + mpn_add_n (r6, r6, r7, n3p1); /* can give a carry */ + DO_mpn_sublsh_n (r6, r7, n3p1, 12, wsi); /* can be negative */ +#endif +#if AORSMUL_FASTER_2AORSLSH + mpn_addmul_1 (r6, r5, n3p1, 240); /* can be negative */ +#else + DO_mpn_addlsh_n (r6, r5, n3p1, 8, wsi); /* can give a carry */ + DO_mpn_sublsh_n (r6, r5, n3p1, 4, wsi); /* can be negative */ +#endif + /* A division by 255x4 followsi. Warning: the operand can be negative! */ + mpn_divexact_by255x4(r6, r6, n3p1); + if ((r6[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0) + r6[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2)); + + ASSERT_NOCARRY(DO_mpn_sublsh_n (r3, r4, n3p1, 7, wsi)); + + ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r4, n3p1, 13, wsi)); + ASSERT_NOCARRY(mpn_submul_1 (r2, r3, n3p1, 400)); + + /* If GMP_NUMB_BITS < 42 next operations on r1 can give a carry!*/ + DO_mpn_sublsh_n (r1, r4, n3p1, 19, wsi); + mpn_submul_1 (r1, r2, n3p1, 1428); + mpn_submul_1 (r1, r3, n3p1, 112896); + mpn_divexact_by255x182712915(r1, r1, n3p1); + + ASSERT_NOCARRY(mpn_submul_1 (r2, r1, n3p1, 15181425)); + mpn_divexact_by42525x16(r2, r2, n3p1); + +#if AORSMUL_FASTER_AORS_2AORSLSH + ASSERT_NOCARRY(mpn_submul_1 (r3, r1, n3p1, 3969)); +#else + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r1, n3p1)); + ASSERT_NOCARRY(DO_mpn_addlsh_n (r3, r1, n3p1, 7, wsi)); + ASSERT_NOCARRY(DO_mpn_sublsh_n (r3, r1, n3p1, 12, wsi)); +#endif + ASSERT_NOCARRY(mpn_submul_1 (r3, r2, n3p1, 900)); + mpn_divexact_by9x16(r3, r3, n3p1); + + ASSERT_NOCARRY(mpn_sub_n (r4, r4, r1, n3p1)); + ASSERT_NOCARRY(mpn_sub_n (r4, r4, r3, n3p1)); + ASSERT_NOCARRY(mpn_sub_n (r4, r4, r2, n3p1)); + + mpn_add_n (r6, r2, r6, n3p1); + ASSERT_NOCARRY(mpn_rshift(r6, r6, n3p1, 1)); + ASSERT_NOCARRY(mpn_sub_n (r2, r2, r6, n3p1)); + + mpn_sub_n (r5, r3, r5, n3p1); + ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1)); + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, n3p1)); + + mpn_add_n (r7, r1, r7, n3p1); + ASSERT_NOCARRY(mpn_rshift(r7, r7, n3p1, 1)); + ASSERT_NOCARRY(mpn_sub_n (r1, r1, r7, n3p1)); + + /* last interpolation steps... */ + /* ... could be mixed with recomposition + ||H-r7|M-r7|L-r7| ||H-r5|M-r5|L-r5| + */ + + /***************************** recomposition *******************************/ + /* + pp[] prior to operations: + |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|___||H r6|M r6|L r6|____|H_r8|L r8|pp + + summation scheme for remaining operations: + |__16|n_15|n_14|n_13|n_12|n_11|n_10|n__9|n__8|n__7|n__6|n__5|n__4|n__3|n__2|n___|n___|pp + |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|___||H r6|M r6|L r6|____|H_r8|L r8|pp + ||H r1|M r1|L r1| ||H r3|M r3|L r3| ||H_r5|M_r5|L_r5| ||H r7|M r7|L r7| + */ + + cy = mpn_add_n (pp + n, pp + n, r7, n); + cy = mpn_add_1 (pp + 2 * n, r7 + n, n, cy); +#if HAVE_NATIVE_mpn_add_nc + cy = r7[n3] + mpn_add_nc(pp + n3, pp + n3, r7 + 2 * n, n, cy); +#else + MPN_INCR_U (r7 + 2 * n, n + 1, cy); + cy = r7[n3] + mpn_add_n (pp + n3, pp + n3, r7 + 2 * n, n); +#endif + MPN_INCR_U (pp + 4 * n, 2 * n + 1, cy); + + pp[2 * n3]+= mpn_add_n (pp + 5 * n, pp + 5 * n, r5, n); + cy = mpn_add_1 (pp + 2 * n3, r5 + n, n, pp[2 * n3]); +#if HAVE_NATIVE_mpn_add_nc + cy = r5[n3] + mpn_add_nc(pp + 7 * n, pp + 7 * n, r5 + 2 * n, n, cy); +#else + MPN_INCR_U (r5 + 2 * n, n + 1, cy); + cy = r5[n3] + mpn_add_n (pp + 7 * n, pp + 7 * n, r5 + 2 * n, n); +#endif + MPN_INCR_U (pp + 8 * n, 2 * n + 1, cy); + + pp[10 * n]+= mpn_add_n (pp + 9 * n, pp + 9 * n, r3, n); + cy = mpn_add_1 (pp + 10 * n, r3 + n, n, pp[10 * n]); +#if HAVE_NATIVE_mpn_add_nc + cy = r3[n3] + mpn_add_nc(pp +11 * n, pp +11 * n, r3 + 2 * n, n, cy); +#else + MPN_INCR_U (r3 + 2 * n, n + 1, cy); + cy = r3[n3] + mpn_add_n (pp +11 * n, pp +11 * n, r3 + 2 * n, n); +#endif + MPN_INCR_U (pp +12 * n, 2 * n + 1, cy); + + pp[14 * n]+=mpn_add_n (pp +13 * n, pp +13 * n, r1, n); + if ( half ) { + cy = mpn_add_1 (pp + 14 * n, r1 + n, n, pp[14 * n]); +#if HAVE_NATIVE_mpn_add_nc + if(LIKELY(spt > n)) { + cy = r1[n3] + mpn_add_nc(pp + 15 * n, pp + 15 * n, r1 + 2 * n, n, cy); + MPN_INCR_U (pp + 16 * n, spt - n, cy); + } else { + ASSERT_NOCARRY(mpn_add_nc(pp + 15 * n, pp + 15 * n, r1 + 2 * n, spt, cy)); + } +#else + MPN_INCR_U (r1 + 2 * n, n + 1, cy); + if(LIKELY(spt > n)) { + cy = r1[n3] + mpn_add_n (pp + 15 * n, pp + 15 * n, r1 + 2 * n, n); + MPN_INCR_U (pp + 16 * n, spt - n, cy); + } else { + ASSERT_NOCARRY(mpn_add_n (pp + 15 * n, pp + 15 * n, r1 + 2 * n, spt)); + } +#endif + } else { + ASSERT_NOCARRY(mpn_add_1 (pp + 14 * n, r1 + n, spt, pp[14 * n])); + } + +#undef r0 +#undef r2 +#undef r4 +#undef r6 +} diff --git a/contrib/gmp/mpn/generic/toom_interpolate_5pts.c b/contrib/gmp/mpn/generic/toom_interpolate_5pts.c index 67260cc3d5..1806127940 100644 --- a/contrib/gmp/mpn/generic/toom_interpolate_5pts.c +++ b/contrib/gmp/mpn/generic/toom_interpolate_5pts.c @@ -7,8 +7,8 @@ SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. -Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, -Inc. +Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software +Foundation, Inc. This file is part of the GNU MP Library. @@ -31,28 +31,29 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ void mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, mp_size_t k, mp_size_t twor, int sa, - mp_limb_t vinf0, mp_ptr ws) + mp_limb_t vinf0) { mp_limb_t cy, saved; - mp_size_t twok = k + k; - mp_size_t kk1 = twok + 1; - mp_ptr c1, v1, c3, vinf, c5; - mp_limb_t cout; /* final carry, should be zero at the end */ + mp_size_t twok; + mp_size_t kk1; + mp_ptr c1, v1, c3, vinf; + + twok = k + k; + kk1 = twok + 1; c1 = c + k; v1 = c1 + k; c3 = v1 + k; vinf = c3 + k; - c5 = vinf + k; #define v0 (c) /* (1) v2 <- v2-vm1 < v2+|vm1|, (16 8 4 2 1) - (1 -1 1 -1 1) = thus 0 <= v2 < 50*B^(2k) < 2^6*B^(2k) (15 9 3 3 0) */ - if (sa <= 0) - mpn_add_n (v2, v2, vm1, kk1); + if (sa) + ASSERT_NOCARRY (mpn_add_n (v2, v2, vm1, kk1)); else - mpn_sub_n (v2, v2, vm1, kk1); + ASSERT_NOCARRY (mpn_sub_n (v2, v2, vm1, kk1)); /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} v0 v1 hi(vinf) |vm1| v2-vm1 EMPTY */ @@ -63,17 +64,18 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} v0 v1 hi(vinf) |vm1| (v2-vm1)/3 EMPTY */ - /* (2) vm1 <- tm1 := (v1 - sa*vm1) / 2 [(1 1 1 1 1) - (1 -1 1 -1 1)] / 2 = - tm1 >= 0 (0 1 0 1 0) + /* (2) vm1 <- tm1 := (v1 - vm1) / 2 [(1 1 1 1 1) - (1 -1 1 -1 1)] / 2 = + tm1 >= 0 (0 1 0 1 0) No carry comes out from {v1, kk1} +/- {vm1, kk1}, - and the division by two is exact */ - if (sa <= 0) + and the division by two is exact. + If (sa!=0) the sign of vm1 is negative */ + if (sa) { #ifdef HAVE_NATIVE_mpn_rsh1add_n mpn_rsh1add_n (vm1, v1, vm1, kk1); #else - mpn_add_n (vm1, v1, vm1, kk1); - mpn_rshift (vm1, vm1, kk1, 1); + ASSERT_NOCARRY (mpn_add_n (vm1, v1, vm1, kk1)); + ASSERT_NOCARRY (mpn_rshift (vm1, vm1, kk1, 1)); #endif } else @@ -81,8 +83,8 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, #ifdef HAVE_NATIVE_mpn_rsh1sub_n mpn_rsh1sub_n (vm1, v1, vm1, kk1); #else - mpn_sub_n (vm1, v1, vm1, kk1); - mpn_rshift (vm1, vm1, kk1, 1); + ASSERT_NOCARRY (mpn_sub_n (vm1, v1, vm1, kk1)); + ASSERT_NOCARRY (mpn_rshift (vm1, vm1, kk1, 1)); #endif } @@ -103,8 +105,8 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, #ifdef HAVE_NATIVE_mpn_rsh1sub_n mpn_rsh1sub_n (v2, v2, v1, kk1); #else - mpn_sub_n (v2, v2, v1, kk1); - mpn_rshift (v2, v2, kk1, 1); + ASSERT_NOCARRY (mpn_sub_n (v2, v2, v1, kk1)); + ASSERT_NOCARRY (mpn_rshift (v2, v2, kk1, 1)); #endif /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} @@ -113,10 +115,12 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, /* (5) v1 <- t1-tm1 (1 1 1 1 0) - (0 1 0 1 0) = (1 0 1 0 0) result is v1 >= 0 */ - mpn_sub_n (v1, v1, vm1, kk1); + ASSERT_NOCARRY (mpn_sub_n (v1, v1, vm1, kk1)); - /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v0 v1-v0-tm1 hi(vinf) tm1 (v2-vm1-3t1)/6 EMPTY */ + /* We do not need to read the value in vm1, so we add it in {c+k, ...} */ + cy = mpn_add_n (c1, c1, vm1, kk1); + MPN_INCR_U (c3 + 1, twor + k - 1, cy); /* 2n-(3k+1) = 2r+k-1 */ + /* Memory allocated for vm1 is now free, it can be recycled ...*/ /* (6) v2 <- v2 - 2*vinf, (2 1 0 0 0) - 2*(1 0 0 0 0) = (0 1 0 0 0) result is v2 >= 0 */ @@ -125,46 +129,61 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1, #ifdef HAVE_NATIVE_mpn_sublsh1_n cy = mpn_sublsh1_n (v2, v2, vinf, twor); #else - cy = mpn_lshift (ws, vinf, twor, 1); - cy += mpn_sub_n (v2, v2, ws, twor); + /* Overwrite unused vm1 */ + cy = mpn_lshift (vm1, vinf, twor, 1); + cy += mpn_sub_n (v2, v2, vm1, twor); #endif MPN_DECR_U (v2 + twor, kk1 - twor, cy); + /* Current matrix is + [1 0 0 0 0; vinf + 0 1 0 0 0; v2 + 1 0 1 0 0; v1 + 0 1 0 1 0; vm1 + 0 0 0 0 1] v0 + Some vaues already are in-place (we added vm1 in the correct position) + | vinf| v1 | v0 | + | vm1 | + One still is in a separated area + | +v2 | + We have to compute v1-=vinf; vm1 -= v2, + |-vinf| + | -v2 | + Carefully reordering operations we can avoid to compute twice the sum + of the high half of v2 plus the low half of vinf. + */ + + /* Add the high half of t2 in {vinf} */ + if ( LIKELY(twor > k + 1) ) { /* This is the expected flow */ + cy = mpn_add_n (vinf, vinf, v2 + k, k + 1); + MPN_INCR_U (c3 + kk1, twor - k - 1, cy); /* 2n-(5k+1) = 2r-k-1 */ + } else { /* triggered only by very unbalanced cases like + (k+k+(k-2))x(k+k+1) , should be handled by toom32 */ + ASSERT_NOCARRY (mpn_add_n (vinf, vinf, v2 + k, twor)); + } /* (7) v1 <- v1 - vinf, (1 0 1 0 0) - (1 0 0 0 0) = (0 0 1 0 0) result is >= 0 */ + /* Side effect: we also subtracted (high half) vm1 -= v2 */ cy = mpn_sub_n (v1, v1, vinf, twor); /* vinf is at most twor long. */ + vinf0 = vinf[0]; /* Save again the right value for vinf0 */ vinf[0] = saved; MPN_DECR_U (v1 + twor, kk1 - twor, cy); /* Treat the last bytes. */ - __GMPN_ADD_1 (cout, vinf, vinf, twor, vinf0); /* Add vinf0, propagate carry. */ - /* (8) vm1 <- vm1-t2 (0 1 0 1 0) - (0 1 0 0 0) = (0 0 0 1 0) - vm1 >= 0 + /* (8) vm1 <- vm1-v2 (0 1 0 1 0) - (0 1 0 0 0) = (0 0 0 1 0) + Operate only on the low half. */ - mpn_sub_n (vm1, vm1, v2, kk1); /* No overlapping here. */ + cy = mpn_sub_n (c1, c1, v2, k); + MPN_DECR_U (v1, kk1, cy); /********************* Beginning the final phase **********************/ - /* {c,2k} {c+2k,2k } {c+4k ,2r } {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v0 t1 hi(t1)+vinf tm1 (v2-vm1-3t1)/6 EMPTY */ - - /* (9) add t2 in {c+3k, ...} */ - cy = mpn_add_n (c3, c3, v2, kk1); - __GMPN_ADD_1 (cout, c5 + 1, c5 + 1, twor - k - 1, cy); /* 2n-(5k+1) = 2r-k-1 */ - - /* {c,2k} {c+2k,2k } {c+4k ,2r } {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r} - v0 t1 hi(t1)+vinf tm1 (v2-vm1-3t1)/6 EMPTY */ - /* c c+k c+2k c+3k c+4k t t+2k+1 t+4k+2 - v0 t1 vinf tm1 t2 - +t2 */ - - /* add vm1 in {c+k, ...} */ - cy = mpn_add_n (c1, c1, vm1, kk1); - __GMPN_ADD_1 (cout, c3 + 1, c3 + 1, twor + k - 1, cy); /* 2n-(3k+1) = 2r+k-1 */ + /* Most of the recomposition was done */ - /* c c+k c+2k c+3k c+4k t t+2k+1 t+4k+2 - v0 t1 vinf tm1 t2 - +tm1 +t2 */ + /* add t2 in {c+3k, ...}, but only the low half */ + cy = mpn_add_n (c3, c3, v2, k); + vinf[0] += cy; + ASSERT(vinf[0] >= cy); /* No carry */ + MPN_INCR_U (vinf, twor, vinf0); /* Add vinf0, propagate carry. */ #undef v0 -#undef t2 } diff --git a/contrib/gmp/mpn/generic/toom_interpolate_6pts.c b/contrib/gmp/mpn/generic/toom_interpolate_6pts.c new file mode 100644 index 0000000000..fc9ee230ee --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_interpolate_6pts.c @@ -0,0 +1,229 @@ +/* mpn_toom_interpolate_6pts -- Interpolate for toom43, 52 + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009, 2010 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +/* For odd divisors, mpn_divexact_1 works fine with two's complement. */ +#ifndef mpn_divexact_by3 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && MODLIMB_INVERSE_3 +#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,MODLIMB_INVERSE_3,0) +#else +#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3) +#endif +#endif + +/* Interpolation for Toom-3.5, using the evaluation points: infinity, + 1, -1, 2, -2. More precisely, we want to compute + f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 5, given the + six values + + w5 = f(0), + w4 = f(-1), + w3 = f(1) + w2 = f(-2), + w1 = f(2), + w0 = limit at infinity of f(x) / x^5, + + The result is stored in {pp, 5*n + w0n}. At entry, w5 is stored at + {pp, 2n}, w3 is stored at {pp + 2n, 2n+1}, and w0 is stored at + {pp + 5n, w0n}. The other values are 2n + 1 limbs each (with most + significant limbs small). f(-1) and f(-2) may be negative, signs + determined by the flag bits. All intermediate results are positive. + Inputs are destroyed. + + Interpolation sequence was taken from the paper: "Integer and + Polynomial Multiplication: Towards Optimal Toom-Cook Matrices". + Some slight variations were introduced: adaptation to "gmp + instruction set", and a final saving of an operation by interlacing + interpolation and recomposition phases. +*/ + +void +mpn_toom_interpolate_6pts (mp_ptr pp, mp_size_t n, enum toom6_flags flags, + mp_ptr w4, mp_ptr w2, mp_ptr w1, + mp_size_t w0n) +{ + mp_limb_t cy; + /* cy6 can be stored in w1[2*n], cy4 in w4[0], embankment in w2[0] */ + mp_limb_t cy4, cy6, embankment; + + ASSERT( n > 0 ); + ASSERT( 2*n >= w0n && w0n > 0 ); + +#define w5 pp /* 2n */ +#define w3 (pp + 2 * n) /* 2n+1 */ +#define w0 (pp + 5 * n) /* w0n */ + + /* Interpolate with sequence: + W2 =(W1 - W2)>>2 + W1 =(W1 - W5)>>1 + W1 =(W1 - W2)>>1 + W4 =(W3 - W4)>>1 + W2 =(W2 - W4)/3 + W3 = W3 - W4 - W5 + W1 =(W1 - W3)/3 + // Last steps are mixed with recomposition... + W2 = W2 - W0<<2 + W4 = W4 - W2 + W3 = W3 - W1 + W2 = W2 - W0 + */ + + /* W2 =(W1 - W2)>>2 */ + if (flags & toom6_vm2_neg) + mpn_add_n (w2, w1, w2, 2 * n + 1); + else + mpn_sub_n (w2, w1, w2, 2 * n + 1); + mpn_rshift (w2, w2, 2 * n + 1, 2); + + /* W1 =(W1 - W5)>>1 */ + w1[2*n] -= mpn_sub_n (w1, w1, w5, 2*n); + mpn_rshift (w1, w1, 2 * n + 1, 1); + + /* W1 =(W1 - W2)>>1 */ +#if HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (w1, w1, w2, 2 * n + 1); +#else + mpn_sub_n (w1, w1, w2, 2 * n + 1); + mpn_rshift (w1, w1, 2 * n + 1, 1); +#endif + + /* W4 =(W3 - W4)>>1 */ + if (flags & toom6_vm1_neg) + { +#if HAVE_NATIVE_mpn_rsh1add_n + mpn_rsh1add_n (w4, w3, w4, 2 * n + 1); +#else + mpn_add_n (w4, w3, w4, 2 * n + 1); + mpn_rshift (w4, w4, 2 * n + 1, 1); +#endif + } + else + { +#if HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (w4, w3, w4, 2 * n + 1); +#else + mpn_sub_n (w4, w3, w4, 2 * n + 1); + mpn_rshift (w4, w4, 2 * n + 1, 1); +#endif + } + + /* W2 =(W2 - W4)/3 */ + mpn_sub_n (w2, w2, w4, 2 * n + 1); + mpn_divexact_by3 (w2, w2, 2 * n + 1); + + /* W3 = W3 - W4 - W5 */ + mpn_sub_n (w3, w3, w4, 2 * n + 1); + w3[2 * n] -= mpn_sub_n (w3, w3, w5, 2 * n); + + /* W1 =(W1 - W3)/3 */ + mpn_sub_n (w1, w1, w3, 2 * n + 1); + mpn_divexact_by3 (w1, w1, 2 * n + 1); + + /* + [1 0 0 0 0 0; + 0 1 0 0 0 0; + 1 0 1 0 0 0; + 0 1 0 1 0 0; + 1 0 1 0 1 0; + 0 0 0 0 0 1] + + pp[] prior to operations: + |_H w0__|_L w0__|______||_H w3__|_L w3__|_H w5__|_L w5__| + + summation scheme for remaining operations: + |______________5|n_____4|n_____3|n_____2|n______|n______|pp + |_H w0__|_L w0__|______||_H w3__|_L w3__|_H w5__|_L w5__| + || H w4 | L w4 | + || H w2 | L w2 | + || H w1 | L w1 | + ||-H w1 |-L w1 | + |-H w0 |-L w0 ||-H w2 |-L w2 | + */ + cy = mpn_add_n (pp + n, pp + n, w4, 2 * n + 1); + MPN_INCR_U (pp + 3 * n + 1, n, cy); + + /* W2 -= W0<<2 */ +#if HAVE_NATIVE_mpn_sublsh_n || HAVE_NATIVE_mpn_sublsh2_n +#if HAVE_NATIVE_mpn_sublsh2_n + cy = mpn_sublsh2_n(w2, w2, w0, w0n); +#else + cy = mpn_sublsh_n(w2, w2, w0, w0n, 2); +#endif +#else + /* {W4,2*n+1} is now free and can be overwritten. */ + cy = mpn_lshift(w4, w0, w0n, 2); + cy+= mpn_sub_n(w2, w2, w4, w0n); +#endif + MPN_DECR_U (w2 + w0n, 2 * n + 1 - w0n, cy); + + /* W4L = W4L - W2L */ + cy = mpn_sub_n (pp + n, pp + n, w2, n); + MPN_DECR_U (w3, 2 * n + 1, cy); + + /* W3H = W3H + W2L */ + cy4 = w3[2 * n] + mpn_add_n (pp + 3 * n, pp + 3 * n, w2, n); + /* W1L + W2H */ + cy = w2[2 * n] + mpn_add_n (pp + 4 * n, w1, w2 + n, n); + MPN_INCR_U (w1 + n, n + 1, cy); + + /* W0 = W0 + W1H */ + if (LIKELY (w0n > n)) + cy6 = w1[2 * n] + mpn_add_n (w0, w0, w1 + n, n); + else + cy6 = mpn_add_n (w0, w0, w1 + n, w0n); + + /* + summation scheme for the next operation: + |...____5|n_____4|n_____3|n_____2|n______|n______|pp + |...w0___|_w1_w2_|_H w3__|_L w3__|_H w5__|_L w5__| + ...-w0___|-w1_w2 | + */ + /* if(LIKELY(w0n>n)) the two operands below DO overlap! */ + cy = mpn_sub_n (pp + 2 * n, pp + 2 * n, pp + 4 * n, n + w0n); + + /* embankment is a "dirty trick" to avoid carry/borrow propagation + beyond allocated memory */ + embankment = w0[w0n - 1] - 1; + w0[w0n - 1] = 1; + if (LIKELY (w0n > n)) { + if ( LIKELY(cy4 > cy6) ) + MPN_INCR_U (pp + 4 * n, w0n + n, cy4 - cy6); + else + MPN_DECR_U (pp + 4 * n, w0n + n, cy6 - cy4); + MPN_DECR_U (pp + 3 * n + w0n, 2 * n, cy); + MPN_INCR_U (w0 + n, w0n - n, cy6); + } else { + MPN_INCR_U (pp + 4 * n, w0n + n, cy4); + MPN_DECR_U (pp + 3 * n + w0n, 2 * n, cy + cy6); + } + w0[w0n - 1] += embankment; + +#undef w5 +#undef w3 +#undef w0 + +} diff --git a/contrib/gmp/mpn/generic/toom_interpolate_7pts.c b/contrib/gmp/mpn/generic/toom_interpolate_7pts.c index 872da26309..95a21940ef 100644 --- a/contrib/gmp/mpn/generic/toom_interpolate_7pts.c +++ b/contrib/gmp/mpn/generic/toom_interpolate_7pts.c @@ -1,6 +1,7 @@ /* mpn_toom_interpolate_7pts -- Interpolate for toom44, 53, 62. Contributed to the GNU project by Niels Möller. + Improvements by Marco Bodrato. THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST @@ -26,134 +27,190 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -/* Arithmetic right shift, requiring that the shifted out bits are zero. */ -static inline void -divexact_2exp (mp_ptr rp, mp_srcptr sp, mp_size_t n, unsigned shift) -{ - mp_limb_t sign; - sign = LIMB_HIGHBIT_TO_MASK (sp[n-1] << GMP_NAIL_BITS) << (GMP_NUMB_BITS - shift); - ASSERT_NOCARRY (mpn_rshift (rp, sp, n, shift)); - rp[n-1] |= sign & GMP_NUMB_MASK; -} +#define BINVERT_3 MODLIMB_INVERSE_3 + +#define BINVERT_9 \ + ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39) + +#define BINVERT_15 \ + ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15)) + +/* For the various mpn_divexact_byN here, fall back to using either + mpn_pi1_bdiv_q_1 or mpn_divexact_1. The former has less overhead and is + many faster if it is native. For now, since mpn_divexact_1 is native on + several platforms where mpn_pi1_bdiv_q_1 does not yet exist, do not use + mpn_pi1_bdiv_q_1 unconditionally. FIXME. */ /* For odd divisors, mpn_divexact_1 works fine with two's complement. */ #ifndef mpn_divexact_by3 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,BINVERT_3,0) +#else #define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3) #endif +#endif + #ifndef mpn_divexact_by9 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by9(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,9,BINVERT_9,0) +#else #define mpn_divexact_by9(dst,src,size) mpn_divexact_1(dst,src,size,9) #endif +#endif + #ifndef mpn_divexact_by15 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by15(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,15,BINVERT_15,0) +#else #define mpn_divexact_by15(dst,src,size) mpn_divexact_1(dst,src,size,15) #endif +#endif -/* Interpolation for toom4, using the evaluation points infinity, 2, - 1, -1, 1/2, -1/2. More precisely, we want to compute +/* Interpolation for toom4, using the evaluation points 0, infinity, + 1, -1, 2, -2, 1/2. More precisely, we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 6, given the seven values w0 = f(0), - w1 = 64 f(-1/2), - w2 = 64 f(1/2), + w1 = f(-2), + w2 = f(1), w3 = f(-1), - w4 = f(1) - w5 = f(2) + w4 = f(2) + w5 = 64 * f(1/2) w6 = limit at infinity of f(x) / x^6, The result is 6*n + w6n limbs. At entry, w0 is stored at {rp, 2n }, w2 is stored at { rp + 2n, 2n+1 }, and w6 is stored at { rp + 6n, w6n }. The other values are 2n + 1 limbs each (with most significant limbs small). f(-1) and f(-1/2) may be negative, signs - determined by the flag bits. All intermediate results are - represented in two's complement. Inputs are destroyed. + determined by the flag bits. Inputs are destroyed. Needs (2*n + 1) limbs of temporary storage. */ void -mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom4_flags flags, +mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags, mp_ptr w1, mp_ptr w3, mp_ptr w4, mp_ptr w5, mp_size_t w6n, mp_ptr tp) { - mp_size_t m = 2*n + 1; - mp_ptr w2 = rp + 2*n; - mp_ptr w6 = rp + 6*n; + mp_size_t m; mp_limb_t cy; + m = 2*n + 1; +#define w0 rp +#define w2 (rp + 2*n) +#define w6 (rp + 6*n) + ASSERT (w6n > 0); ASSERT (w6n <= 2*n); - /* Using Marco Bodrato's formulas + /* Using formulas similar to Marco Bodrato's - W5 = W5 + W2 - W3 =(W3 + W4)/2 - W1 = W1 + W2 - W2 = W2 - W6 - W0*64 - W2 =(W2*2 - W1)/8 - W4 = W4 - W3 + W5 = W5 + W4 + W1 =(W4 - W1)/2 + W4 = W4 - W0 + W4 =(W4 - W1)/4 - W6*16 + W3 =(W2 - W3)/2 + W2 = W2 - W3 - W5 = W5 - W4*65 - W4 = W4 - W6 - W0 - W5 = W5 + W4*45 - W2 =(W2 - W4)/3 - W4 = W4 - W2 + W5 = W5 - W2*65 May be negative. + W2 = W2 - W6 - W0 + W5 =(W5 + W2*45)/2 Now >= 0 again. + W4 =(W4 - W2)/3 + W2 = W2 - W4 - W1 = W1 - W5 - W5 =(W5 - W3*16)/ 18 + W1 = W5 - W1 May be negative. + W5 =(W5 - W3*8)/9 W3 = W3 - W5 - W1 =(W1/30 + W5)/ 2 + W1 =(W1/15 + W5)/2 Now >= 0 again. W5 = W5 - W1 - where W0 = f(0), W1 = 64 f(-1/2), W2 = 64 f(1/2), W3 = f(-1), - W4 = f(1), W5 = f(2), W6 = f(oo), + where W0 = f(0), W1 = f(-2), W2 = f(1), W3 = f(-1), + W4 = f(2), W5 = f(1/2), W6 = f(oo), + + Note that most intermediate results are positive; the ones that + may be negative are represented in two's complement. We must + never shift right a value that may be negative, since that would + invalidate the sign bit. On the other hand, divexact by odd + numbers work fine with two's complement. */ - mpn_add_n (w5, w5, w2, m); - if (flags & toom4_w3_neg) - mpn_add_n (w3, w3, w4, m); + mpn_add_n (w5, w5, w4, m); + if (flags & toom7_w1_neg) + { +#ifdef HAVE_NATIVE_mpn_rsh1add_n + mpn_rsh1add_n (w1, w1, w4, m); +#else + mpn_add_n (w1, w1, w4, m); ASSERT (!(w1[0] & 1)); + mpn_rshift (w1, w1, m, 1); +#endif + } else - mpn_sub_n (w3, w4, w3, m); - divexact_2exp (w3, w3, m, 1); - if (flags & toom4_w1_neg) - mpn_add_n (w1, w1, w2, m); + { +#ifdef HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (w1, w4, w1, m); +#else + mpn_sub_n (w1, w4, w1, m); ASSERT (!(w1[0] & 1)); + mpn_rshift (w1, w1, m, 1); +#endif + } + mpn_sub (w4, w4, m, w0, 2*n); + mpn_sub_n (w4, w4, w1, m); ASSERT (!(w4[0] & 3)); + mpn_rshift (w4, w4, m, 2); /* w4>=0 */ + + tp[w6n] = mpn_lshift (tp, w6, w6n, 4); + mpn_sub (w4, w4, m, tp, w6n+1); + + if (flags & toom7_w3_neg) + { +#ifdef HAVE_NATIVE_mpn_rsh1add_n + mpn_rsh1add_n (w3, w3, w2, m); +#else + mpn_add_n (w3, w3, w2, m); ASSERT (!(w3[0] & 1)); + mpn_rshift (w3, w3, m, 1); +#endif + } else - mpn_sub_n (w1, w2, w1, m); + { +#ifdef HAVE_NATIVE_mpn_rsh1sub_n + mpn_rsh1sub_n (w3, w2, w3, m); +#else + mpn_sub_n (w3, w2, w3, m); ASSERT (!(w3[0] & 1)); + mpn_rshift (w3, w3, m, 1); +#endif + } + + mpn_sub_n (w2, w2, w3, m); + + mpn_submul_1 (w5, w2, m, 65); mpn_sub (w2, w2, m, w6, w6n); - tp[2*n] = mpn_lshift (tp, rp, 2*n, 6); - mpn_sub_n (w2, w2, tp, m); - mpn_lshift (w2, w2, m, 1); - mpn_sub_n (w2, w2, w1, m); - divexact_2exp (w2, w2, m, 3); - mpn_sub_n (w4, w4, w3, m); - - mpn_submul_1 (w5, w4, m, 65); - mpn_sub (w4, w4, m, w6, w6n); - mpn_sub (w4, w4, m, rp, 2*n); - mpn_addmul_1 (w5, w4, m, 45); - mpn_sub_n (w2, w2, w4, m); - /* Rely on divexact working with two's complement */ - mpn_divexact_by3 (w2, w2, m); + mpn_sub (w2, w2, m, w0, 2*n); + + mpn_addmul_1 (w5, w2, m, 45); ASSERT (!(w5[0] & 1)); + mpn_rshift (w5, w5, m, 1); mpn_sub_n (w4, w4, w2, m); - mpn_sub_n (w1, w1, w5, m); - mpn_lshift (tp, w3, m, 4); + mpn_divexact_by3 (w4, w4, m); + mpn_sub_n (w2, w2, w4, m); + + mpn_sub_n (w1, w5, w1, m); + mpn_lshift (tp, w3, m, 3); mpn_sub_n (w5, w5, tp, m); - divexact_2exp (w5, w5, m, 1); mpn_divexact_by9 (w5, w5, m); mpn_sub_n (w3, w3, w5, m); - divexact_2exp (w1, w1, m, 1); + mpn_divexact_by15 (w1, w1, m); - mpn_add_n (w1, w1, w5, m); - divexact_2exp (w1, w1, m, 1); + mpn_add_n (w1, w1, w5, m); ASSERT (!(w1[0] & 1)); + mpn_rshift (w1, w1, m, 1); /* w1>=0 now */ mpn_sub_n (w5, w5, w1, m); - /* Two's complement coefficients must be non-negative at the end of - this procedure. */ - ASSERT ( !(w1[2*n] & GMP_LIMB_HIGHBIT)); - ASSERT ( !(w2[2*n] & GMP_LIMB_HIGHBIT)); - ASSERT ( !(w3[2*n] & GMP_LIMB_HIGHBIT)); - ASSERT ( !(w4[2*n] & GMP_LIMB_HIGHBIT)); - ASSERT ( !(w5[2*n] & GMP_LIMB_HIGHBIT)); + /* These bounds are valid for the 4x4 polynomial product of toom44, + * and they are conservative for toom53 and toom62. */ + ASSERT (w1[2*n] < 2); + ASSERT (w2[2*n] < 3); + ASSERT (w3[2*n] < 4); + ASSERT (w4[2*n] < 3); + ASSERT (w5[2*n] < 2); /* Addition chain. Note carries and the 2n'th limbs that need to be * added in. @@ -174,8 +231,8 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom4_flags flags, * c7 c6 c5 c4 c3 Carries to propagate */ - cy = mpn_add_n (rp + n, rp + n, w1, 2*n); - MPN_INCR_U (w2 + n, n + 1, w1[2*n] + cy); + cy = mpn_add_n (rp + n, rp + n, w1, m); + MPN_INCR_U (w2 + n + 1, n , cy); cy = mpn_add_n (rp + 3*n, rp + 3*n, w3, n); MPN_INCR_U (w3 + n, n + 1, w2[2*n] + cy); cy = mpn_add_n (rp + 4*n, w3 + n, w4, n); @@ -183,10 +240,7 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom4_flags flags, cy = mpn_add_n (rp + 5*n, w4 + n, w5, n); MPN_INCR_U (w5 + n, n + 1, w4[2*n] + cy); if (w6n > n + 1) - { - mp_limb_t c7 = mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, n + 1); - MPN_INCR_U (rp + 7*n + 1, w6n - n - 1, c7); - } + ASSERT_NOCARRY (mpn_add (rp + 6*n, rp + 6*n, w6n, w5 + n, n + 1)); else { ASSERT_NOCARRY (mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, w6n)); diff --git a/contrib/gmp/mpn/generic/toom_interpolate_8pts.c b/contrib/gmp/mpn/generic/toom_interpolate_8pts.c new file mode 100644 index 0000000000..9667f51037 --- /dev/null +++ b/contrib/gmp/mpn/generic/toom_interpolate_8pts.c @@ -0,0 +1,192 @@ +/* mpn_toom_interpolate_8pts -- Interpolate for toom54, 63, 72. + + Contributed to the GNU project by Marco Bodrato. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +#include "gmp.h" +#include "gmp-impl.h" + +#define BINVERT_3 MODLIMB_INVERSE_3 + +#define BINVERT_15 \ + ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15) + +#define BINVERT_45 ((BINVERT_15 * BINVERT_3) & GMP_NUMB_MASK) + +#ifndef mpn_divexact_by3 +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,BINVERT_3,0) +#else +#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3) +#endif +#endif + +#ifndef mpn_divexact_by45 +#if GMP_NUMB_BITS % 12 == 0 +#define mpn_divexact_by45(dst,src,size) \ + (63 & 19 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 45))) +#else +#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 +#define mpn_divexact_by45(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,45,BINVERT_45,0) +#else +#define mpn_divexact_by45(dst,src,size) mpn_divexact_1(dst,src,size,45) +#endif +#endif +#endif + +#if HAVE_NATIVE_mpn_sublsh_n +#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n (dst,src,n,s) +#else +static mp_limb_t +DO_mpn_sublsh_n (mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws) +{ +#if USE_MUL_1 + return mpn_submul_1(dst,src,n,CNST_LIMB(1) <<(s)); +#else + mp_limb_t __cy; + __cy = mpn_lshift (ws,src,n,s); + return __cy + mpn_sub_n (dst,dst,ws,n); +#endif +} +#endif + + +#if HAVE_NATIVE_mpn_subrsh +#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh (dst,nd,src,ns,s) +#else +/* This is not a correct definition, it assumes no carry */ +#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) \ +do { \ + mp_limb_t __cy; \ + MPN_DECR_U (dst, nd, src[0] >> s); \ + __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \ + MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \ +} while (0) +#endif + +/* Interpolation for Toom-4.5 (or Toom-4), using the evaluation + points: infinity(4.5 only), 4, -4, 2, -2, 1, -1, 0. More precisely, + we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of + degree 7 (or 6), given the 8 (rsp. 7) values: + + r1 = limit at infinity of f(x) / x^7, + r2 = f(4), + r3 = f(-4), + r4 = f(2), + r5 = f(-2), + r6 = f(1), + r7 = f(-1), + r8 = f(0). + + All couples of the form f(n),f(-n) must be already mixed with + toom_couple_handling(f(n),...,f(-n),...) + + The result is stored in {pp, spt + 7*n (or 6*n)}. + At entry, r8 is stored at {pp, 2n}, + r5 is stored at {pp + 3n, 3n + 1}. + + The other values are 2n+... limbs each (with most significant limbs small). + + All intermediate results are positive. + Inputs are destroyed. +*/ + +void +mpn_toom_interpolate_8pts (mp_ptr pp, mp_size_t n, + mp_ptr r3, mp_ptr r7, + mp_size_t spt, mp_ptr ws) +{ + mp_limb_signed_t cy; + mp_ptr r5, r1; + r5 = (pp + 3 * n); /* 3n+1 */ + r1 = (pp + 7 * n); /* spt */ + + /******************************* interpolation *****************************/ + + DO_mpn_subrsh(r3+n, 2 * n + 1, pp, 2 * n, 4, ws); + cy = DO_mpn_sublsh_n (r3, r1, spt, 12, ws); + MPN_DECR_U (r3 + spt, 3 * n + 1 - spt, cy); + + DO_mpn_subrsh(r5+n, 2 * n + 1, pp, 2 * n, 2, ws); + cy = DO_mpn_sublsh_n (r5, r1, spt, 6, ws); + MPN_DECR_U (r5 + spt, 3 * n + 1 - spt, cy); + + r7[3*n] -= mpn_sub_n (r7+n, r7+n, pp, 2 * n); + cy = mpn_sub_n (r7, r7, r1, spt); + MPN_DECR_U (r7 + spt, 3 * n + 1 - spt, cy); + + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, 3 * n + 1)); + ASSERT_NOCARRY(mpn_rshift(r3, r3, 3 * n + 1, 2)); + + ASSERT_NOCARRY(mpn_sub_n (r5, r5, r7, 3 * n + 1)); + + ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, 3 * n + 1)); + + mpn_divexact_by45 (r3, r3, 3 * n + 1); + + ASSERT_NOCARRY(mpn_divexact_by3 (r5, r5, 3 * n + 1)); + + ASSERT_NOCARRY(DO_mpn_sublsh_n (r5, r3, 3 * n + 1, 2, ws)); + + /* last interpolation steps... */ + /* ... are mixed with recomposition */ + + /***************************** recomposition *******************************/ + /* + pp[] prior to operations: + |_H r1|_L r1|____||_H r5|_M_r5|_L r5|_____|_H r8|_L r8|pp + + summation scheme for remaining operations: + |____8|n___7|n___6|n___5|n___4|n___3|n___2|n____|n____|pp + |_H r1|_L r1|____||_H*r5|_M r5|_L r5|_____|_H_r8|_L r8|pp + ||_H r3|_M r3|_L*r3| + ||_H_r7|_M_r7|_L_r7| + ||-H r3|-M r3|-L*r3| + ||-H*r5|-M_r5|-L_r5| + */ + + cy = mpn_add_n (pp + n, pp + n, r7, n); /* Hr8+Lr7-Lr5 */ + cy-= mpn_sub_n (pp + n, pp + n, r5, n); + if (0 > cy) + MPN_DECR_U (r7 + n, 2*n + 1, 1); + else + MPN_INCR_U (r7 + n, 2*n + 1, cy); + + cy = mpn_sub_n (pp + 2*n, r7 + n, r5 + n, n); /* Mr7-Mr5 */ + MPN_DECR_U (r7 + 2*n, n + 1, cy); + + cy = mpn_add_n (pp + 3*n, r5, r7+ 2*n, n+1); /* Hr7+Lr5 */ + r5[3*n]+= mpn_add_n (r5 + 2*n, r5 + 2*n, r3, n); /* Hr5+Lr3 */ + cy-= mpn_sub_n (pp + 3*n, pp + 3*n, r5 + 2*n, n+1); /* Hr7-Hr5+Lr5-Lr3 */ + if (UNLIKELY(0 > cy)) + MPN_DECR_U (r5 + n + 1, 2*n, 1); + else + MPN_INCR_U (r5 + n + 1, 2*n, cy); + + ASSERT_NOCARRY(mpn_sub_n(pp + 4*n, r5 + n, r3 + n, 2*n +1)); /* Mr5-Mr3,Hr5-Hr3 */ + + cy = mpn_add_1 (pp + 6*n, r3 + n, n, pp[6*n]); + MPN_INCR_U (r3 + 2*n, n + 1, cy); + cy = r3[3*n] + mpn_add_n (pp + 7*n, pp + 7*n, r3 + 2*n, n); + MPN_INCR_U (pp + 8*n, spt - n, cy); +} diff --git a/contrib/gmp/mpn/generic/trialdiv.c b/contrib/gmp/mpn/generic/trialdiv.c new file mode 100644 index 0000000000..c8f3c5d376 --- /dev/null +++ b/contrib/gmp/mpn/generic/trialdiv.c @@ -0,0 +1,110 @@ +/* mpn_trialdiv -- find small factors of an mpn number using trial division. + + Contributed to the GNU project by Torbjorn Granlund. + + THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY + SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +/* + Fast, division-free trial division for GMP. + + This function will find the first (smallest) factor represented in + trialdivtab.h. It does not stop the factoring effort just because it has + reached some sensible limit, such as the square root of the input number. + + The caller can limit the factoring effort by passing NPRIMES. The function + well then divide to *at least* that limit. A position which only + mpn_trialdiv can make sense of is returned in the WHERE parameter. It can + be used for restarting the factoring effort; the first call should pass 0 + here. +*/ + +#include "gmp.h" +#include "gmp-impl.h" + +struct gmp_primes_dtab { + mp_limb_t binv; + mp_limb_t lim; +}; + +struct gmp_primes_ptab { + mp_limb_t ppp; /* primes, multiplied together */ + mp_limb_t cps[7]; /* ppp values pre-computed for mpn_mod_1s_4p */ + unsigned int idx:24; /* index of first primes in dtab */ + unsigned int np :8; /* number of primes related to this entry */ +}; + +#define P(p,inv,lim) {inv,lim} + +#include "trialdivtab.h" + +#define PTAB_LINES (sizeof (gmp_primes_ptab) / sizeof (gmp_primes_ptab[0])) + +/* Attempt to find a factor of T using trial division. + Input: A non-negative number T. + Output: non-zero if we found a factor, zero otherwise. To get the actual + prime factor, compute the mod B inverse of the return value. */ +/* FIXME: We could optimize out one of the outer loop conditions if we + had a final ptab entry with a huge nd field. */ +mp_limb_t +mpn_trialdiv (mp_srcptr tp, mp_size_t tn, mp_size_t nprimes, int *where) +{ + mp_limb_t ppp; + mp_limb_t *cps; + struct gmp_primes_dtab *dp; + long i, j, idx, np; + mp_limb_t r, q; + + ASSERT (tn >= 1); + + for (i = *where; i < PTAB_LINES; i++) + { + ppp = gmp_primes_ptab[i].ppp; + cps = gmp_primes_ptab[i].cps; + +#if __GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 4 + if (tn < 4) + r = mpn_mod_1 (tp, tn, ppp); /* FIXME */ + else +#endif + r = mpn_mod_1s_4p (tp, tn, ppp << cps[1], cps); + + idx = gmp_primes_ptab[i].idx; + np = gmp_primes_ptab[i].np; + + /* Check divisibility by individual primes. */ + dp = &gmp_primes_dtab[idx] + np; + for (j = -np; j < 0; j++) + { + q = r * dp[j].binv; + if (q <= dp[j].lim) + { + *where = i; + return dp[j].binv; + } + } + + nprimes -= np; + if (nprimes <= 0) + return 0; + } + return 0; +} diff --git a/contrib/gmp/mpn/generic/udiv_w_sdiv.c b/contrib/gmp/mpn/generic/udiv_w_sdiv.c index f876aa5734..c01f958474 100644 --- a/contrib/gmp/mpn/generic/udiv_w_sdiv.c +++ b/contrib/gmp/mpn/generic/udiv_w_sdiv.c @@ -42,7 +42,7 @@ mpn_udiv_w_sdiv (rp, a1, a0, d) if ((mp_limb_signed_t) d >= 0) { - if (a1 < d - a1 - (a0 >> (BITS_PER_MP_LIMB - 1))) + if (a1 < d - a1 - (a0 >> (GMP_LIMB_BITS - 1))) { /* dividend, divisor, and quotient are nonnegative */ sdiv_qrnnd (q, r, a1, a0, d); @@ -50,18 +50,18 @@ mpn_udiv_w_sdiv (rp, a1, a0, d) else { /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */ - sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (BITS_PER_MP_LIMB - 1)); + sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (GMP_LIMB_BITS - 1)); /* Divide (c1*2^32 + c0) by d */ sdiv_qrnnd (q, r, c1, c0, d); /* Add 2^31 to quotient */ - q += (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1); + q += (mp_limb_t) 1 << (GMP_LIMB_BITS - 1); } } else { b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */ c1 = a1 >> 1; /* A/2 */ - c0 = (a1 << (BITS_PER_MP_LIMB - 1)) + (a0 >> 1); + c0 = (a1 << (GMP_LIMB_BITS - 1)) + (a0 >> 1); if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */ { diff --git a/contrib/gmp/mpn/generic/neg_n.c b/contrib/gmp/mpn/generic/zero.c similarity index 81% rename from contrib/gmp/mpn/generic/neg_n.c rename to contrib/gmp/mpn/generic/zero.c index 1609204c90..4f12b00c2c 100644 --- a/contrib/gmp/mpn/generic/neg_n.c +++ b/contrib/gmp/mpn/generic/zero.c @@ -1,6 +1,6 @@ -/* mpn_neg_n - negate an mpn. +/* mpn_zero -Copyright 2001, 2009 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -17,7 +17,15 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define __GMP_FORCE_mpn_neg_n 1 - #include "gmp.h" #include "gmp-impl.h" + +void +mpn_zero (mp_ptr rp, mp_size_t n) +{ + mp_size_t i; + + rp += n; + for (i = -n; i != 0; i++) + rp[i] = 0; +} diff --git a/contrib/gmp/mpq/Makefile.am b/contrib/gmp/mpq/Makefile.am deleted file mode 100644 index 2ce3853f07..0000000000 --- a/contrib/gmp/mpq/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) - -noinst_LTLIBRARIES = libmpq.la -libmpq_la_SOURCES = \ - abs.c aors.c canonicalize.c clear.c \ - cmp.c cmp_si.c cmp_ui.c div.c equal.c \ - get_d.c get_den.c get_num.c get_str.c \ - init.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \ - set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \ - set_f.c swap.c diff --git a/contrib/gmp/mpq/Makefile.in b/contrib/gmp/mpq/Makefile.in deleted file mode 100644 index c80bafc208..0000000000 --- a/contrib/gmp/mpq/Makefile.in +++ /dev/null @@ -1,562 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(libmpq_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -subdir = mpq -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libmpq_la_LIBADD = -am_libmpq_la_OBJECTS = abs$U.lo aors$U.lo canonicalize$U.lo clear$U.lo \ - cmp$U.lo cmp_si$U.lo cmp_ui$U.lo div$U.lo equal$U.lo \ - get_d$U.lo get_den$U.lo get_num$U.lo get_str$U.lo init$U.lo \ - inp_str$U.lo inv$U.lo md_2exp$U.lo mul$U.lo neg$U.lo \ - out_str$U.lo set$U.lo set_den$U.lo set_num$U.lo set_si$U.lo \ - set_str$U.lo set_ui$U.lo set_z$U.lo set_d$U.lo set_f$U.lo \ - swap$U.lo -libmpq_la_OBJECTS = $(am_libmpq_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmpq_la_SOURCES) -DIST_SOURCES = $(libmpq_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) -noinst_LTLIBRARIES = libmpq.la -libmpq_la_SOURCES = \ - abs.c aors.c canonicalize.c clear.c \ - cmp.c cmp_si.c cmp_ui.c div.c equal.c \ - get_d.c get_den.c get_num.c get_str.c \ - init.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \ - set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \ - set_f.c swap.c - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmpq.la: $(libmpq_la_OBJECTS) $(libmpq_la_DEPENDENCIES) - $(LINK) $(libmpq_la_LDFLAGS) $(libmpq_la_OBJECTS) $(libmpq_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -abs_.c: abs.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -aors_.c: aors.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aors.c; then echo $(srcdir)/aors.c; else echo aors.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -canonicalize_.c: canonicalize.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/canonicalize.c; then echo $(srcdir)/canonicalize.c; else echo canonicalize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -clear_.c: clear.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_.c: cmp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_si_.c: cmp_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_ui_.c: cmp_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -div_.c: div.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div.c; then echo $(srcdir)/div.c; else echo div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -equal_.c: equal.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/equal.c; then echo $(srcdir)/equal.c; else echo equal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_.c: get_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_den_.c: get_den.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_den.c; then echo $(srcdir)/get_den.c; else echo get_den.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_num_.c: get_num.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_num.c; then echo $(srcdir)/get_num.c; else echo get_num.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_str_.c: get_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -init_.c: init.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -inp_str_.c: inp_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -inv_.c: inv.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inv.c; then echo $(srcdir)/inv.c; else echo inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -md_2exp_.c: md_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/md_2exp.c; then echo $(srcdir)/md_2exp.c; else echo md_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_.c: mul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -neg_.c: neg.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -out_str_.c: out_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_.c: set.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_d_.c: set_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_den_.c: set_den.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_den.c; then echo $(srcdir)/set_den.c; else echo set_den.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_f_.c: set_f.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_f.c; then echo $(srcdir)/set_f.c; else echo set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_num_.c: set_num.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_num.c; then echo $(srcdir)/set_num.c; else echo set_num.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_si_.c: set_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_str_.c: set_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_ui_.c: set_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_z_.c: set_z.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_z.c; then echo $(srcdir)/set_z.c; else echo set_z.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -swap_.c: swap.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -abs_.$(OBJEXT) abs_.lo aors_.$(OBJEXT) aors_.lo \ -canonicalize_.$(OBJEXT) canonicalize_.lo clear_.$(OBJEXT) clear_.lo \ -cmp_.$(OBJEXT) cmp_.lo cmp_si_.$(OBJEXT) cmp_si_.lo cmp_ui_.$(OBJEXT) \ -cmp_ui_.lo div_.$(OBJEXT) div_.lo equal_.$(OBJEXT) equal_.lo \ -get_d_.$(OBJEXT) get_d_.lo get_den_.$(OBJEXT) get_den_.lo \ -get_num_.$(OBJEXT) get_num_.lo get_str_.$(OBJEXT) get_str_.lo \ -init_.$(OBJEXT) init_.lo inp_str_.$(OBJEXT) inp_str_.lo inv_.$(OBJEXT) \ -inv_.lo md_2exp_.$(OBJEXT) md_2exp_.lo mul_.$(OBJEXT) mul_.lo \ -neg_.$(OBJEXT) neg_.lo out_str_.$(OBJEXT) out_str_.lo set_.$(OBJEXT) \ -set_.lo set_d_.$(OBJEXT) set_d_.lo set_den_.$(OBJEXT) set_den_.lo \ -set_f_.$(OBJEXT) set_f_.lo set_num_.$(OBJEXT) set_num_.lo \ -set_si_.$(OBJEXT) set_si_.lo set_str_.$(OBJEXT) set_str_.lo \ -set_ui_.$(OBJEXT) set_ui_.lo set_z_.$(OBJEXT) set_z_.lo \ -swap_.$(OBJEXT) swap_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpq/clears.c similarity index 58% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpq/clears.c index 3072cd40f9..0aa8b57c81 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpq/clears.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpq_clears() -- Clear multiple mpq_t variables. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpq_clears (mpq_ptr x, ...) +#else +mpq_clears (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpq_ptr x; + va_start (ap); + x = va_arg (ap, mpq_ptr); +#endif + + while (x != NULL) + { + mpq_clear (x); + x = va_arg (ap, mpq_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpq/cmp.c b/contrib/gmp/mpq/cmp.c index 2ee540cad5..1844c2970d 100644 --- a/contrib/gmp/mpq/cmp.c +++ b/contrib/gmp/mpq/cmp.c @@ -68,7 +68,7 @@ mpq_cmp (const MP_RAT *op1, const MP_RAT *op2) /* 2. Same, but compare the number of significant bits. */ { int cnt1, cnt2; - unsigned long int bits1, bits2; + mp_bitcnt_t bits1, bits2; count_leading_zeros (cnt1, op1->_mp_num._mp_d[num1_size - 1]); count_leading_zeros (cnt2, op2->_mp_den._mp_d[den2_size - 1]); diff --git a/contrib/gmp/mpq/cmp_ui.c b/contrib/gmp/mpq/cmp_ui.c index c15640515c..8e0b1af1b8 100644 --- a/contrib/gmp/mpq/cmp_ui.c +++ b/contrib/gmp/mpq/cmp_ui.c @@ -70,8 +70,8 @@ _mpq_cmp_ui (const MP_RAT *op1, unsigned long int num2, unsigned long int den2) return -num1_size; TMP_MARK; - tmp1_ptr = (mp_ptr) TMP_ALLOC ((num1_size + 1) * BYTES_PER_MP_LIMB); - tmp2_ptr = (mp_ptr) TMP_ALLOC ((den1_size + 1) * BYTES_PER_MP_LIMB); + tmp1_ptr = TMP_ALLOC_LIMBS (num1_size + 1); + tmp2_ptr = TMP_ALLOC_LIMBS (den1_size + 1); cy_limb = mpn_mul_1 (tmp1_ptr, op1->_mp_num._mp_d, num1_size, (mp_limb_t) den2); diff --git a/contrib/gmp/mpq/get_d.c b/contrib/gmp/mpq/get_d.c index c8f91ca4d8..0caefed896 100644 --- a/contrib/gmp/mpq/get_d.c +++ b/contrib/gmp/mpq/get_d.c @@ -39,7 +39,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Enhancements: - Use the true mantissa size in the N_QLIMBS formala, to save a divide step + Use the true mantissa size in the N_QLIMBS formula, to save a divide step in nails. Examine the high limbs of num and den to see if the highest 1 bit of the diff --git a/contrib/gmp/mpq/get_str.c b/contrib/gmp/mpq/get_str.c index 9b3f7ffbb5..68ca34f6f8 100644 --- a/contrib/gmp/mpq/get_str.c +++ b/contrib/gmp/mpq/get_str.c @@ -37,8 +37,8 @@ mpq_get_str (char *str, int base, mpq_srcptr q) the high limbs of num and den are used. +2 for rounding up the chars per bit of num and den. +3 for sign, slash and '\0'. */ str_alloc = ((size_t) ((ABS (q->_mp_num._mp_size) + q->_mp_den._mp_size) - * BITS_PER_MP_LIMB - * __mp_bases[ABS(base)].chars_per_bit_exactly)) + * GMP_LIMB_BITS + * mp_bases[ABS(base)].chars_per_bit_exactly)) + 5; str = (char *) (*__gmp_allocate_func) (str_alloc); } diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpq/inits.c similarity index 57% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpq/inits.c index 3072cd40f9..851daaa454 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpq/inits.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpq_inits() -- Initialize multiple mpq_t variables and set them to 0. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpq_inits (mpq_ptr x, ...) +#else +mpq_inits (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpq_ptr x; + va_start (ap); + x = va_arg (ap, mpq_ptr); +#endif + + while (x != NULL) + { + mpq_init (x); + x = va_arg (ap, mpq_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpq/md_2exp.c b/contrib/gmp/mpq/md_2exp.c index 87eba75ac4..6179ca3f0f 100644 --- a/contrib/gmp/mpq/md_2exp.c +++ b/contrib/gmp/mpq/md_2exp.c @@ -29,7 +29,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ static void mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc, - unsigned long n) + mp_bitcnt_t n) { mp_size_t rsrc_size = SIZ(rsrc); mp_size_t len = ABS (rsrc_size); @@ -81,14 +81,14 @@ mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc, void -mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n) +mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n) { mord_2exp (mpq_numref (dst), mpq_denref (dst), mpq_numref (src), mpq_denref (src), n); } void -mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n) +mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n) { if (SIZ (mpq_numref(src)) == 0) { diff --git a/contrib/gmp/mpq/set_f.c b/contrib/gmp/mpq/set_f.c index 692e13c983..ba15844aba 100644 --- a/contrib/gmp/mpq/set_f.c +++ b/contrib/gmp/mpq/set_f.c @@ -60,7 +60,7 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f) } else { - /* radix point is within or to the left of the limbs, use demominator */ + /* radix point is within or to the left of the limbs, use denominator */ mp_ptr num_ptr, den_ptr; mp_size_t den_size; diff --git a/contrib/gmp/mpq/set_si.c b/contrib/gmp/mpq/set_si.c index 1bcf329c50..8fe5540a29 100644 --- a/contrib/gmp/mpq/set_si.c +++ b/contrib/gmp/mpq/set_si.c @@ -1,4 +1,4 @@ -/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the retional number +/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the rational number ULONG_NUM/ULONG_DEN. Copyright 1991, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. diff --git a/contrib/gmp/mpz/Makefile.am b/contrib/gmp/mpz/Makefile.am deleted file mode 100644 index 3a38284a2f..0000000000 --- a/contrib/gmp/mpz/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software -# Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) - -noinst_LTLIBRARIES = libmpz.la -libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \ - add.c add_ui.c abs.c aorsmul.c aorsmul_i.c and.c array_init.c \ - bin_ui.c bin_uiui.c cdiv_q.c \ - cdiv_q_ui.c cdiv_qr.c cdiv_qr_ui.c cdiv_r.c cdiv_r_ui.c cdiv_ui.c \ - cfdiv_q_2exp.c cfdiv_r_2exp.c \ - clear.c clrbit.c \ - cmp.c cmp_d.c cmp_si.c cmp_ui.c cmpabs.c cmpabs_d.c cmpabs_ui.c \ - com.c combit.c \ - cong.c cong_2exp.c cong_ui.c \ - divexact.c divegcd.c dive_ui.c divis.c divis_ui.c divis_2exp.c \ - dump.c export.c fac_ui.c fdiv_q.c fdiv_q_ui.c \ - fdiv_qr.c fdiv_qr_ui.c fdiv_r.c fdiv_r_ui.c fdiv_ui.c \ - fib_ui.c fib2_ui.c \ - fits_sint.c fits_slong.c fits_sshort.c \ - fits_uint.c fits_ulong.c fits_ushort.c \ - gcd.c gcd_ui.c gcdext.c get_d.c get_d_2exp.c get_si.c \ - get_str.c get_ui.c getlimbn.c hamdist.c \ - import.c init.c init2.c inp_raw.c inp_str.c \ - invert.c ior.c iset.c iset_d.c iset_si.c iset_str.c iset_ui.c \ - jacobi.c kronsz.c kronuz.c kronzs.c kronzu.c \ - lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c millerrabin.c \ - mod.c mul.c mul_2exp.c mul_si.c mul_ui.c n_pow_ui.c neg.c nextprime.c \ - out_raw.c out_str.c perfpow.c perfsqr.c popcount.c pow_ui.c powm.c \ - powm_ui.c pprime_p.c random.c random2.c \ - realloc.c realloc2.c remove.c root.c rootrem.c rrandomb.c \ - scan0.c scan1.c set.c set_d.c set_f.c set_q.c set_si.c set_str.c \ - set_ui.c setbit.c size.c sizeinbase.c sqrt.c sqrtrem.c sub.c sub_ui.c \ - swap.c tdiv_ui.c tdiv_q.c tdiv_q_2exp.c tdiv_q_ui.c tdiv_qr.c \ - tdiv_qr_ui.c tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c tstbit.c ui_pow_ui.c \ - ui_sub.c urandomb.c urandomm.c xor.c - -# These are BUILT_SOURCES at the top-level, so normally they're built before -# recursing into this directory. -# -fac_ui.h: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpz/fac_ui.h diff --git a/contrib/gmp/mpz/Makefile.in b/contrib/gmp/mpz/Makefile.in deleted file mode 100644 index 9159c4df6d..0000000000 --- a/contrib/gmp/mpz/Makefile.in +++ /dev/null @@ -1,906 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software -# Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(libmpz_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -subdir = mpz -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libmpz_la_LIBADD = -am_libmpz_la_OBJECTS = add$U.lo add_ui$U.lo abs$U.lo aorsmul$U.lo \ - aorsmul_i$U.lo and$U.lo array_init$U.lo bin_ui$U.lo \ - bin_uiui$U.lo cdiv_q$U.lo cdiv_q_ui$U.lo cdiv_qr$U.lo \ - cdiv_qr_ui$U.lo cdiv_r$U.lo cdiv_r_ui$U.lo cdiv_ui$U.lo \ - cfdiv_q_2exp$U.lo cfdiv_r_2exp$U.lo clear$U.lo clrbit$U.lo \ - cmp$U.lo cmp_d$U.lo cmp_si$U.lo cmp_ui$U.lo cmpabs$U.lo \ - cmpabs_d$U.lo cmpabs_ui$U.lo com$U.lo combit$U.lo cong$U.lo \ - cong_2exp$U.lo cong_ui$U.lo divexact$U.lo divegcd$U.lo \ - dive_ui$U.lo divis$U.lo divis_ui$U.lo divis_2exp$U.lo \ - dump$U.lo export$U.lo fac_ui$U.lo fdiv_q$U.lo fdiv_q_ui$U.lo \ - fdiv_qr$U.lo fdiv_qr_ui$U.lo fdiv_r$U.lo fdiv_r_ui$U.lo \ - fdiv_ui$U.lo fib_ui$U.lo fib2_ui$U.lo fits_sint$U.lo \ - fits_slong$U.lo fits_sshort$U.lo fits_uint$U.lo \ - fits_ulong$U.lo fits_ushort$U.lo gcd$U.lo gcd_ui$U.lo \ - gcdext$U.lo get_d$U.lo get_d_2exp$U.lo get_si$U.lo \ - get_str$U.lo get_ui$U.lo getlimbn$U.lo hamdist$U.lo \ - import$U.lo init$U.lo init2$U.lo inp_raw$U.lo inp_str$U.lo \ - invert$U.lo ior$U.lo iset$U.lo iset_d$U.lo iset_si$U.lo \ - iset_str$U.lo iset_ui$U.lo jacobi$U.lo kronsz$U.lo kronuz$U.lo \ - kronzs$U.lo kronzu$U.lo lcm$U.lo lcm_ui$U.lo lucnum_ui$U.lo \ - lucnum2_ui$U.lo millerrabin$U.lo mod$U.lo mul$U.lo \ - mul_2exp$U.lo mul_si$U.lo mul_ui$U.lo n_pow_ui$U.lo neg$U.lo \ - nextprime$U.lo out_raw$U.lo out_str$U.lo perfpow$U.lo \ - perfsqr$U.lo popcount$U.lo pow_ui$U.lo powm$U.lo powm_ui$U.lo \ - pprime_p$U.lo random$U.lo random2$U.lo realloc$U.lo \ - realloc2$U.lo remove$U.lo root$U.lo rootrem$U.lo rrandomb$U.lo \ - scan0$U.lo scan1$U.lo set$U.lo set_d$U.lo set_f$U.lo \ - set_q$U.lo set_si$U.lo set_str$U.lo set_ui$U.lo setbit$U.lo \ - size$U.lo sizeinbase$U.lo sqrt$U.lo sqrtrem$U.lo sub$U.lo \ - sub_ui$U.lo swap$U.lo tdiv_ui$U.lo tdiv_q$U.lo \ - tdiv_q_2exp$U.lo tdiv_q_ui$U.lo tdiv_qr$U.lo tdiv_qr_ui$U.lo \ - tdiv_r$U.lo tdiv_r_2exp$U.lo tdiv_r_ui$U.lo tstbit$U.lo \ - ui_pow_ui$U.lo ui_sub$U.lo urandomb$U.lo urandomm$U.lo \ - xor$U.lo -libmpz_la_OBJECTS = $(am_libmpz_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmpz_la_SOURCES) -DIST_SOURCES = $(libmpz_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) -noinst_LTLIBRARIES = libmpz.la -libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \ - add.c add_ui.c abs.c aorsmul.c aorsmul_i.c and.c array_init.c \ - bin_ui.c bin_uiui.c cdiv_q.c \ - cdiv_q_ui.c cdiv_qr.c cdiv_qr_ui.c cdiv_r.c cdiv_r_ui.c cdiv_ui.c \ - cfdiv_q_2exp.c cfdiv_r_2exp.c \ - clear.c clrbit.c \ - cmp.c cmp_d.c cmp_si.c cmp_ui.c cmpabs.c cmpabs_d.c cmpabs_ui.c \ - com.c combit.c \ - cong.c cong_2exp.c cong_ui.c \ - divexact.c divegcd.c dive_ui.c divis.c divis_ui.c divis_2exp.c \ - dump.c export.c fac_ui.c fdiv_q.c fdiv_q_ui.c \ - fdiv_qr.c fdiv_qr_ui.c fdiv_r.c fdiv_r_ui.c fdiv_ui.c \ - fib_ui.c fib2_ui.c \ - fits_sint.c fits_slong.c fits_sshort.c \ - fits_uint.c fits_ulong.c fits_ushort.c \ - gcd.c gcd_ui.c gcdext.c get_d.c get_d_2exp.c get_si.c \ - get_str.c get_ui.c getlimbn.c hamdist.c \ - import.c init.c init2.c inp_raw.c inp_str.c \ - invert.c ior.c iset.c iset_d.c iset_si.c iset_str.c iset_ui.c \ - jacobi.c kronsz.c kronuz.c kronzs.c kronzu.c \ - lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c millerrabin.c \ - mod.c mul.c mul_2exp.c mul_si.c mul_ui.c n_pow_ui.c neg.c nextprime.c \ - out_raw.c out_str.c perfpow.c perfsqr.c popcount.c pow_ui.c powm.c \ - powm_ui.c pprime_p.c random.c random2.c \ - realloc.c realloc2.c remove.c root.c rootrem.c rrandomb.c \ - scan0.c scan1.c set.c set_d.c set_f.c set_q.c set_si.c set_str.c \ - set_ui.c setbit.c size.c sizeinbase.c sqrt.c sqrtrem.c sub.c sub_ui.c \ - swap.c tdiv_ui.c tdiv_q.c tdiv_q_2exp.c tdiv_q_ui.c tdiv_qr.c \ - tdiv_qr_ui.c tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c tstbit.c ui_pow_ui.c \ - ui_sub.c urandomb.c urandomm.c xor.c - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmpz.la: $(libmpz_la_OBJECTS) $(libmpz_la_DEPENDENCIES) - $(LINK) $(libmpz_la_LDFLAGS) $(libmpz_la_OBJECTS) $(libmpz_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -abs_.c: abs.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_.c: add.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -add_ui_.c: add_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_ui.c; then echo $(srcdir)/add_ui.c; else echo add_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -and_.c: and.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/and.c; then echo $(srcdir)/and.c; else echo and.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -aorsmul_.c: aorsmul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aorsmul.c; then echo $(srcdir)/aorsmul.c; else echo aorsmul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -aorsmul_i_.c: aorsmul_i.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aorsmul_i.c; then echo $(srcdir)/aorsmul_i.c; else echo aorsmul_i.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -array_init_.c: array_init.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array_init.c; then echo $(srcdir)/array_init.c; else echo array_init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -bin_ui_.c: bin_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bin_ui.c; then echo $(srcdir)/bin_ui.c; else echo bin_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -bin_uiui_.c: bin_uiui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bin_uiui.c; then echo $(srcdir)/bin_uiui.c; else echo bin_uiui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_q_.c: cdiv_q.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_q.c; then echo $(srcdir)/cdiv_q.c; else echo cdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_q_ui_.c: cdiv_q_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_q_ui.c; then echo $(srcdir)/cdiv_q_ui.c; else echo cdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_qr_.c: cdiv_qr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_qr.c; then echo $(srcdir)/cdiv_qr.c; else echo cdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_qr_ui_.c: cdiv_qr_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_qr_ui.c; then echo $(srcdir)/cdiv_qr_ui.c; else echo cdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_r_.c: cdiv_r.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_r.c; then echo $(srcdir)/cdiv_r.c; else echo cdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_r_ui_.c: cdiv_r_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_r_ui.c; then echo $(srcdir)/cdiv_r_ui.c; else echo cdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cdiv_ui_.c: cdiv_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_ui.c; then echo $(srcdir)/cdiv_ui.c; else echo cdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cfdiv_q_2exp_.c: cfdiv_q_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cfdiv_q_2exp.c; then echo $(srcdir)/cfdiv_q_2exp.c; else echo cfdiv_q_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cfdiv_r_2exp_.c: cfdiv_r_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cfdiv_r_2exp.c; then echo $(srcdir)/cfdiv_r_2exp.c; else echo cfdiv_r_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -clear_.c: clear.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -clrbit_.c: clrbit.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clrbit.c; then echo $(srcdir)/clrbit.c; else echo clrbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_.c: cmp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_d_.c: cmp_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_d.c; then echo $(srcdir)/cmp_d.c; else echo cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_si_.c: cmp_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmp_ui_.c: cmp_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmpabs_.c: cmpabs.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs.c; then echo $(srcdir)/cmpabs.c; else echo cmpabs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmpabs_d_.c: cmpabs_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs_d.c; then echo $(srcdir)/cmpabs_d.c; else echo cmpabs_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cmpabs_ui_.c: cmpabs_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs_ui.c; then echo $(srcdir)/cmpabs_ui.c; else echo cmpabs_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -com_.c: com.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/com.c; then echo $(srcdir)/com.c; else echo com.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -combit_.c: combit.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/combit.c; then echo $(srcdir)/combit.c; else echo combit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cong_.c: cong.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong.c; then echo $(srcdir)/cong.c; else echo cong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cong_2exp_.c: cong_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong_2exp.c; then echo $(srcdir)/cong_2exp.c; else echo cong_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -cong_ui_.c: cong_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong_ui.c; then echo $(srcdir)/cong_ui.c; else echo cong_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dive_ui_.c: dive_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_ui.c; then echo $(srcdir)/dive_ui.c; else echo dive_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divegcd_.c: divegcd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divegcd.c; then echo $(srcdir)/divegcd.c; else echo divegcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divexact_.c: divexact.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divexact.c; then echo $(srcdir)/divexact.c; else echo divexact.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divis_.c: divis.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis.c; then echo $(srcdir)/divis.c; else echo divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divis_2exp_.c: divis_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis_2exp.c; then echo $(srcdir)/divis_2exp.c; else echo divis_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -divis_ui_.c: divis_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis_ui.c; then echo $(srcdir)/divis_ui.c; else echo divis_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -dump_.c: dump.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -export_.c: export.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/export.c; then echo $(srcdir)/export.c; else echo export.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fac_ui_.c: fac_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fac_ui.c; then echo $(srcdir)/fac_ui.c; else echo fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_q_.c: fdiv_q.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_q.c; then echo $(srcdir)/fdiv_q.c; else echo fdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_q_ui_.c: fdiv_q_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_q_ui.c; then echo $(srcdir)/fdiv_q_ui.c; else echo fdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_qr_.c: fdiv_qr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_qr.c; then echo $(srcdir)/fdiv_qr.c; else echo fdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_qr_ui_.c: fdiv_qr_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_qr_ui.c; then echo $(srcdir)/fdiv_qr_ui.c; else echo fdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_r_.c: fdiv_r.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_r.c; then echo $(srcdir)/fdiv_r.c; else echo fdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_r_ui_.c: fdiv_r_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_r_ui.c; then echo $(srcdir)/fdiv_r_ui.c; else echo fdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fdiv_ui_.c: fdiv_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_ui.c; then echo $(srcdir)/fdiv_ui.c; else echo fdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fib2_ui_.c: fib2_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib2_ui.c; then echo $(srcdir)/fib2_ui.c; else echo fib2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fib_ui_.c: fib_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib_ui.c; then echo $(srcdir)/fib_ui.c; else echo fib_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_sint_.c: fits_sint.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sint.c; then echo $(srcdir)/fits_sint.c; else echo fits_sint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_slong_.c: fits_slong.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_slong.c; then echo $(srcdir)/fits_slong.c; else echo fits_slong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_sshort_.c: fits_sshort.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sshort.c; then echo $(srcdir)/fits_sshort.c; else echo fits_sshort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_uint_.c: fits_uint.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_uint.c; then echo $(srcdir)/fits_uint.c; else echo fits_uint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_ulong_.c: fits_ulong.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ulong.c; then echo $(srcdir)/fits_ulong.c; else echo fits_ulong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fits_ushort_.c: fits_ushort.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ushort.c; then echo $(srcdir)/fits_ushort.c; else echo fits_ushort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcd_.c: gcd.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd.c; then echo $(srcdir)/gcd.c; else echo gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcd_ui_.c: gcd_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd_ui.c; then echo $(srcdir)/gcd_ui.c; else echo gcd_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -gcdext_.c: gcdext.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext.c; then echo $(srcdir)/gcdext.c; else echo gcdext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_.c: get_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_d_2exp_.c: get_d_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d_2exp.c; then echo $(srcdir)/get_d_2exp.c; else echo get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_si_.c: get_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_si.c; then echo $(srcdir)/get_si.c; else echo get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_str_.c: get_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -get_ui_.c: get_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_ui.c; then echo $(srcdir)/get_ui.c; else echo get_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -getlimbn_.c: getlimbn.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getlimbn.c; then echo $(srcdir)/getlimbn.c; else echo getlimbn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -hamdist_.c: hamdist.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hamdist.c; then echo $(srcdir)/hamdist.c; else echo hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -import_.c: import.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/import.c; then echo $(srcdir)/import.c; else echo import.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -init_.c: init.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -init2_.c: init2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init2.c; then echo $(srcdir)/init2.c; else echo init2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -inp_raw_.c: inp_raw.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_raw.c; then echo $(srcdir)/inp_raw.c; else echo inp_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -inp_str_.c: inp_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -invert_.c: invert.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invert.c; then echo $(srcdir)/invert.c; else echo invert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ior_.c: ior.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ior.c; then echo $(srcdir)/ior.c; else echo ior.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_.c: iset.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset.c; then echo $(srcdir)/iset.c; else echo iset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_d_.c: iset_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_d.c; then echo $(srcdir)/iset_d.c; else echo iset_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_si_.c: iset_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_si.c; then echo $(srcdir)/iset_si.c; else echo iset_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_str_.c: iset_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_str.c; then echo $(srcdir)/iset_str.c; else echo iset_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -iset_ui_.c: iset_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_ui.c; then echo $(srcdir)/iset_ui.c; else echo iset_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -jacobi_.c: jacobi.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacobi.c; then echo $(srcdir)/jacobi.c; else echo jacobi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -kronsz_.c: kronsz.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronsz.c; then echo $(srcdir)/kronsz.c; else echo kronsz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -kronuz_.c: kronuz.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronuz.c; then echo $(srcdir)/kronuz.c; else echo kronuz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -kronzs_.c: kronzs.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronzs.c; then echo $(srcdir)/kronzs.c; else echo kronzs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -kronzu_.c: kronzu.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronzu.c; then echo $(srcdir)/kronzu.c; else echo kronzu.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -lcm_.c: lcm.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lcm.c; then echo $(srcdir)/lcm.c; else echo lcm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -lcm_ui_.c: lcm_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lcm_ui.c; then echo $(srcdir)/lcm_ui.c; else echo lcm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -lucnum2_ui_.c: lucnum2_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lucnum2_ui.c; then echo $(srcdir)/lucnum2_ui.c; else echo lucnum2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -lucnum_ui_.c: lucnum_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lucnum_ui.c; then echo $(srcdir)/lucnum_ui.c; else echo lucnum_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -millerrabin_.c: millerrabin.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/millerrabin.c; then echo $(srcdir)/millerrabin.c; else echo millerrabin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mod_.c: mod.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod.c; then echo $(srcdir)/mod.c; else echo mod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_.c: mul.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_2exp_.c: mul_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2exp.c; then echo $(srcdir)/mul_2exp.c; else echo mul_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_si_.c: mul_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_si.c; then echo $(srcdir)/mul_si.c; else echo mul_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -mul_ui_.c: mul_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_ui.c; then echo $(srcdir)/mul_ui.c; else echo mul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -n_pow_ui_.c: n_pow_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/n_pow_ui.c; then echo $(srcdir)/n_pow_ui.c; else echo n_pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -neg_.c: neg.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -nextprime_.c: nextprime.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nextprime.c; then echo $(srcdir)/nextprime.c; else echo nextprime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -out_raw_.c: out_raw.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_raw.c; then echo $(srcdir)/out_raw.c; else echo out_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -out_str_.c: out_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -perfpow_.c: perfpow.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfpow.c; then echo $(srcdir)/perfpow.c; else echo perfpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -perfsqr_.c: perfsqr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfsqr.c; then echo $(srcdir)/perfsqr.c; else echo perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -popcount_.c: popcount.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/popcount.c; then echo $(srcdir)/popcount.c; else echo popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pow_ui_.c: pow_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_ui.c; then echo $(srcdir)/pow_ui.c; else echo pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -powm_.c: powm.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm.c; then echo $(srcdir)/powm.c; else echo powm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -powm_ui_.c: powm_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm_ui.c; then echo $(srcdir)/powm_ui.c; else echo powm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -pprime_p_.c: pprime_p.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pprime_p.c; then echo $(srcdir)/pprime_p.c; else echo pprime_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -random_.c: random.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -random2_.c: random2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -realloc_.c: realloc.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -realloc2_.c: realloc2.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc2.c; then echo $(srcdir)/realloc2.c; else echo realloc2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -remove_.c: remove.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/remove.c; then echo $(srcdir)/remove.c; else echo remove.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -root_.c: root.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/root.c; then echo $(srcdir)/root.c; else echo root.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rootrem_.c: rootrem.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rootrem.c; then echo $(srcdir)/rootrem.c; else echo rootrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -rrandomb_.c: rrandomb.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rrandomb.c; then echo $(srcdir)/rrandomb.c; else echo rrandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -scan0_.c: scan0.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan0.c; then echo $(srcdir)/scan0.c; else echo scan0.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -scan1_.c: scan1.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan1.c; then echo $(srcdir)/scan1.c; else echo scan1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_.c: set.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_d_.c: set_d.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_f_.c: set_f.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_f.c; then echo $(srcdir)/set_f.c; else echo set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_q_.c: set_q.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_q.c; then echo $(srcdir)/set_q.c; else echo set_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_si_.c: set_si.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_str_.c: set_str.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -set_ui_.c: set_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -setbit_.c: setbit.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/setbit.c; then echo $(srcdir)/setbit.c; else echo setbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -size_.c: size.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/size.c; then echo $(srcdir)/size.c; else echo size.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sizeinbase_.c: sizeinbase.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sizeinbase.c; then echo $(srcdir)/sizeinbase.c; else echo sizeinbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqrt_.c: sqrt.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt.c; then echo $(srcdir)/sqrt.c; else echo sqrt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sqrtrem_.c: sqrtrem.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrtrem.c; then echo $(srcdir)/sqrtrem.c; else echo sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_.c: sub.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sub_ui_.c: sub_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_ui.c; then echo $(srcdir)/sub_ui.c; else echo sub_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -swap_.c: swap.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_q_.c: tdiv_q.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q.c; then echo $(srcdir)/tdiv_q.c; else echo tdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_q_2exp_.c: tdiv_q_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q_2exp.c; then echo $(srcdir)/tdiv_q_2exp.c; else echo tdiv_q_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_q_ui_.c: tdiv_q_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q_ui.c; then echo $(srcdir)/tdiv_q_ui.c; else echo tdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_qr_.c: tdiv_qr.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr.c; then echo $(srcdir)/tdiv_qr.c; else echo tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_qr_ui_.c: tdiv_qr_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr_ui.c; then echo $(srcdir)/tdiv_qr_ui.c; else echo tdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_r_.c: tdiv_r.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r.c; then echo $(srcdir)/tdiv_r.c; else echo tdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_r_2exp_.c: tdiv_r_2exp.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r_2exp.c; then echo $(srcdir)/tdiv_r_2exp.c; else echo tdiv_r_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_r_ui_.c: tdiv_r_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r_ui.c; then echo $(srcdir)/tdiv_r_ui.c; else echo tdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tdiv_ui_.c: tdiv_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_ui.c; then echo $(srcdir)/tdiv_ui.c; else echo tdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -tstbit_.c: tstbit.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tstbit.c; then echo $(srcdir)/tstbit.c; else echo tstbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ui_pow_ui_.c: ui_pow_ui.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_pow_ui.c; then echo $(srcdir)/ui_pow_ui.c; else echo ui_pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -ui_sub_.c: ui_sub.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_sub.c; then echo $(srcdir)/ui_sub.c; else echo ui_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -urandomb_.c: urandomb.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomb.c; then echo $(srcdir)/urandomb.c; else echo urandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -urandomm_.c: urandomm.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomm.c; then echo $(srcdir)/urandomm.c; else echo urandomm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -xor_.c: xor.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xor.c; then echo $(srcdir)/xor.c; else echo xor.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -abs_.$(OBJEXT) abs_.lo add_.$(OBJEXT) add_.lo add_ui_.$(OBJEXT) \ -add_ui_.lo and_.$(OBJEXT) and_.lo aorsmul_.$(OBJEXT) aorsmul_.lo \ -aorsmul_i_.$(OBJEXT) aorsmul_i_.lo array_init_.$(OBJEXT) \ -array_init_.lo bin_ui_.$(OBJEXT) bin_ui_.lo bin_uiui_.$(OBJEXT) \ -bin_uiui_.lo cdiv_q_.$(OBJEXT) cdiv_q_.lo cdiv_q_ui_.$(OBJEXT) \ -cdiv_q_ui_.lo cdiv_qr_.$(OBJEXT) cdiv_qr_.lo cdiv_qr_ui_.$(OBJEXT) \ -cdiv_qr_ui_.lo cdiv_r_.$(OBJEXT) cdiv_r_.lo cdiv_r_ui_.$(OBJEXT) \ -cdiv_r_ui_.lo cdiv_ui_.$(OBJEXT) cdiv_ui_.lo cfdiv_q_2exp_.$(OBJEXT) \ -cfdiv_q_2exp_.lo cfdiv_r_2exp_.$(OBJEXT) cfdiv_r_2exp_.lo \ -clear_.$(OBJEXT) clear_.lo clrbit_.$(OBJEXT) clrbit_.lo cmp_.$(OBJEXT) \ -cmp_.lo cmp_d_.$(OBJEXT) cmp_d_.lo cmp_si_.$(OBJEXT) cmp_si_.lo \ -cmp_ui_.$(OBJEXT) cmp_ui_.lo cmpabs_.$(OBJEXT) cmpabs_.lo \ -cmpabs_d_.$(OBJEXT) cmpabs_d_.lo cmpabs_ui_.$(OBJEXT) cmpabs_ui_.lo \ -com_.$(OBJEXT) com_.lo combit_.$(OBJEXT) combit_.lo cong_.$(OBJEXT) \ -cong_.lo cong_2exp_.$(OBJEXT) cong_2exp_.lo cong_ui_.$(OBJEXT) \ -cong_ui_.lo dive_ui_.$(OBJEXT) dive_ui_.lo divegcd_.$(OBJEXT) \ -divegcd_.lo divexact_.$(OBJEXT) divexact_.lo divis_.$(OBJEXT) \ -divis_.lo divis_2exp_.$(OBJEXT) divis_2exp_.lo divis_ui_.$(OBJEXT) \ -divis_ui_.lo dump_.$(OBJEXT) dump_.lo export_.$(OBJEXT) export_.lo \ -fac_ui_.$(OBJEXT) fac_ui_.lo fdiv_q_.$(OBJEXT) fdiv_q_.lo \ -fdiv_q_ui_.$(OBJEXT) fdiv_q_ui_.lo fdiv_qr_.$(OBJEXT) fdiv_qr_.lo \ -fdiv_qr_ui_.$(OBJEXT) fdiv_qr_ui_.lo fdiv_r_.$(OBJEXT) fdiv_r_.lo \ -fdiv_r_ui_.$(OBJEXT) fdiv_r_ui_.lo fdiv_ui_.$(OBJEXT) fdiv_ui_.lo \ -fib2_ui_.$(OBJEXT) fib2_ui_.lo fib_ui_.$(OBJEXT) fib_ui_.lo \ -fits_sint_.$(OBJEXT) fits_sint_.lo fits_slong_.$(OBJEXT) \ -fits_slong_.lo fits_sshort_.$(OBJEXT) fits_sshort_.lo \ -fits_uint_.$(OBJEXT) fits_uint_.lo fits_ulong_.$(OBJEXT) \ -fits_ulong_.lo fits_ushort_.$(OBJEXT) fits_ushort_.lo gcd_.$(OBJEXT) \ -gcd_.lo gcd_ui_.$(OBJEXT) gcd_ui_.lo gcdext_.$(OBJEXT) gcdext_.lo \ -get_d_.$(OBJEXT) get_d_.lo get_d_2exp_.$(OBJEXT) get_d_2exp_.lo \ -get_si_.$(OBJEXT) get_si_.lo get_str_.$(OBJEXT) get_str_.lo \ -get_ui_.$(OBJEXT) get_ui_.lo getlimbn_.$(OBJEXT) getlimbn_.lo \ -hamdist_.$(OBJEXT) hamdist_.lo import_.$(OBJEXT) import_.lo \ -init_.$(OBJEXT) init_.lo init2_.$(OBJEXT) init2_.lo inp_raw_.$(OBJEXT) \ -inp_raw_.lo inp_str_.$(OBJEXT) inp_str_.lo invert_.$(OBJEXT) \ -invert_.lo ior_.$(OBJEXT) ior_.lo iset_.$(OBJEXT) iset_.lo \ -iset_d_.$(OBJEXT) iset_d_.lo iset_si_.$(OBJEXT) iset_si_.lo \ -iset_str_.$(OBJEXT) iset_str_.lo iset_ui_.$(OBJEXT) iset_ui_.lo \ -jacobi_.$(OBJEXT) jacobi_.lo kronsz_.$(OBJEXT) kronsz_.lo \ -kronuz_.$(OBJEXT) kronuz_.lo kronzs_.$(OBJEXT) kronzs_.lo \ -kronzu_.$(OBJEXT) kronzu_.lo lcm_.$(OBJEXT) lcm_.lo lcm_ui_.$(OBJEXT) \ -lcm_ui_.lo lucnum2_ui_.$(OBJEXT) lucnum2_ui_.lo lucnum_ui_.$(OBJEXT) \ -lucnum_ui_.lo millerrabin_.$(OBJEXT) millerrabin_.lo mod_.$(OBJEXT) \ -mod_.lo mul_.$(OBJEXT) mul_.lo mul_2exp_.$(OBJEXT) mul_2exp_.lo \ -mul_si_.$(OBJEXT) mul_si_.lo mul_ui_.$(OBJEXT) mul_ui_.lo \ -n_pow_ui_.$(OBJEXT) n_pow_ui_.lo neg_.$(OBJEXT) neg_.lo \ -nextprime_.$(OBJEXT) nextprime_.lo out_raw_.$(OBJEXT) out_raw_.lo \ -out_str_.$(OBJEXT) out_str_.lo perfpow_.$(OBJEXT) perfpow_.lo \ -perfsqr_.$(OBJEXT) perfsqr_.lo popcount_.$(OBJEXT) popcount_.lo \ -pow_ui_.$(OBJEXT) pow_ui_.lo powm_.$(OBJEXT) powm_.lo \ -powm_ui_.$(OBJEXT) powm_ui_.lo pprime_p_.$(OBJEXT) pprime_p_.lo \ -random_.$(OBJEXT) random_.lo random2_.$(OBJEXT) random2_.lo \ -realloc_.$(OBJEXT) realloc_.lo realloc2_.$(OBJEXT) realloc2_.lo \ -remove_.$(OBJEXT) remove_.lo root_.$(OBJEXT) root_.lo \ -rootrem_.$(OBJEXT) rootrem_.lo rrandomb_.$(OBJEXT) rrandomb_.lo \ -scan0_.$(OBJEXT) scan0_.lo scan1_.$(OBJEXT) scan1_.lo set_.$(OBJEXT) \ -set_.lo set_d_.$(OBJEXT) set_d_.lo set_f_.$(OBJEXT) set_f_.lo \ -set_q_.$(OBJEXT) set_q_.lo set_si_.$(OBJEXT) set_si_.lo \ -set_str_.$(OBJEXT) set_str_.lo set_ui_.$(OBJEXT) set_ui_.lo \ -setbit_.$(OBJEXT) setbit_.lo size_.$(OBJEXT) size_.lo \ -sizeinbase_.$(OBJEXT) sizeinbase_.lo sqrt_.$(OBJEXT) sqrt_.lo \ -sqrtrem_.$(OBJEXT) sqrtrem_.lo sub_.$(OBJEXT) sub_.lo \ -sub_ui_.$(OBJEXT) sub_ui_.lo swap_.$(OBJEXT) swap_.lo \ -tdiv_q_.$(OBJEXT) tdiv_q_.lo tdiv_q_2exp_.$(OBJEXT) tdiv_q_2exp_.lo \ -tdiv_q_ui_.$(OBJEXT) tdiv_q_ui_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo \ -tdiv_qr_ui_.$(OBJEXT) tdiv_qr_ui_.lo tdiv_r_.$(OBJEXT) tdiv_r_.lo \ -tdiv_r_2exp_.$(OBJEXT) tdiv_r_2exp_.lo tdiv_r_ui_.$(OBJEXT) \ -tdiv_r_ui_.lo tdiv_ui_.$(OBJEXT) tdiv_ui_.lo tstbit_.$(OBJEXT) \ -tstbit_.lo ui_pow_ui_.$(OBJEXT) ui_pow_ui_.lo ui_sub_.$(OBJEXT) \ -ui_sub_.lo urandomb_.$(OBJEXT) urandomb_.lo urandomm_.$(OBJEXT) \ -urandomm_.lo xor_.$(OBJEXT) xor_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - - -# These are BUILT_SOURCES at the top-level, so normally they're built before -# recursing into this directory. -# -fac_ui.h: - cd ..; $(MAKE) $(AM_MAKEFLAGS) mpz/fac_ui.h -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/mpz/aorsmul_i.c b/contrib/gmp/mpz/aorsmul_i.c index c23495c405..b3c2efae46 100644 --- a/contrib/gmp/mpz/aorsmul_i.c +++ b/contrib/gmp/mpz/aorsmul_i.c @@ -47,13 +47,13 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ The final w will retain its sign, unless an underflow occurs in a submul of absolute values, in which case it's flipped. - If x has more limbs than w, then mpn_submul_1 followed by mpn_com_n is + If x has more limbs than w, then mpn_submul_1 followed by mpn_com is used. The alternative would be mpn_mul_1 into temporary space followed by mpn_sub_n. Avoiding temporary space seem good, and submul+com stands a chance of being faster since it involves only one set of carry propagations, not two. Note that doing an addmul_1 with a twos-complement negative y doesn't work, because it effectively adds an - extra x * 2^BITS_PER_MP_LIMB. */ + extra x * 2^GMP_LIMB_BITS. */ REGPARM_ATTR(1) void mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub) @@ -144,7 +144,7 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub) /* Borrow out of w, take twos complement negative to get absolute value, flip sign of w. */ wp[new_wsize] = ~-cy; /* extra limb is 0-cy */ - mpn_com_n (wp, wp, new_wsize); + mpn_com (wp, wp, new_wsize); new_wsize++; MPN_INCR_U (wp, new_wsize, CNST_LIMB(1)); wsize_signed = -wsize_signed; @@ -158,7 +158,7 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub) mp_limb_t cy2; /* -(-cy*b^n + w-x*y) = (cy-1)*b^n + ~(w-x*y) + 1 */ - mpn_com_n (wp, wp, wsize); + mpn_com (wp, wp, wsize); cy += mpn_add_1 (wp, wp, wsize, CNST_LIMB(1)); cy -= 1; diff --git a/contrib/gmp/mpz/cfdiv_q_2exp.c b/contrib/gmp/mpz/cfdiv_q_2exp.c index a54ce2d33f..1d326910c7 100644 --- a/contrib/gmp/mpz/cfdiv_q_2exp.c +++ b/contrib/gmp/mpz/cfdiv_q_2exp.c @@ -24,11 +24,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* dir==1 for ceil, dir==-1 for floor */ -static void __gmpz_cfdiv_q_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir))) REGPARM_ATTR (1); +static void __gmpz_cfdiv_q_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_bitcnt_t, int))) REGPARM_ATTR (1); #define cfdiv_q_2exp(w,u,cnt,dir) __gmpz_cfdiv_q_2exp (REGPARM_3_1 (w,u,cnt,dir)) REGPARM_ATTR (1) static void -cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir) +cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir) { mp_size_t wsize, usize, abs_usize, limb_cnt, i; mp_srcptr up; @@ -90,13 +90,13 @@ cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir) void -mpz_cdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt) +mpz_cdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { cfdiv_q_2exp (w, u, cnt, 1); } void -mpz_fdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt) +mpz_fdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { cfdiv_q_2exp (w, u, cnt, -1); } diff --git a/contrib/gmp/mpz/cfdiv_r_2exp.c b/contrib/gmp/mpz/cfdiv_r_2exp.c index 005779f15c..5611ad675f 100644 --- a/contrib/gmp/mpz/cfdiv_r_2exp.c +++ b/contrib/gmp/mpz/cfdiv_r_2exp.c @@ -27,11 +27,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* dir==1 for ceil, dir==-1 for floor */ -static void __gmpz_cfdiv_r_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir))) REGPARM_ATTR (1); +static void __gmpz_cfdiv_r_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_bitcnt_t, int))) REGPARM_ATTR (1); #define cfdiv_r_2exp(w,u,cnt,dir) __gmpz_cfdiv_r_2exp (REGPARM_3_1 (w, u, cnt, dir)) REGPARM_ATTR (1) static void -cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir) +cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir) { mp_size_t usize, abs_usize, limb_cnt, i; mp_srcptr up; @@ -109,7 +109,7 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir) /* Ones complement */ i = MIN (abs_usize, limb_cnt+1); - mpn_com_n (wp, up, i); + mpn_com (wp, up, i); for ( ; i <= limb_cnt; i++) wp[i] = GMP_NUMB_MAX; @@ -143,13 +143,13 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir) void -mpz_cdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt) +mpz_cdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { cfdiv_r_2exp (w, u, cnt, 1); } void -mpz_fdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt) +mpz_fdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { cfdiv_r_2exp (w, u, cnt, -1); } diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpz/clears.c similarity index 58% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpz/clears.c index 3072cd40f9..e9f2cf47b6 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpz/clears.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpz_clears() -- Clear multiple mpz_t variables. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpz_clears (mpz_ptr x, ...) +#else +mpz_clears (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpz_ptr x; + va_start (ap); + x = va_arg (ap, mpz_ptr); +#endif + + while (x != NULL) + { + mpz_clear (x); + x = va_arg (ap, mpz_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpz/clrbit.c b/contrib/gmp/mpz/clrbit.c index d169ac4dae..d08d684775 100644 --- a/contrib/gmp/mpz/clrbit.c +++ b/contrib/gmp/mpz/clrbit.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_clrbit (mpz_ptr d, unsigned long int bit_index) +mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_index) { mp_size_t dsize = d->_mp_size; mp_ptr dp = d->_mp_d; diff --git a/contrib/gmp/mpz/combit.c b/contrib/gmp/mpz/combit.c index 02ceaf0885..8a0ce3a93e 100644 --- a/contrib/gmp/mpz/combit.c +++ b/contrib/gmp/mpz/combit.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_combit (mpz_ptr d, unsigned long int bit_index) +mpz_combit (mpz_ptr d, mp_bitcnt_t bit_index) { mp_size_t dsize = ABSIZ(d); mp_ptr dp = LIMBS(d); diff --git a/contrib/gmp/mpz/cong.c b/contrib/gmp/mpz/cong.c index 7fcd6e8d52..127f5cdd08 100644 --- a/contrib/gmp/mpz/cong.c +++ b/contrib/gmp/mpz/cong.c @@ -99,7 +99,7 @@ mpz_congruent_p (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d) if (sign < 0) NEG_MOD (clow, clow, dlow); - if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD)) + if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD)) { r = mpn_mod_1 (ap, asize, dlow); if (clow < dlow) diff --git a/contrib/gmp/mpz/cong_2exp.c b/contrib/gmp/mpz/cong_2exp.c index 873f195b8f..f9a7f153ee 100644 --- a/contrib/gmp/mpz/cong_2exp.c +++ b/contrib/gmp/mpz/cong_2exp.c @@ -22,9 +22,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ int -mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, unsigned long d) +mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) { - unsigned long i, dlimbs, dbits; + mp_size_t i, dlimbs; + unsigned dbits; mp_ptr ap, cp; mp_limb_t dmask, alimb, climb, sum; mp_size_t asize_signed, csize_signed, asize, csize; diff --git a/contrib/gmp/mpz/cong_ui.c b/contrib/gmp/mpz/cong_ui.c index 5969c8fd34..ee68c104b9 100644 --- a/contrib/gmp/mpz/cong_ui.c +++ b/contrib/gmp/mpz/cong_ui.c @@ -76,7 +76,7 @@ mpz_congruent_ui_p (mpz_srcptr a, unsigned long cu, unsigned long du) ap = PTR (a); - if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD)) + if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD)) { r = mpn_mod_1 (ap, asize, d); if (c < d) diff --git a/contrib/gmp/mpz/divexact.c b/contrib/gmp/mpz/divexact.c index e7d9d009f9..95ba31112f 100644 --- a/contrib/gmp/mpz/divexact.c +++ b/contrib/gmp/mpz/divexact.c @@ -1,7 +1,9 @@ /* mpz_divexact -- finds quotient when known that quot * den == num && den != 0. +Contributed to the GNU project by Niels Möller. + Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2005, -2006, 2007 Free Software Foundation, Inc. +2006, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -18,16 +20,6 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* Ken Weber (kweber@mat.ufrgs.br, kweber@mcs.kent.edu) - - Funding for this work has been partially provided by Conselho Nacional - de Desenvolvimento Cienti'fico e Tecnolo'gico (CNPq) do Brazil, Grant - 301314194-2, and was done while I was a visiting reseacher in the Instituto - de Matema'tica at Universidade Federal do Rio Grande do Sul (UFRGS). - - References: - T. Jebelean, An algorithm for exact division, Journal of Symbolic - Computation, v. 15, 1993, pp. 169-180. */ #include "gmp.h" #include "gmp-impl.h" @@ -36,10 +28,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ void mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den) { - mp_ptr qp, tp; - mp_size_t qsize, tsize; + mp_ptr qp; + mp_size_t qn; mp_srcptr np, dp; - mp_size_t nsize, dsize; + mp_size_t nn, dn; TMP_DECL; #if WANT_ASSERT @@ -52,83 +44,38 @@ mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den) } #endif - nsize = ABS (num->_mp_size); - dsize = ABS (den->_mp_size); - - qsize = nsize - dsize + 1; - if (quot->_mp_alloc < qsize) - _mpz_realloc (quot, qsize); + nn = ABSIZ (num); + dn = ABSIZ (den); - np = num->_mp_d; - dp = den->_mp_d; - qp = quot->_mp_d; + qn = nn - dn + 1; + MPZ_REALLOC (quot, qn); - if (nsize < dsize) + if (nn < dn) { /* This special case avoids segfaults below when the function is incorrectly called with |N| < |D|, N != 0. It also handles the well-defined case N = 0. */ - quot->_mp_size = 0; + SIZ(quot) = 0; return; } - if (dsize <= 1) - { - if (dsize == 1) - { - MPN_DIVREM_OR_DIVEXACT_1 (qp, np, nsize, dp[0]); - qsize -= qp[qsize - 1] == 0; - quot->_mp_size = (num->_mp_size ^ den->_mp_size) >= 0 ? qsize : -qsize; - return; - } - - /* Generate divide-by-zero error since dsize == 0. */ - DIVIDE_BY_ZERO; - } + TMP_MARK; - /* Avoid quadratic behaviour, but do it conservatively. */ - if (qsize > 1500) - { - mpz_tdiv_q (quot, num, den); - return; - } + qp = PTR(quot); - TMP_MARK; + if (quot == num || quot == den) + qp = TMP_ALLOC_LIMBS (qn); - /* QUOT <-- NUM/2^r, T <-- DEN/2^r where = r number of twos in DEN. */ - while (dp[0] == 0) - np += 1, nsize -= 1, dp += 1, dsize -= 1; - tsize = MIN (qsize, dsize); - if ((dp[0] & 1) != 0) - { - if (quot == den) /* QUOT and DEN overlap. */ - { - tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB); - MPN_COPY (tp, dp, tsize); - } - else - tp = (mp_ptr) dp; - if (qp != np) - MPN_COPY_INCR (qp, np, qsize); - } - else - { - unsigned int r; - tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB); - count_trailing_zeros (r, dp[0]); - mpn_rshift (tp, dp, tsize, r); - if (dsize > tsize) - tp[tsize - 1] |= (dp[tsize] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK; - mpn_rshift (qp, np, qsize, r); - if (nsize > qsize) - qp[qsize - 1] |= (np[qsize] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK; - } + np = PTR(num); + dp = PTR(den); + + mpn_divexact (qp, np, nn, dp, dn); + MPN_NORMALIZE (qp, qn); - /* Now QUOT <-- QUOT/T. */ - mpn_bdivmod (qp, qp, qsize, tp, tsize, qsize * GMP_NUMB_BITS); - MPN_NORMALIZE (qp, qsize); + SIZ(quot) = (SIZ(num) ^ SIZ(den)) >= 0 ? qn : -qn; - quot->_mp_size = (num->_mp_size ^ den->_mp_size) >= 0 ? qsize : -qsize; + if (qp != PTR(quot)) + MPN_COPY (PTR(quot), qp, qn); TMP_FREE; } diff --git a/contrib/gmp/mpz/divis_2exp.c b/contrib/gmp/mpz/divis_2exp.c index 5e07b4af18..f01aafeee1 100644 --- a/contrib/gmp/mpz/divis_2exp.c +++ b/contrib/gmp/mpz/divis_2exp.c @@ -22,9 +22,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ int -mpz_divisible_2exp_p (mpz_srcptr a, unsigned long d) +mpz_divisible_2exp_p (mpz_srcptr a, mp_bitcnt_t d) { - unsigned long i, dlimbs, dbits; + mp_size_t i, dlimbs; + unsigned dbits; mp_ptr ap; mp_limb_t dmask; mp_size_t asize; diff --git a/contrib/gmp/mpz/divis_ui.c b/contrib/gmp/mpz/divis_ui.c index ead0ddd23b..69dc21cd80 100644 --- a/contrib/gmp/mpz/divis_ui.c +++ b/contrib/gmp/mpz/divis_ui.c @@ -51,7 +51,7 @@ mpz_divisible_ui_p (mpz_srcptr a, unsigned long d) ap = PTR(a); asize = ABS(asize); /* ignore sign of a */ - if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD)) + if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD)) return mpn_mod_1 (ap, asize, (mp_limb_t) d) == 0; if (! (d & 1)) diff --git a/contrib/gmp/mpz/fib_ui.c b/contrib/gmp/mpz/fib_ui.c index 3e9aa1b32d..8c13a8f053 100644 --- a/contrib/gmp/mpz/fib_ui.c +++ b/contrib/gmp/mpz/fib_ui.c @@ -78,10 +78,10 @@ mpz_fib_ui (mpz_ptr fn, unsigned long n) /* F[2k+1] = (2F[k]+F[k-1])*(2F[k]-F[k-1]) + 2*(-1)^k */ mp_size_t xsize, ysize; -#if HAVE_NATIVE_mpn_addsub_n +#if HAVE_NATIVE_mpn_add_n_sub_n xp[size] = mpn_lshift (xp, xp, size, 1); yp[size] = 0; - ASSERT_NOCARRY (mpn_addsub_n (xp, yp, xp, yp, size+1)); + ASSERT_NOCARRY (mpn_add_n_sub_n (xp, yp, xp, yp, size+1)); xsize = size + (xp[size] != 0); ysize = size + (yp[size] != 0); #else diff --git a/contrib/gmp/mpz/gcd.c b/contrib/gmp/mpz/gcd.c index 4fdb48fc15..18787699d1 100644 --- a/contrib/gmp/mpz/gcd.c +++ b/contrib/gmp/mpz/gcd.c @@ -90,7 +90,7 @@ gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g) usize -= u_zero_limbs; count_trailing_zeros (u_zero_bits, *up); tp = up; - up = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB); + up = TMP_ALLOC_LIMBS (usize); if (u_zero_bits != 0) { mpn_rshift (up, tp, usize, u_zero_bits); @@ -105,7 +105,7 @@ gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g) vsize -= v_zero_limbs; count_trailing_zeros (v_zero_bits, *vp); tp = vp; - vp = (mp_ptr) TMP_ALLOC (vsize * BYTES_PER_MP_LIMB); + vp = TMP_ALLOC_LIMBS (vsize); if (v_zero_bits != 0) { mpn_rshift (vp, tp, vsize, v_zero_bits); @@ -135,7 +135,7 @@ gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g) ? mpn_gcd (vp, vp, vsize, up, usize) : mpn_gcd (vp, up, usize, vp, vsize); - /* Here G <-- V << (g_zero_limbs*BITS_PER_MP_LIMB + g_zero_bits). */ + /* Here G <-- V << (g_zero_limbs*GMP_LIMB_BITS + g_zero_bits). */ gsize = vsize + g_zero_limbs; if (g_zero_bits != 0) { diff --git a/contrib/gmp/mpz/gcd_ui.c b/contrib/gmp/mpz/gcd_ui.c index e73890da4b..d1a7cece73 100644 --- a/contrib/gmp/mpz/gcd_ui.c +++ b/contrib/gmp/mpz/gcd_ui.c @@ -1,4 +1,4 @@ -/* mpz_gcd_ui -- Calculate the greatest common divisior of two integers. +/* mpz_gcd_ui -- Calculate the greatest common divisor of two integers. Copyright 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. diff --git a/contrib/gmp/mpz/gcdext.c b/contrib/gmp/mpz/gcdext.c index b1001a1b64..2419e2fe95 100644 --- a/contrib/gmp/mpz/gcdext.c +++ b/contrib/gmp/mpz/gcdext.c @@ -50,8 +50,8 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b) { usize = asize; vsize = bsize; - up = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB); - vp = (mp_ptr) TMP_ALLOC ((vsize + 1) * BYTES_PER_MP_LIMB); + up = TMP_ALLOC_LIMBS (usize + 1); + vp = TMP_ALLOC_LIMBS (vsize + 1); MPN_COPY (up, ap, usize); MPN_COPY (vp, bp, vsize); u = a; @@ -63,8 +63,8 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b) { usize = bsize; vsize = asize; - up = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB); - vp = (mp_ptr) TMP_ALLOC ((vsize + 1) * BYTES_PER_MP_LIMB); + up = TMP_ALLOC_LIMBS (usize + 1); + vp = TMP_ALLOC_LIMBS (vsize + 1); MPN_COPY (up, bp, usize); MPN_COPY (vp, ap, vsize); u = b; @@ -73,8 +73,8 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b) tt = s; } - tmp_gp = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB); - tmp_sp = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB); + tmp_gp = TMP_ALLOC_LIMBS (usize + 1); + tmp_sp = TMP_ALLOC_LIMBS (usize + 1); if (vsize == 0) { diff --git a/contrib/gmp/mpz/hamdist.c b/contrib/gmp/mpz/hamdist.c index 0f25361b6f..bd4dcd707c 100644 --- a/contrib/gmp/mpz/hamdist.c +++ b/contrib/gmp/mpz/hamdist.c @@ -21,12 +21,12 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" -unsigned long +mp_bitcnt_t mpz_hamdist (mpz_srcptr u, mpz_srcptr v) { mp_srcptr up, vp; mp_size_t usize, vsize; - unsigned long count; + mp_bitcnt_t count; usize = SIZ(u); vsize = SIZ(v); @@ -37,7 +37,7 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) if (usize >= 0) { if (vsize < 0) - return ~ (unsigned long) 0; + return ~ (mp_bitcnt_t) 0; /* positive/positive */ @@ -60,7 +60,7 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) mp_size_t old_vsize, step; if (vsize >= 0) - return ~ (unsigned long) 0; + return ~ (mp_limb_t) 0; /* negative/negative */ @@ -99,7 +99,7 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) if (vlimb == 0) { - unsigned long twoscount; + mp_bitcnt_t twoscount; /* first non-zero of v */ old_vsize = vsize; diff --git a/contrib/gmp/mpz/init2.c b/contrib/gmp/mpz/init2.c index 6c271bde45..a516b0a5a7 100644 --- a/contrib/gmp/mpz/init2.c +++ b/contrib/gmp/mpz/init2.c @@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_init2 (mpz_ptr x, unsigned long bits) +mpz_init2 (mpz_ptr x, mp_bitcnt_t bits) { mp_size_t new_alloc; diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpz/inits.c similarity index 57% copy from contrib/gmp/mpz/urandomb.c copy to contrib/gmp/mpz/inits.c index 3072cd40f9..9ca0e8c4f9 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpz/inits.c @@ -1,8 +1,6 @@ -/* mpz_urandomb (rop, state, n) -- Generate a uniform pseudorandom - integer in the range 0 to 2^N - 1, inclusive, using STATE as the - random state previously initialized by a call to gmp_randinit(). +/* mpz_inits() -- Initialize multiple mpz_t variables and set them to 0. -Copyright 1999, 2000, 2002 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -19,19 +17,40 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" + +#if HAVE_STDARG +#include +#else +#include +#endif + +#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +#if HAVE_STDARG +mpz_inits (mpz_ptr x, ...) +#else +mpz_inits (va_alist) + va_dcl +#endif { - mp_ptr rp; - mp_size_t size; - - size = BITS_TO_LIMBS (nbits); - rp = MPZ_REALLOC (rop, size); - - _gmp_rand (rp, rstate, nbits); - MPN_NORMALIZE (rp, size); - SIZ (rop) = size; + va_list ap; + +#if HAVE_STDARG + va_start (ap, x); +#else + mpz_ptr x; + va_start (ap); + x = va_arg (ap, mpz_ptr); +#endif + + while (x != NULL) + { + mpz_init (x); + x = va_arg (ap, mpz_ptr); + } + va_end (ap); } diff --git a/contrib/gmp/mpz/jacobi.c b/contrib/gmp/mpz/jacobi.c index 1d6a5a1100..cab11f5fe0 100644 --- a/contrib/gmp/mpz/jacobi.c +++ b/contrib/gmp/mpz/jacobi.c @@ -64,10 +64,7 @@ with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Enhancements: - mpn_bdivmod could be used instead of mpn_tdiv_qr, like in mpn_gcd. - Currently tdiv_qr is preferred since it's sub-quadratic on big sizes, - although bdivmod might be a touch quicker on small sizes. This can be - revised when bdivmod becomes sub-quadratic too. + mpn_bdiv_qr should be used instead of mpn_tdiv_qr. Some sort of multi-step algorithm should be used. The current subtract and shift for every bit is very inefficient. Lehmer (per current gcdext) diff --git a/contrib/gmp/mpz/kronsz.c b/contrib/gmp/mpz/kronsz.c index 0c33c8d77d..50bf7f6674 100644 --- a/contrib/gmp/mpz/kronsz.c +++ b/contrib/gmp/mpz/kronsz.c @@ -85,7 +85,7 @@ mpz_si_kronecker (long a, mpz_srcptr b) /* a odd, b even Establish shifted b_low with valid bit1 for ASGN and RECIP below. - Zero limbs stripped are acounted for, but zero bits on b_low are + Zero limbs stripped are accounted for, but zero bits on b_low are not because they remain in {b_ptr,b_abs_size} for the JACOBI_MOD_OR_MODEXACT_1_ODD. */ diff --git a/contrib/gmp/mpz/lucnum_ui.c b/contrib/gmp/mpz/lucnum_ui.c index 1215a04b4d..1fb8ec86c3 100644 --- a/contrib/gmp/mpz/lucnum_ui.c +++ b/contrib/gmp/mpz/lucnum_ui.c @@ -167,7 +167,7 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n) TRACE (printf (" zeros=%d\n", zeros)); ASSERT (xalloc >= 2*lsize); - mpn_sqr_n (xp, lp, lsize); + mpn_sqr (xp, lp, lsize); lsize *= 2; lsize -= (xp[lsize-1] == 0); diff --git a/contrib/gmp/mpz/mul.c b/contrib/gmp/mpz/mul.c index 7f4e4a3775..ee49aeab89 100644 --- a/contrib/gmp/mpz/mul.c +++ b/contrib/gmp/mpz/mul.c @@ -1,7 +1,7 @@ /* mpz_mul -- Multiply two integers. -Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005 Free Software Foundation, -Inc. +Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009, 2011 Free +Software Foundation, Inc. This file is part of the GNU MP Library. @@ -33,8 +33,8 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v) mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w) #endif /* BERKELEY_MP */ { - mp_size_t usize = u->_mp_size; - mp_size_t vsize = v->_mp_size; + mp_size_t usize; + mp_size_t vsize; mp_size_t wsize; mp_size_t sign_product; mp_ptr up, vp; @@ -44,6 +44,8 @@ mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w) mp_limb_t cy_limb; TMP_DECL; + usize = SIZ (u); + vsize = SIZ (v); sign_product = usize ^ vsize; usize = ABS (usize); vsize = ABS (vsize); @@ -92,25 +94,25 @@ mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w) TMP_MARK; free_me = NULL; - up = u->_mp_d; - vp = v->_mp_d; - wp = w->_mp_d; + up = PTR(u); + vp = PTR(v); + wp = PTR(w); /* Ensure W has space enough to store the result. */ wsize = usize + vsize; - if (w->_mp_alloc < wsize) + if (ALLOC(w) < wsize) { if (wp == up || wp == vp) { free_me = wp; - free_me_size = w->_mp_alloc; + free_me_size = ALLOC(w); } else - (*__gmp_free_func) (wp, w->_mp_alloc * BYTES_PER_MP_LIMB); + (*__gmp_free_func) (wp, ALLOC(w) * BYTES_PER_MP_LIMB); - w->_mp_alloc = wsize; + ALLOC(w) = wsize; wp = (mp_ptr) (*__gmp_allocate_func) (wsize * BYTES_PER_MP_LIMB); - w->_mp_d = wp; + PTR(w) = wp; } else { @@ -118,7 +120,7 @@ mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w) if (wp == up) { /* W and U are identical. Allocate temporary space for U. */ - up = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB); + up = TMP_ALLOC_LIMBS (usize); /* Is V identical too? Keep it identical with U. */ if (wp == vp) vp = up; @@ -128,17 +130,25 @@ mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w) else if (wp == vp) { /* W and V are identical. Allocate temporary space for V. */ - vp = (mp_ptr) TMP_ALLOC (vsize * BYTES_PER_MP_LIMB); + vp = TMP_ALLOC_LIMBS (vsize); /* Copy to the temporary space. */ MPN_COPY (vp, wp, vsize); } } - cy_limb = mpn_mul (wp, up, usize, vp, vsize); - wsize = usize + vsize; + if (up == vp) + { + mpn_sqr (wp, up, usize); + cy_limb = wp[wsize - 1]; + } + else + { + cy_limb = mpn_mul (wp, up, usize, vp, vsize); + } + wsize -= cy_limb == 0; - w->_mp_size = sign_product < 0 ? -wsize : wsize; + SIZ(w) = sign_product < 0 ? -wsize : wsize; if (free_me != NULL) (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB); TMP_FREE; diff --git a/contrib/gmp/mpz/mul_2exp.c b/contrib/gmp/mpz/mul_2exp.c index 51885a3364..a1521816ea 100644 --- a/contrib/gmp/mpz/mul_2exp.c +++ b/contrib/gmp/mpz/mul_2exp.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_mul_2exp (mpz_ptr w, mpz_srcptr u, unsigned long int cnt) +mpz_mul_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { mp_size_t usize = u->_mp_size; mp_size_t abs_usize = ABS (usize); diff --git a/contrib/gmp/mpz/n_pow_ui.c b/contrib/gmp/mpz/n_pow_ui.c index 4f3f4979bf..6d527c36ce 100644 --- a/contrib/gmp/mpz/n_pow_ui.c +++ b/contrib/gmp/mpz/n_pow_ui.c @@ -55,11 +55,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ The initial powering for bsize==1 into blimb or blimb:blimb_low doesn't form the biggest possible power of b that fits, only the biggest power of 2 power, ie. b^(2^n). It'd be possible to choose a bigger power, perhaps - using __mp_bases[b].big_base for small b, and thereby get better value + using mp_bases[b].big_base for small b, and thereby get better value from mpn_mul_1 or mpn_mul_2 in the bignum powering. It's felt that doing so would be more complicated than it's worth, and could well end up being a slowdown for small e. For big e on the other hand the algorithm is - dominated by mpn_sqr_n so there wouldn't much of a saving. The current + dominated by mpn_sqr so there wouldn't much of a saving. The current code can be viewed as simply doing the first few steps of the powering in a single or double limb where possible. @@ -79,10 +79,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* The following are for convenience, they update the size and check the alloc. */ -#define MPN_SQR_N(dst, alloc, src, size) \ +#define MPN_SQR(dst, alloc, src, size) \ do { \ ASSERT (2*(size) <= (alloc)); \ - mpn_sqr_n (dst, src, size); \ + mpn_sqr (dst, src, size); \ (size) *= 2; \ (size) -= ((dst)[(size)-1] == 0); \ } while (0) @@ -154,7 +154,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e) mp_size_t rtwos_limbs, ralloc, rsize; int rneg, i, cnt, btwos, r_bp_overlap; mp_limb_t blimb, rl; - unsigned long rtwos_bits; + mp_bitcnt_t rtwos_bits; #if HAVE_NATIVE_mpn_mul_2 mp_limb_t blimb_low, rl_high; #else @@ -435,7 +435,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e) i, e, rsize, ralloc, talloc); mpn_trace ("r", rp, rsize)); - MPN_SQR_N (tp, talloc, rp, rsize); + MPN_SQR (tp, talloc, rp, rsize); SWAP_RP_TP; if ((e & (1L << i)) != 0) MPN_MUL_2 (rp, rsize, ralloc, mult); @@ -467,7 +467,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e) i, e, rsize, ralloc, talloc); mpn_trace ("r", rp, rsize)); - MPN_SQR_N (tp, talloc, rp, rsize); + MPN_SQR (tp, talloc, rp, rsize); SWAP_RP_TP; if ((e & (1L << i)) != 0) MPN_MUL_1 (rp, rsize, ralloc, blimb); @@ -496,7 +496,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e) i, e, rsize, ralloc, talloc); mpn_trace ("r", rp, rsize)); - MPN_SQR_N (tp, talloc, rp, rsize); + MPN_SQR (tp, talloc, rp, rsize); SWAP_RP_TP; if ((e & (1L << i)) != 0) { diff --git a/contrib/gmp/mpz/nextprime.c b/contrib/gmp/mpz/nextprime.c index 0fd8da57e9..6ba2515682 100644 --- a/contrib/gmp/mpz/nextprime.c +++ b/contrib/gmp/mpz/nextprime.c @@ -2,7 +2,7 @@ Copyright 1999, 2000, 2001, 2008, 2009 Free Software Foundation, Inc. -Contributed to the GNU project by Niels Möller and Torbjörn Granlund. +Contributed to the GNU project by Niels Möller and Torbjorn Granlund. This file is part of the GNU MP Library. @@ -45,7 +45,7 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n) unsigned long prime; int cnt; mp_size_t pn; - unsigned long nbits; + mp_bitcnt_t nbits; unsigned incr; TMP_SDECL; diff --git a/contrib/gmp/mpz/out_str.c b/contrib/gmp/mpz/out_str.c index 1b96225223..8643db865a 100644 --- a/contrib/gmp/mpz/out_str.c +++ b/contrib/gmp/mpz/out_str.c @@ -71,13 +71,13 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x) } TMP_MARK; - str_size = ((size_t) (x_size * BITS_PER_MP_LIMB - * __mp_bases[base].chars_per_bit_exactly)) + 3; + str_size = ((size_t) (x_size * GMP_LIMB_BITS + * mp_bases[base].chars_per_bit_exactly)) + 3; str = (unsigned char *) TMP_ALLOC (str_size); /* Move the number to convert into temporary space, since mpn_get_str clobbers its argument + needs one extra high limb.... */ - xp = (mp_ptr) TMP_ALLOC ((x_size + 1) * BYTES_PER_MP_LIMB); + xp = TMP_ALLOC_LIMBS (x_size + 1); MPN_COPY (xp, x->_mp_d, x_size); str_size = mpn_get_str (str, base, xp, x_size); diff --git a/contrib/gmp/mpz/perfpow.c b/contrib/gmp/mpz/perfpow.c index e667340134..81c8884aa5 100644 --- a/contrib/gmp/mpz/perfpow.c +++ b/contrib/gmp/mpz/perfpow.c @@ -1,7 +1,8 @@ /* mpz_perfect_power_p(arg) -- Return non-zero if ARG is a perfect power, zero otherwise. -Copyright 1998, 1999, 2000, 2001, 2005, 2008 Free Software Foundation, Inc. +Copyright 1998, 1999, 2000, 2001, 2005, 2008, 2009 Free Software Foundation, +Inc. This file is part of the GNU MP Library. @@ -18,266 +19,11 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* - We are to determine if c is a perfect power, c = a ^ b. - Assume c is divisible by 2^n and that codd = c/2^n is odd. - Assume a is divisible by 2^m and that aodd = a/2^m is odd. - It is always true that m divides n. - - * If n is prime, either 1) a is 2*aodd and b = n - or 2) a = c and b = 1. - So for n prime, we readily have a solution. - * If n is factorable into the non-trivial factors p1,p2,... - Since m divides n, m has a subset of n's factors and b = n / m. -*/ - -/* This is a naive approach to recognizing perfect powers. - Many things can be improved. In particular, we should use p-adic - arithmetic for computing possible roots. */ - -#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" - -static unsigned long int gcd __GMP_PROTO ((unsigned long int, unsigned long int)); -static int isprime __GMP_PROTO ((unsigned long int)); - -static const unsigned short primes[] = -{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, - 59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113,127,131, - 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223, - 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311, - 313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409, - 419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503, - 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613, - 617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719, - 727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827, - 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941, - 947,953,967,971,977,983,991,997,0 -}; -#define SMALLEST_OMITTED_PRIME 1009 - - -#define POW2P(a) (((a) & ((a) - 1)) == 0) int mpz_perfect_power_p (mpz_srcptr u) { - unsigned long int prime; - unsigned long int n, n2; - int i; - unsigned long int rem; - mpz_t u2, q; - int exact; - mp_size_t uns; - mp_size_t usize = SIZ (u); - TMP_DECL; - - if (mpz_cmpabs_ui (u, 1) <= 0) - return 1; /* -1, 0, and +1 are perfect powers */ - - n2 = mpz_scan1 (u, 0); - if (n2 == 1) - return 0; /* 2 divides exactly once. */ - - TMP_MARK; - - uns = ABS (usize) - n2 / BITS_PER_MP_LIMB; - MPZ_TMP_INIT (q, uns); - MPZ_TMP_INIT (u2, uns); - - mpz_tdiv_q_2exp (u2, u, n2); - mpz_abs (u2, u2); - - if (mpz_cmp_ui (u2, 1) == 0) - { - TMP_FREE; - /* factoring completed; consistent power */ - return ! (usize < 0 && POW2P(n2)); - } - - if (isprime (n2)) - goto n2prime; - - for (i = 1; primes[i] != 0; i++) - { - prime = primes[i]; - - if (mpz_cmp_ui (u2, prime) < 0) - break; - - if (mpz_divisible_ui_p (u2, prime)) /* divisible by this prime? */ - { - rem = mpz_tdiv_q_ui (q, u2, prime * prime); - if (rem != 0) - { - TMP_FREE; - return 0; /* prime divides exactly once, reject */ - } - mpz_swap (q, u2); - for (n = 2;;) - { - rem = mpz_tdiv_q_ui (q, u2, prime); - if (rem != 0) - break; - mpz_swap (q, u2); - n++; - } - - n2 = gcd (n2, n); - if (n2 == 1) - { - TMP_FREE; - return 0; /* we have multiplicity 1 of some factor */ - } - - if (mpz_cmp_ui (u2, 1) == 0) - { - TMP_FREE; - /* factoring completed; consistent power */ - return ! (usize < 0 && POW2P(n2)); - } - - /* As soon as n2 becomes a prime number, stop factoring. - Either we have u=x^n2 or u is not a perfect power. */ - if (isprime (n2)) - goto n2prime; - } - } - - if (n2 == 0) - { - /* We found no factors above; have to check all values of n. */ - unsigned long int nth; - for (nth = usize < 0 ? 3 : 2;; nth++) - { - if (! isprime (nth)) - continue; -#if 0 - exact = mpz_padic_root (q, u2, nth, PTH); - if (exact) -#endif - exact = mpz_root (q, u2, nth); - if (exact) - { - TMP_FREE; - return 1; - } - if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0) - { - TMP_FREE; - return 0; - } - } - } - else - { - unsigned long int nth; - - if (usize < 0 && POW2P(n2)) - { - TMP_FREE; - return 0; - } - - /* We found some factors above. We just need to consider values of n - that divides n2. */ - for (nth = 2; nth <= n2; nth++) - { - if (! isprime (nth)) - continue; - if (n2 % nth != 0) - continue; -#if 0 - exact = mpz_padic_root (q, u2, nth, PTH); - if (exact) -#endif - exact = mpz_root (q, u2, nth); - if (exact) - { - if (! (usize < 0 && POW2P(nth))) - { - TMP_FREE; - return 1; - } - } - if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0) - { - TMP_FREE; - return 0; - } - } - - TMP_FREE; - return 0; - } - -n2prime: - if (usize < 0 && POW2P(n2)) - { - TMP_FREE; - return 0; - } - - exact = mpz_root (NULL, u2, n2); - TMP_FREE; - return exact; -} - -static unsigned long int -gcd (unsigned long int a, unsigned long int b) -{ - int an2, bn2, n2; - - if (a == 0) - return b; - if (b == 0) - return a; - - count_trailing_zeros (an2, a); - a >>= an2; - - count_trailing_zeros (bn2, b); - b >>= bn2; - - n2 = MIN (an2, bn2); - - while (a != b) - { - if (a > b) - { - a -= b; - do - a >>= 1; - while ((a & 1) == 0); - } - else /* b > a. */ - { - b -= a; - do - b >>= 1; - while ((b & 1) == 0); - } - } - - return a << n2; -} - -static int -isprime (unsigned long int t) -{ - unsigned long int q, r, d; - - if (t < 3 || (t & 1) == 0) - return t == 2; - - for (d = 3, r = 1; r != 0; d += 2) - { - q = t / d; - r = t - q * d; - if (q < d) - return 1; - } - return 0; + return mpn_perfect_power_p (PTR (u), SIZ (u)); } diff --git a/contrib/gmp/mpz/powm.c b/contrib/gmp/mpz/powm.c index 8f3ce97cc4..29b0132c46 100644 --- a/contrib/gmp/mpz/powm.c +++ b/contrib/gmp/mpz/powm.c @@ -1,8 +1,8 @@ -/* mpz_powm(res,base,exp,mod) -- Set RES to (base**exp) mod MOD. +/* mpz_powm(res,base,exp,mod) -- Set R to (U^E) mod M. - Contributed by Paul Zimmermann. + Contributed to the GNU project by Torbjorn Granlund. -Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2009 +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -28,95 +28,28 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "mp.h" #endif -/* Compute t = a mod m, a is defined by (ap,an), m is defined by (mp,mn), and - t is defined by (tp,mn). */ -static void -reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn) -{ - mp_ptr qp; - TMP_DECL; - - TMP_MARK; - qp = TMP_ALLOC_LIMBS (an - mn + 1); - - mpn_tdiv_qr (qp, tp, 0L, ap, an, mp, mn); - - TMP_FREE; -} -#if REDUCE_EXPONENT -/* Return the group order of the ring mod m. */ -static mp_limb_t -phi (mp_limb_t t) -{ - mp_limb_t d, m, go; +/* TODO - go = 1; + * Improve handling of buffers. It is pretty ugly now. - if (t % 2 == 0) - { - t = t / 2; - while (t % 2 == 0) - { - go *= 2; - t = t / 2; - } - } - for (d = 3;; d += 2) - { - m = d - 1; - for (;;) - { - unsigned long int q = t / d; - if (q < d) - { - if (t <= 1) - return go; - if (t == d) - return go * m; - return go * (t - 1); - } - if (t != q * d) - break; - go *= m; - m = d; - t = q; - } - } -} -#endif + * For even moduli, we compute a binvert of its odd part both here and in + mpn_powm. How can we avoid this recomputation? +*/ -/* average number of calls to redc for an exponent of n bits - with the sliding window algorithm of base 2^k: the optimal is - obtained for the value of k which minimizes 2^(k-1)+n/(k+1): - - n\k 4 5 6 7 8 - 128 156* 159 171 200 261 - 256 309 307* 316 343 403 - 512 617 607* 610 632 688 - 1024 1231 1204 1195* 1207 1256 - 2048 2461 2399 2366 2360* 2396 - 4096 4918 4787 4707 4665* 4670 +/* + b ^ e mod m res + 0 0 0 ? + 0 e 0 ? + 0 0 m ? + 0 e m 0 + b 0 0 ? + b e 0 ? + b 0 m 1 mod m + b e m b^e mod m */ - - -/* Use REDC instead of usual reduction for sizes < POWM_THRESHOLD. In REDC - each modular multiplication costs about 2*n^2 limbs operations, whereas - using usual reduction it costs 3*K(n), where K(n) is the cost of a - multiplication using Karatsuba, and a division is assumed to cost 2*K(n), - for example using Burnikel-Ziegler's algorithm. This gives a theoretical - threshold of a*SQR_KARATSUBA_THRESHOLD, with a=(3/2)^(1/(2-ln(3)/ln(2))) ~ - 2.66. */ -/* For now, also disable REDC when MOD is even, as the inverse can't handle - that. At some point, we might want to make the code faster for that case, - perhaps using CRR. */ - -#ifndef POWM_THRESHOLD -#define POWM_THRESHOLD ((8 * SQR_KARATSUBA_THRESHOLD) / 3) -#endif #define HANDLE_NEGATIVE_EXPONENT 1 -#undef REDUCE_EXPONENT void #ifndef BERKELEY_MP @@ -125,44 +58,36 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m) pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r) #endif /* BERKELEY_MP */ { - mp_ptr xp, tp, qp, gp, this_gp; + mp_size_t n, nodd, ncnt; + int cnt; + mp_ptr rp, tp; mp_srcptr bp, ep, mp; - mp_size_t bn, es, en, mn, xn; - mp_limb_t invm, c; - unsigned long int enb; - mp_size_t i, K, j, l, k; - int m_zero_cnt, e_zero_cnt; - int sh; - int use_redc; -#if HANDLE_NEGATIVE_EXPONENT - mpz_t new_b; -#endif -#if REDUCE_EXPONENT - mpz_t new_e; -#endif + mp_size_t rn, bn, es, en, itch; TMP_DECL; - mp = PTR(m); - mn = ABSIZ (m); - if (mn == 0) + n = ABSIZ(m); + if (n == 0) DIVIDE_BY_ZERO; + mp = PTR(m); + TMP_MARK; - es = SIZ (e); - if (es <= 0) + es = SIZ(e); + if (UNLIKELY (es <= 0)) { + mpz_t new_b; if (es == 0) { - /* Exponent is zero, result is 1 mod m, i.e., 1 or 0 depending on if - m equals 1. */ - SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1; + /* b^0 mod m, b is anything and m is non-zero. + Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */ + SIZ(r) = n != 1 || mp[0] != 1; PTR(r)[0] = 1; TMP_FREE; /* we haven't really allocated anything here */ return; } #if HANDLE_NEGATIVE_EXPONENT - MPZ_TMP_INIT (new_b, mn + 1); + MPZ_TMP_INIT (new_b, n + 1); if (! mpz_invert (new_b, b, m)) DIVIDE_BY_ZERO; @@ -174,262 +99,181 @@ pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r) } en = es; -#if REDUCE_EXPONENT - /* Reduce exponent by dividing it by phi(m) when m small. */ - if (mn == 1 && mp[0] < 0x7fffffffL && en * GMP_NUMB_BITS > 150) - { - MPZ_TMP_INIT (new_e, 2); - mpz_mod_ui (new_e, e, phi (mp[0])); - e = new_e; - } -#endif - - use_redc = mn < POWM_THRESHOLD && mp[0] % 2 != 0; - if (use_redc) - { - /* invm = -1/m mod 2^BITS_PER_MP_LIMB, must have m odd */ - modlimb_invert (invm, mp[0]); - invm = -invm; - } - else - { - /* Normalize m (i.e. make its most significant bit set) as required by - division functions below. */ - count_leading_zeros (m_zero_cnt, mp[mn - 1]); - m_zero_cnt -= GMP_NAIL_BITS; - if (m_zero_cnt != 0) - { - mp_ptr new_mp; - new_mp = TMP_ALLOC_LIMBS (mn); - mpn_lshift (new_mp, mp, mn, m_zero_cnt); - mp = new_mp; - } - } + bn = ABSIZ(b); - /* Determine optimal value of k, the number of exponent bits we look at - at a time. */ - count_leading_zeros (e_zero_cnt, PTR(e)[en - 1]); - e_zero_cnt -= GMP_NAIL_BITS; - enb = en * GMP_NUMB_BITS - e_zero_cnt; /* number of bits of exponent */ - k = 1; - K = 2; - while (2 * enb > K * (2 + k * (3 + k))) + if (UNLIKELY (bn == 0)) { - k++; - K *= 2; - if (k == 10) /* cap allocation */ - break; + SIZ(r) = 0; + TMP_FREE; + return; } - tp = TMP_ALLOC_LIMBS (2 * mn); - qp = TMP_ALLOC_LIMBS (mn + 1); + ep = PTR(e); - gp = __GMP_ALLOCATE_FUNC_LIMBS (K / 2 * mn); - - /* Compute x*R^n where R=2^BITS_PER_MP_LIMB. */ - bn = ABSIZ (b); - bp = PTR(b); - /* Handle |b| >= m by computing b mod m. FIXME: It is not strictly necessary - for speed or correctness to do this when b and m have the same number of - limbs, perhaps remove mpn_cmp call. */ - if (bn > mn || (bn == mn && mpn_cmp (bp, mp, mn) >= 0)) + /* Handle (b^1 mod m) early, since mpn_pow* do not handle that case. */ + if (UNLIKELY (en == 1 && ep[0] == 1)) { - /* Reduce possibly huge base while moving it to gp[0]. Use a function - call to reduce, since we don't want the quotient allocation to - live until function return. */ - if (use_redc) + rp = TMP_ALLOC_LIMBS (n); + bp = PTR(b); + if (bn >= n) { - reduce (tp + mn, bp, bn, mp, mn); /* b mod m */ - MPN_ZERO (tp, mn); - mpn_tdiv_qr (qp, gp, 0L, tp, 2 * mn, mp, mn); /* unnormnalized! */ + mp_ptr qp = TMP_ALLOC_LIMBS (bn - n + 1); + mpn_tdiv_qr (qp, rp, 0L, bp, bn, mp, n); + rn = n; + MPN_NORMALIZE (rp, rn); + + if (SIZ(b) < 0 && rn != 0) + { + mpn_sub (rp, mp, n, rp, rn); + rn = n; + MPN_NORMALIZE (rp, rn); + } } else { - reduce (gp, bp, bn, mp, mn); + if (SIZ(b) < 0) + { + mpn_sub (rp, mp, n, bp, bn); + rn = n; + rn -= (rp[rn - 1] == 0); + } + else + { + MPN_COPY (rp, bp, bn); + rn = bn; + } } + goto ret; } - else + + /* Remove low zero limbs from M. This loop will terminate for correctly + represented mpz numbers. */ + ncnt = 0; + while (UNLIKELY (mp[0] == 0)) { - /* |b| < m. We pad out operands to become mn limbs, which simplifies - the rest of the function, but slows things down when |b| << m. */ - if (use_redc) - { - MPN_ZERO (tp, mn); - MPN_COPY (tp + mn, bp, bn); - MPN_ZERO (tp + mn + bn, mn - bn); - mpn_tdiv_qr (qp, gp, 0L, tp, 2 * mn, mp, mn); - } - else - { - MPN_COPY (gp, bp, bn); - MPN_ZERO (gp + bn, mn - bn); - } + mp++; + ncnt++; } - - /* Compute xx^i for odd g < 2^i. */ - - xp = TMP_ALLOC_LIMBS (mn); - mpn_sqr_n (tp, gp, mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); /* xx = x^2*R^n */ - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); - this_gp = gp; - for (i = 1; i < K / 2; i++) + nodd = n - ncnt; + cnt = 0; + if (mp[0] % 2 == 0) { - mpn_mul_n (tp, this_gp, xp, mn); - this_gp += mn; - if (use_redc) - mpn_redc_1 (this_gp, tp, mp, mn, invm); /* g[i] = x^(2i+1)*R^n */ - else - mpn_tdiv_qr (qp, this_gp, 0L, tp, 2 * mn, mp, mn); + mp_ptr new = TMP_ALLOC_LIMBS (nodd); + count_trailing_zeros (cnt, mp[0]); + mpn_rshift (new, mp, nodd, cnt); + nodd -= new[nodd - 1] == 0; + mp = new; + ncnt++; } - /* Start the real stuff. */ - ep = PTR (e); - i = en - 1; /* current index */ - c = ep[i]; /* current limb */ - sh = GMP_NUMB_BITS - e_zero_cnt; /* significant bits in ep[i] */ - sh -= k; /* index of lower bit of ep[i] to take into account */ - if (sh < 0) - { /* k-sh extra bits are needed */ - if (i > 0) - { - i--; - c <<= (-sh); - sh += GMP_NUMB_BITS; - c |= ep[i] >> sh; - } + if (ncnt != 0) + { + /* We will call both mpn_powm and mpn_powlo. */ + /* rp needs n, mpn_powlo needs 4n, the 2 mpn_binvert might need more */ + mp_size_t n_largest_binvert = MAX (ncnt, nodd); + mp_size_t itch_binvert = mpn_binvert_itch (n_largest_binvert); + itch = 3 * n + MAX (itch_binvert, 2 * n); } else - c >>= sh; - - for (j = 0; c % 2 == 0; j++) - c >>= 1; - - MPN_COPY (xp, gp + mn * (c >> 1), mn); - while (--j >= 0) { - mpn_sqr_n (tp, xp, mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); + /* We will call just mpn_powm. */ + mp_size_t itch_binvert = mpn_binvert_itch (nodd); + itch = n + MAX (itch_binvert, 2 * n); } + tp = TMP_ALLOC_LIMBS (itch); - while (i > 0 || sh > 0) + rp = tp; tp += n; + + bp = PTR(b); + mpn_powm (rp, bp, bn, ep, en, mp, nodd, tp); + + rn = n; + + if (ncnt != 0) { - c = ep[i]; - l = k; /* number of bits treated */ - sh -= l; - if (sh < 0) + mp_ptr r2, xp, yp, odd_inv_2exp; + unsigned long t; + int bcnt; + + if (bn < ncnt) { - if (i > 0) - { - i--; - c <<= (-sh); - sh += GMP_NUMB_BITS; - c |= ep[i] >> sh; - } - else - { - l += sh; /* last chunk of bits from e; l < k */ - } + mp_ptr new = TMP_ALLOC_LIMBS (ncnt); + MPN_COPY (new, bp, bn); + MPN_ZERO (new + bn, ncnt - bn); + bp = new; } - else - c >>= sh; - c &= ((mp_limb_t) 1 << l) - 1; - /* This while loop implements the sliding window improvement--loop while - the most significant bit of c is zero, squaring xx as we go. */ - while ((c >> (l - 1)) == 0 && (i > 0 || sh > 0)) + r2 = tp; + + if (bp[0] % 2 == 0) { - mpn_sqr_n (tp, xp, mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); - if (sh != 0) + if (en > 1) { - sh--; - c = (c << 1) + ((ep[i] >> sh) & 1); + MPN_ZERO (r2, ncnt); + goto zero; } - else - { - i--; - sh = GMP_NUMB_BITS - 1; - c = (c << 1) + (ep[i] >> sh); - } - } - /* Replace xx by xx^(2^l)*x^c. */ - if (c != 0) - { - for (j = 0; c % 2 == 0; j++) - c >>= 1; + ASSERT (en == 1); + t = (ncnt - (cnt != 0)) * GMP_NUMB_BITS + cnt; - /* c0 = c * 2^j, i.e. xx^(2^l)*x^c = (A^(2^(l - j))*c)^(2^j) */ - l -= j; - while (--l >= 0) + /* Count number of low zero bits in B, up to 3. */ + bcnt = (0x1213 >> ((bp[0] & 7) << 1)) & 0x3; + /* Note that ep[0] * bcnt might overflow, but that just results + in a missed optimization. */ + if (ep[0] * bcnt >= t) { - mpn_sqr_n (tp, xp, mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); + MPN_ZERO (r2, ncnt); + goto zero; } - mpn_mul_n (tp, xp, gp + mn * (c >> 1), mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); } - else - j = l; /* case c=0 */ - while (--j >= 0) - { - mpn_sqr_n (tp, xp, mn); - if (use_redc) - mpn_redc_1 (xp, tp, mp, mn, invm); - else - mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn); - } - } - if (use_redc) - { - /* Convert back xx to xx/R^n. */ - MPN_COPY (tp, xp, mn); - MPN_ZERO (tp + mn, mn); - mpn_redc_1 (xp, tp, mp, mn, invm); - if (mpn_cmp (xp, mp, mn) >= 0) - mpn_sub_n (xp, xp, mp, mn); - } - else - { - if (m_zero_cnt != 0) + mpn_powlo (r2, bp, ep, en, ncnt, tp + ncnt); + + zero: + if (nodd < ncnt) { - mp_limb_t cy; - cy = mpn_lshift (tp, xp, mn, m_zero_cnt); - tp[mn] = cy; - mpn_tdiv_qr (qp, xp, 0L, tp, mn + (cy != 0), mp, mn); - mpn_rshift (xp, xp, mn, m_zero_cnt); + mp_ptr new = TMP_ALLOC_LIMBS (ncnt); + MPN_COPY (new, mp, nodd); + MPN_ZERO (new + nodd, ncnt - nodd); + mp = new; } + + odd_inv_2exp = tp + n; + mpn_binvert (odd_inv_2exp, mp, ncnt, tp + 2 * n); + + mpn_sub (r2, r2, ncnt, rp, nodd > ncnt ? ncnt : nodd); + + xp = tp + 2 * n; + mpn_mullo_n (xp, odd_inv_2exp, r2, ncnt); + + if (cnt != 0) + xp[ncnt - 1] &= (CNST_LIMB(1) << cnt) - 1; + + yp = tp; + if (ncnt > nodd) + mpn_mul (yp, xp, ncnt, mp, nodd); + else + mpn_mul (yp, mp, nodd, xp, ncnt); + + mpn_add (rp, yp, n, rp, nodd); + + ASSERT (nodd + ncnt >= n); + ASSERT (nodd + ncnt <= n + 1); } - xn = mn; - MPN_NORMALIZE (xp, xn); - if ((ep[0] & 1) && SIZ(b) < 0 && xn != 0) + MPN_NORMALIZE (rp, rn); + + if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0) { - mp = PTR(m); /* want original, unnormalized m */ - mpn_sub (xp, mp, mn, xp, xn); - xn = mn; - MPN_NORMALIZE (xp, xn); + mpn_sub (rp, PTR(m), n, rp, rn); + rn = n; + MPN_NORMALIZE (rp, rn); } - MPZ_REALLOC (r, xn); - SIZ (r) = xn; - MPN_COPY (PTR(r), xp, xn); - __GMP_FREE_FUNC_LIMBS (gp, K / 2 * mn); + ret: + MPZ_REALLOC (r, rn); + SIZ(r) = rn; + MPN_COPY (PTR(r), rp, rn); + TMP_FREE; } diff --git a/contrib/gmp/mpz/powm_sec.c b/contrib/gmp/mpz/powm_sec.c new file mode 100644 index 0000000000..2432fe4989 --- /dev/null +++ b/contrib/gmp/mpz/powm_sec.c @@ -0,0 +1,90 @@ +/* mpz_powm_sec(res,base,exp,mod) -- Set R to (U^E) mod M. + + Contributed to the GNU project by Torbjorn Granlund. + +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008, 2009 +Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + + +#include "gmp.h" +#include "gmp-impl.h" + + +void +mpz_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m) +{ + mp_size_t n; + mp_ptr rp, tp; + mp_srcptr bp, ep, mp; + mp_size_t rn, bn, es, en; + TMP_DECL; + + n = ABSIZ(m); + if (n == 0) + DIVIDE_BY_ZERO; + + mp = PTR(m); + + if (mp[0] % 2 == 0) + DIVIDE_BY_ZERO; + + es = SIZ(e); + if (UNLIKELY (es <= 0)) + { + mpz_t new_b; + if (es == 0) + { + /* b^0 mod m, b is anything and m is non-zero. + Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */ + SIZ(r) = n != 1 || mp[0] != 1; + PTR(r)[0] = 1; + return; + } + DIVIDE_BY_ZERO; + } + + en = es; + bn = ABSIZ(b); + + TMP_MARK; + tp = TMP_ALLOC_LIMBS (n + mpn_powm_sec_itch (bn, en, n)); + + rp = tp; tp += n; + + bp = PTR(b); + ep = PTR(e); + + mpn_powm_sec (rp, bp, bn, ep, en, mp, n, tp); + + rn = n; + + MPN_NORMALIZE (rp, rn); + + if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0) + { + mpn_sub (rp, PTR(m), n, rp, rn); + rn = n; + MPN_NORMALIZE (rp, rn); + } + + MPZ_REALLOC (r, rn); + SIZ(r) = rn; + MPN_COPY (PTR(r), rp, rn); + + TMP_FREE; +} diff --git a/contrib/gmp/mpz/powm_ui.c b/contrib/gmp/mpz/powm_ui.c index 9e44301d21..64615d1078 100644 --- a/contrib/gmp/mpz/powm_ui.c +++ b/contrib/gmp/mpz/powm_ui.c @@ -109,7 +109,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m) e = el; count_leading_zeros (c, e); e = (e << c) << 1; /* shift the exp bits to the left, lose msb */ - c = BITS_PER_MP_LIMB - 1 - c; + c = GMP_LIMB_BITS - 1 - c; /* Main loop. */ @@ -126,7 +126,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m) while (c != 0) { - mpn_sqr_n (tp, xp, xn); + mpn_sqr (tp, xp, xn); tn = 2 * xn; tn -= tp[tn - 1] == 0; if (tn < mn) { diff --git a/contrib/gmp/mpz/pprime_p.c b/contrib/gmp/mpz/pprime_p.c index 766155fa81..ce501a44b8 100644 --- a/contrib/gmp/mpz/pprime_p.c +++ b/contrib/gmp/mpz/pprime_p.c @@ -70,19 +70,19 @@ mpz_probab_prime_p (mpz_srcptr n, int reps) r = mpn_mod_1 (PTR(n), (mp_size_t) SIZ(n), (mp_limb_t) PP); #endif if (r % 3 == 0 -#if BITS_PER_MP_LIMB >= 4 +#if GMP_LIMB_BITS >= 4 || r % 5 == 0 #endif -#if BITS_PER_MP_LIMB >= 8 +#if GMP_LIMB_BITS >= 8 || r % 7 == 0 #endif -#if BITS_PER_MP_LIMB >= 16 +#if GMP_LIMB_BITS >= 16 || r % 11 == 0 || r % 13 == 0 #endif -#if BITS_PER_MP_LIMB >= 32 +#if GMP_LIMB_BITS >= 32 || r % 17 == 0 || r % 19 == 0 || r % 23 == 0 || r % 29 == 0 #endif -#if BITS_PER_MP_LIMB >= 64 +#if GMP_LIMB_BITS >= 64 || r % 31 == 0 || r % 37 == 0 || r % 41 == 0 || r % 43 == 0 || r % 47 == 0 || r % 53 == 0 #endif diff --git a/contrib/gmp/mpz/realloc2.c b/contrib/gmp/mpz/realloc2.c index 9c03c8bfc0..84295f6c57 100644 --- a/contrib/gmp/mpz/realloc2.c +++ b/contrib/gmp/mpz/realloc2.c @@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_realloc2 (mpz_ptr m, unsigned long bits) +mpz_realloc2 (mpz_ptr m, mp_bitcnt_t bits) { mp_size_t new_alloc; diff --git a/contrib/gmp/mpz/remove.c b/contrib/gmp/mpz/remove.c index e670afc4ed..21c002345f 100644 --- a/contrib/gmp/mpz/remove.c +++ b/contrib/gmp/mpz/remove.c @@ -20,12 +20,12 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -unsigned long int +mp_bitcnt_t mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f) { mpz_t fpow[GMP_LIMB_BITS]; /* Really MP_SIZE_T_BITS */ mpz_t x, rem; - unsigned long int pwr; + mp_bitcnt_t pwr; int p; if (mpz_cmp_ui (f, 1) <= 0) @@ -40,7 +40,7 @@ mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f) if (mpz_cmp_ui (f, 2) == 0) { - unsigned long int s0; + mp_bitcnt_t s0; s0 = mpz_scan1 (src, 0); mpz_div_2exp (dest, src, s0); return s0; diff --git a/contrib/gmp/mpz/rrandomb.c b/contrib/gmp/mpz/rrandomb.c index f34aaec7ad..ee8aa35822 100644 --- a/contrib/gmp/mpz/rrandomb.c +++ b/contrib/gmp/mpz/rrandomb.c @@ -22,10 +22,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, unsigned long int)); +static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, mp_bitcnt_t)); void -mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, unsigned long int nbits) +mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits) { mp_size_t nl; @@ -49,9 +49,9 @@ mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, unsigned long int nbits) #endif static void -gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits) +gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits) { - unsigned long int bi; + mp_bitcnt_t bi; mp_limb_t ranm; /* buffer for random bits */ unsigned cap_chunksize, chunksize; mp_size_t i; diff --git a/contrib/gmp/mpz/scan0.c b/contrib/gmp/mpz/scan0.c index 3ad0941a32..9cb05337da 100644 --- a/contrib/gmp/mpz/scan0.c +++ b/contrib/gmp/mpz/scan0.c @@ -27,14 +27,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ search under u<0, but usually the search won't go very far so it seems reasonable to inline that code. */ -unsigned long -mpz_scan0 (mpz_srcptr u, unsigned long starting_bit) +mp_bitcnt_t +mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) { mp_srcptr u_ptr = PTR(u); mp_size_t size = SIZ(u); mp_size_t abs_size = ABS(size); mp_srcptr u_end = u_ptr + abs_size; - unsigned long starting_limb = starting_bit / GMP_NUMB_BITS; + mp_size_t starting_limb = starting_bit / GMP_NUMB_BITS; mp_srcptr p = u_ptr + starting_limb; mp_limb_t limb; int cnt; @@ -57,7 +57,7 @@ mpz_scan0 (mpz_srcptr u, unsigned long starting_bit) { p++; if (p == u_end) - return (unsigned long) abs_size * GMP_NUMB_BITS; + return (mp_bitcnt_t) abs_size * GMP_NUMB_BITS; limb = *p; } @@ -115,5 +115,5 @@ mpz_scan0 (mpz_srcptr u, unsigned long starting_bit) ASSERT (limb != 0); count_trailing_zeros (cnt, limb); - return (p - u_ptr) * GMP_NUMB_BITS + cnt; + return (mp_bitcnt_t) (p - u_ptr) * GMP_NUMB_BITS + cnt; } diff --git a/contrib/gmp/mpz/scan1.c b/contrib/gmp/mpz/scan1.c index 329177ec55..dcf77986fb 100644 --- a/contrib/gmp/mpz/scan1.c +++ b/contrib/gmp/mpz/scan1.c @@ -27,14 +27,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ (except when in the high limb), but usually the search won't go very far so it seems reasonable to inline that code. */ -unsigned long -mpz_scan1 (mpz_srcptr u, unsigned long starting_bit) +mp_bitcnt_t +mpz_scan1 (mpz_srcptr u, mp_bitcnt_t starting_bit) { mp_srcptr u_ptr = PTR(u); mp_size_t size = SIZ(u); mp_size_t abs_size = ABS(size); mp_srcptr u_end = u_ptr + abs_size; - unsigned long starting_limb = starting_bit / GMP_NUMB_BITS; + mp_size_t starting_limb = starting_bit / GMP_NUMB_BITS; mp_srcptr p = u_ptr + starting_limb; mp_limb_t limb; int cnt; @@ -122,7 +122,7 @@ mpz_scan1 (mpz_srcptr u, unsigned long starting_bit) { p++; if (p == u_end) - return abs_size * GMP_NUMB_BITS; + return (mp_bitcnt_t) abs_size * GMP_NUMB_BITS; limb = *p; } @@ -133,5 +133,5 @@ mpz_scan1 (mpz_srcptr u, unsigned long starting_bit) got_limb: ASSERT (limb != 0); count_trailing_zeros (cnt, limb); - return (p - u_ptr) * GMP_NUMB_BITS + cnt; + return (mp_bitcnt_t) (p - u_ptr) * GMP_NUMB_BITS + cnt; } diff --git a/contrib/gmp/mpz/setbit.c b/contrib/gmp/mpz/setbit.c index b4715b6a1d..6d9b4020d5 100644 --- a/contrib/gmp/mpz/setbit.c +++ b/contrib/gmp/mpz/setbit.c @@ -22,7 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_setbit (mpz_ptr d, unsigned long int bit_index) +mpz_setbit (mpz_ptr d, mp_bitcnt_t bit_index) { mp_size_t dsize = d->_mp_size; mp_ptr dp = d->_mp_d; diff --git a/contrib/gmp/mpz/sqrt.c b/contrib/gmp/mpz/sqrt.c index c067e63113..6de21209c2 100644 --- a/contrib/gmp/mpz/sqrt.c +++ b/contrib/gmp/mpz/sqrt.c @@ -67,7 +67,7 @@ mpz_sqrt (mpz_ptr root, mpz_srcptr op) if (root_ptr == op_ptr) { /* ROOT and OP are identical. Allocate temporary space for OP. */ - op_ptr = (mp_ptr) TMP_ALLOC (op_size * BYTES_PER_MP_LIMB); + op_ptr = TMP_ALLOC_LIMBS (op_size); /* Copy to the temporary space. Hack: Avoid temporary variable by using ROOT_PTR. */ MPN_COPY (op_ptr, root_ptr, op_size); diff --git a/contrib/gmp/mpz/sqrtrem.c b/contrib/gmp/mpz/sqrtrem.c index 9b44f45985..ed8a85b6c6 100644 --- a/contrib/gmp/mpz/sqrtrem.c +++ b/contrib/gmp/mpz/sqrtrem.c @@ -79,7 +79,7 @@ msqrt (mpz_srcptr op, mpz_ptr root, mpz_ptr rem) if (root_ptr == op_ptr) { /* ROOT and OP are identical. Allocate temporary space for OP. */ - op_ptr = (mp_ptr) TMP_ALLOC (op_size * BYTES_PER_MP_LIMB); + op_ptr = TMP_ALLOC_LIMBS (op_size); /* Copy to the temporary space. Hack: Avoid temporary variable by using ROOT_PTR. */ MPN_COPY (op_ptr, root_ptr, op_size); diff --git a/contrib/gmp/mpz/tdiv_q.c b/contrib/gmp/mpz/tdiv_q.c index 75811bc3eb..e78dd64dce 100644 --- a/contrib/gmp/mpz/tdiv_q.c +++ b/contrib/gmp/mpz/tdiv_q.c @@ -1,6 +1,6 @@ /* mpz_tdiv_q -- divide two integers and produce a quotient. -Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005 Free Software Foundation, +Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2010 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -27,7 +27,7 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den) { mp_size_t ql; mp_size_t ns, ds, nl, dl; - mp_ptr np, dp, qp, rp; + mp_ptr np, dp, qp; TMP_DECL; ns = SIZ (num); @@ -49,19 +49,14 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den) TMP_MARK; qp = PTR (quot); - rp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB); np = PTR (num); dp = PTR (den); - /* FIXME: We should think about how to handle the temporary allocation. - Perhaps mpn_tdiv_qr should handle it, since it anyway often needs to - allocate temp space. */ - /* Copy denominator to temporary space if it overlaps with the quotient. */ if (dp == qp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (dl); MPN_COPY (tp, dp, dl); dp = tp; } @@ -69,12 +64,17 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den) if (np == qp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (nl + 1); MPN_COPY (tp, np, nl); - np = tp; + /* Overlap dividend and scratch. */ + mpn_div_q (qp, tp, nl, dp, dl, tp); + } + else + { + mp_ptr tp; + tp = TMP_ALLOC_LIMBS (nl + 1); + mpn_div_q (qp, np, nl, dp, dl, tp); } - - mpn_tdiv_qr (qp, rp, 0L, np, nl, dp, dl); ql -= qp[ql - 1] == 0; diff --git a/contrib/gmp/mpz/tdiv_q_2exp.c b/contrib/gmp/mpz/tdiv_q_2exp.c index 7f79e1e4ef..491d9d0fe4 100644 --- a/contrib/gmp/mpz/tdiv_q_2exp.c +++ b/contrib/gmp/mpz/tdiv_q_2exp.c @@ -22,7 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_tdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long int cnt) +mpz_tdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt) { mp_size_t usize, wsize; mp_size_t limb_cnt; diff --git a/contrib/gmp/mpz/tdiv_qr.c b/contrib/gmp/mpz/tdiv_qr.c index 53ddae86f8..64b6e03f02 100644 --- a/contrib/gmp/mpz/tdiv_qr.c +++ b/contrib/gmp/mpz/tdiv_qr.c @@ -81,7 +81,7 @@ mdiv (mpz_srcptr num, mpz_srcptr den, mpz_ptr quot, mpz_ptr rem) if (dp == rp || dp == qp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (dl); MPN_COPY (tp, dp, dl); dp = tp; } @@ -90,7 +90,7 @@ mdiv (mpz_srcptr num, mpz_srcptr den, mpz_ptr quot, mpz_ptr rem) if (np == rp || np == qp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (nl); MPN_COPY (tp, np, nl); np = tp; } diff --git a/contrib/gmp/mpz/tdiv_r.c b/contrib/gmp/mpz/tdiv_r.c index 8c3a456dfd..a3b008c5ed 100644 --- a/contrib/gmp/mpz/tdiv_r.c +++ b/contrib/gmp/mpz/tdiv_r.c @@ -54,7 +54,7 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den) } TMP_MARK; - qp = (mp_ptr) TMP_ALLOC (ql * BYTES_PER_MP_LIMB); + qp = TMP_ALLOC_LIMBS (ql); rp = PTR (rem); np = PTR (num); dp = PTR (den); @@ -67,7 +67,7 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den) if (dp == rp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (dl); MPN_COPY (tp, dp, dl); dp = tp; } @@ -75,7 +75,7 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den) if (np == rp) { mp_ptr tp; - tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (nl); MPN_COPY (tp, np, nl); np = tp; } diff --git a/contrib/gmp/mpz/tdiv_r_2exp.c b/contrib/gmp/mpz/tdiv_r_2exp.c index 951b75d419..3828ff1306 100644 --- a/contrib/gmp/mpz/tdiv_r_2exp.c +++ b/contrib/gmp/mpz/tdiv_r_2exp.c @@ -21,7 +21,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, unsigned long int cnt) +mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, mp_bitcnt_t cnt) { mp_size_t in_size = ABS (in->_mp_size); mp_size_t res_size; diff --git a/contrib/gmp/mpz/tstbit.c b/contrib/gmp/mpz/tstbit.c index 37f1454a60..02133cc004 100644 --- a/contrib/gmp/mpz/tstbit.c +++ b/contrib/gmp/mpz/tstbit.c @@ -38,12 +38,12 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ the limb_index >= abs_size test covers u=0 too. */ int -mpz_tstbit (mpz_srcptr u, unsigned long bit_index) +mpz_tstbit (mpz_srcptr u, mp_bitcnt_t bit_index) { mp_srcptr u_ptr = PTR(u); mp_size_t size = SIZ(u); unsigned abs_size = ABS(size); - unsigned long limb_index = bit_index / GMP_NUMB_BITS; + mp_size_t limb_index = bit_index / GMP_NUMB_BITS; mp_srcptr p = u_ptr + limb_index; mp_limb_t limb; diff --git a/contrib/gmp/mpz/urandomb.c b/contrib/gmp/mpz/urandomb.c index 3072cd40f9..fc7ec55cec 100644 --- a/contrib/gmp/mpz/urandomb.c +++ b/contrib/gmp/mpz/urandomb.c @@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits) +mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, mp_bitcnt_t nbits) { mp_ptr rp; mp_size_t size; diff --git a/contrib/gmp/nextprime.c b/contrib/gmp/nextprime.c new file mode 100644 index 0000000000..f3e80f6ddc --- /dev/null +++ b/contrib/gmp/nextprime.c @@ -0,0 +1,156 @@ +/* gmp_nextprime -- generate small primes reasonably efficiently for internal + GMP needs. + + Contributed to the GNU project by Torbjorn Granlund. Miscellaneous + improvements by Martin Boij. + + THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY + SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST + GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE. + +Copyright 2009 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +/* + Optimisation ideas: + + 1. Unroll the sieving loops. Should reach 1 write/cycle. That would be a 2x + improvement. + + 2. Separate sieving with primes p < SIEVESIZE and p >= SIEVESIZE. The latter + will need at most one write, and thus not need any inner loop. + + 3. For primes p >= SIEVESIZE, i.e., typically the majority of primes, we + perform more than one division per sieving write. That might dominate the + entire run time for the nextprime function. A incrementally initialised + remainder table of Pi(65536) = 6542 16-bit entries could replace that + division. +*/ + +#include "gmp.h" +#include "gmp-impl.h" +#include /* for memset */ + + +unsigned long int +gmp_nextprime (gmp_primesieve_t *ps) +{ + unsigned long p, d, pi; + unsigned char *sp; + static unsigned char addtab[] = + { 2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4,8,6,4,6,2,4,6,2,6,6,4, + 2,4,6,2,6,4,2,4,2,10,2,10 }; + unsigned char *addp = addtab; + unsigned long ai; + + /* Look for already sieved primes. A sentinel at the end of the sieving + area allows us to use a very simple loop here. */ + d = ps->d; + sp = ps->s + d; + while (*sp != 0) + sp++; + if (sp != ps->s + SIEVESIZE) + { + d = sp - ps->s; + ps->d = d + 1; + return ps->s0 + 2 * d; + } + + /* Handle the number 2 separately. */ + if (ps->s0 < 3) + { + ps->s0 = 3 - 2 * SIEVESIZE; /* Tricky */ + return 2; + } + + /* Exhausted computed primes. Resieve, then call ourselves recursively. */ + +#if 0 + for (sp = ps->s; sp < ps->s + SIEVESIZE; sp++) + *sp = 0; +#else + memset (ps->s, 0, SIEVESIZE); +#endif + + ps->s0 += 2 * SIEVESIZE; + + /* Update sqrt_s0 as needed. */ + while ((ps->sqrt_s0 + 1) * (ps->sqrt_s0 + 1) <= ps->s0 + 2 * SIEVESIZE - 1) + ps->sqrt_s0++; + + pi = ((ps->s0 + 3) / 2) % 3; + if (pi > 0) + pi = 3 - pi; + if (ps->s0 + 2 * pi <= 3) + pi += 3; + sp = ps->s + pi; + while (sp < ps->s + SIEVESIZE) + { + *sp = 1, sp += 3; + } + + pi = ((ps->s0 + 5) / 2) % 5; + if (pi > 0) + pi = 5 - pi; + if (ps->s0 + 2 * pi <= 5) + pi += 5; + sp = ps->s + pi; + while (sp < ps->s + SIEVESIZE) + { + *sp = 1, sp += 5; + } + + pi = ((ps->s0 + 7) / 2) % 7; + if (pi > 0) + pi = 7 - pi; + if (ps->s0 + 2 * pi <= 7) + pi += 7; + sp = ps->s + pi; + while (sp < ps->s + SIEVESIZE) + { + *sp = 1, sp += 7; + } + + p = 11; + ai = 0; + while (p <= ps->sqrt_s0) + { + pi = ((ps->s0 + p) / 2) % p; + if (pi > 0) + pi = p - pi; + if (ps->s0 + 2 * pi <= p) + pi += p; + sp = ps->s + pi; + while (sp < ps->s + SIEVESIZE) + { + *sp = 1, sp += p; + } + p += addp[ai]; + ai = (ai + 1) % 48; + } + ps->d = 0; + return gmp_nextprime (ps); +} + +void +gmp_init_primesieve (gmp_primesieve_t *ps) +{ + ps->s0 = 0; + ps->sqrt_s0 = 0; + ps->d = SIEVESIZE; + ps->s[SIEVESIZE] = 0; /* sentinel */ +} diff --git a/contrib/gmp/printf/Makefile.am b/contrib/gmp/printf/Makefile.am deleted file mode 100644 index c4aead79be..0000000000 --- a/contrib/gmp/printf/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) - -noinst_LTLIBRARIES = libprintf.la - -libprintf_la_SOURCES = \ - asprintf.c asprntffuns.c doprnt.c doprntf.c doprnti.c \ - fprintf.c obprintf.c obvprintf.c obprntffuns.c \ - printf.c printffuns.c snprintf.c snprntffuns.c sprintf.c sprintffuns.c \ - vasprintf.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \ - repl-vsnprintf.c diff --git a/contrib/gmp/printf/Makefile.in b/contrib/gmp/printf/Makefile.in deleted file mode 100644 index 4bb96dcd32..0000000000 --- a/contrib/gmp/printf/Makefile.in +++ /dev/null @@ -1,540 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(libprintf_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -subdir = printf -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libprintf_la_LIBADD = -am_libprintf_la_OBJECTS = asprintf$U.lo asprntffuns$U.lo doprnt$U.lo \ - doprntf$U.lo doprnti$U.lo fprintf$U.lo obprintf$U.lo \ - obvprintf$U.lo obprntffuns$U.lo printf$U.lo printffuns$U.lo \ - snprintf$U.lo snprntffuns$U.lo sprintf$U.lo sprintffuns$U.lo \ - vasprintf$U.lo vfprintf$U.lo vprintf$U.lo vsnprintf$U.lo \ - vsprintf$U.lo repl-vsnprintf$U.lo -libprintf_la_OBJECTS = $(am_libprintf_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libprintf_la_SOURCES) -DIST_SOURCES = $(libprintf_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) -noinst_LTLIBRARIES = libprintf.la -libprintf_la_SOURCES = \ - asprintf.c asprntffuns.c doprnt.c doprntf.c doprnti.c \ - fprintf.c obprintf.c obvprintf.c obprntffuns.c \ - printf.c printffuns.c snprintf.c snprntffuns.c sprintf.c sprintffuns.c \ - vasprintf.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \ - repl-vsnprintf.c - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps printf/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps printf/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libprintf.la: $(libprintf_la_OBJECTS) $(libprintf_la_DEPENDENCIES) - $(LINK) $(libprintf_la_LDFLAGS) $(libprintf_la_OBJECTS) $(libprintf_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -asprintf_.c: asprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/asprintf.c; then echo $(srcdir)/asprintf.c; else echo asprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -asprntffuns_.c: asprntffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/asprntffuns.c; then echo $(srcdir)/asprntffuns.c; else echo asprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -doprnt_.c: doprnt.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprnt.c; then echo $(srcdir)/doprnt.c; else echo doprnt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -doprntf_.c: doprntf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprntf.c; then echo $(srcdir)/doprntf.c; else echo doprntf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -doprnti_.c: doprnti.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprnti.c; then echo $(srcdir)/doprnti.c; else echo doprnti.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fprintf_.c: fprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fprintf.c; then echo $(srcdir)/fprintf.c; else echo fprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -obprintf_.c: obprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obprintf.c; then echo $(srcdir)/obprintf.c; else echo obprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -obprntffuns_.c: obprntffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obprntffuns.c; then echo $(srcdir)/obprntffuns.c; else echo obprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -obvprintf_.c: obvprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obvprintf.c; then echo $(srcdir)/obvprintf.c; else echo obvprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -printf_.c: printf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/printf.c; then echo $(srcdir)/printf.c; else echo printf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -printffuns_.c: printffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/printffuns.c; then echo $(srcdir)/printffuns.c; else echo printffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -repl-vsnprintf_.c: repl-vsnprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/repl-vsnprintf.c; then echo $(srcdir)/repl-vsnprintf.c; else echo repl-vsnprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -snprintf_.c: snprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprintf.c; then echo $(srcdir)/snprintf.c; else echo snprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -snprntffuns_.c: snprntffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprntffuns.c; then echo $(srcdir)/snprntffuns.c; else echo snprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sprintf_.c: sprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sprintf.c; then echo $(srcdir)/sprintf.c; else echo sprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sprintffuns_.c: sprintffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sprintffuns.c; then echo $(srcdir)/sprintffuns.c; else echo sprintffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vasprintf_.c: vasprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vasprintf.c; then echo $(srcdir)/vasprintf.c; else echo vasprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vfprintf_.c: vfprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vfprintf.c; then echo $(srcdir)/vfprintf.c; else echo vfprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vprintf_.c: vprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vprintf.c; then echo $(srcdir)/vprintf.c; else echo vprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vsnprintf_.c: vsnprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsnprintf.c; then echo $(srcdir)/vsnprintf.c; else echo vsnprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vsprintf_.c: vsprintf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsprintf.c; then echo $(srcdir)/vsprintf.c; else echo vsprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -asprintf_.$(OBJEXT) asprintf_.lo asprntffuns_.$(OBJEXT) \ -asprntffuns_.lo doprnt_.$(OBJEXT) doprnt_.lo doprntf_.$(OBJEXT) \ -doprntf_.lo doprnti_.$(OBJEXT) doprnti_.lo fprintf_.$(OBJEXT) \ -fprintf_.lo obprintf_.$(OBJEXT) obprintf_.lo obprntffuns_.$(OBJEXT) \ -obprntffuns_.lo obvprintf_.$(OBJEXT) obvprintf_.lo printf_.$(OBJEXT) \ -printf_.lo printffuns_.$(OBJEXT) printffuns_.lo \ -repl-vsnprintf_.$(OBJEXT) repl-vsnprintf_.lo snprintf_.$(OBJEXT) \ -snprintf_.lo snprntffuns_.$(OBJEXT) snprntffuns_.lo sprintf_.$(OBJEXT) \ -sprintf_.lo sprintffuns_.$(OBJEXT) sprintffuns_.lo \ -vasprintf_.$(OBJEXT) vasprintf_.lo vfprintf_.$(OBJEXT) vfprintf_.lo \ -vprintf_.$(OBJEXT) vprintf_.lo vsnprintf_.$(OBJEXT) vsnprintf_.lo \ -vsprintf_.$(OBJEXT) vsprintf_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/printf/doprntf.c b/contrib/gmp/printf/doprntf.c index 0bd4ea800f..537dce5b63 100644 --- a/contrib/gmp/printf/doprntf.c +++ b/contrib/gmp/printf/doprntf.c @@ -62,7 +62,7 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs, int fraczeros, fraclen, preczeros; char *s, *free_ptr; mp_exp_t exp; - char exponent[BITS_PER_MP_LIMB + 10]; + char exponent[GMP_LIMB_BITS + 10]; const char *showbase; int retval = 0; @@ -91,7 +91,7 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs, digit and subtract that from prec. In either case add 2 so the round to nearest can be applied accurately. */ ndigits = prec + 2 - + EXP(f) * (__mp_bases[ABS(p->base)].chars_per_limb + (EXP(f)>=0)); + + EXP(f) * (mp_bases[ABS(p->base)].chars_per_limb + (EXP(f)>=0)); ndigits = MAX (ndigits, 1); break; diff --git a/contrib/gmp/printf/snprntffuns.c b/contrib/gmp/printf/snprntffuns.c index e67017469c..340ee051a7 100644 --- a/contrib/gmp/printf/snprntffuns.c +++ b/contrib/gmp/printf/snprntffuns.c @@ -45,7 +45,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ no indication how big the output would have been. It's necessary to re-run to determine that size. - "size-1" would mean sucess from a C99 vsnprintf, and the re-run is + "size-1" would mean success from a C99 vsnprintf, and the re-run is unnecessary in this case, but we don't bother to try to detect what sort of vsnprintf we've got. size-1 should occur rarely in normal circumstances. diff --git a/contrib/gmp/randlc2s.c b/contrib/gmp/randlc2s.c index 819ebbc04a..4dcde73a2a 100644 --- a/contrib/gmp/randlc2s.c +++ b/contrib/gmp/randlc2s.c @@ -62,7 +62,7 @@ static const struct __gmp_rand_lc_scheme_struct __gmp_rand_lc_scheme[] = }; int -gmp_randinit_lc_2exp_size (gmp_randstate_t rstate, unsigned long size) +gmp_randinit_lc_2exp_size (gmp_randstate_t rstate, mp_bitcnt_t size) { const struct __gmp_rand_lc_scheme_struct *sp; mpz_t a; diff --git a/contrib/gmp/randlc2x.c b/contrib/gmp/randlc2x.c index f1994187d9..ba45b60bd1 100644 --- a/contrib/gmp/randlc2x.c +++ b/contrib/gmp/randlc2x.c @@ -92,11 +92,11 @@ lc (mp_ptr rp, gmp_randstate_t rstate) { mp_size_t tmp = an + seedn; ta = tn + 1; - tp = (mp_ptr) TMP_ALLOC (ta * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (ta); MPN_ZERO (&tp[tmp], ta - tmp); /* mpn_mul won't zero it out. */ } else - tp = (mp_ptr) TMP_ALLOC (ta * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (ta); /* t = a * seed. NOTE: an is always > 0; see initialization. */ ASSERT (seedn >= an && an > 0); @@ -155,7 +155,7 @@ randget_lc (gmp_randstate_t rstate, mp_ptr rp, unsigned long int nbits) chunk_nbits = p->_mp_m2exp / 2; tn = BITS_TO_LIMBS (chunk_nbits); - tp = (mp_ptr) TMP_ALLOC (tn * BYTES_PER_MP_LIMB); + tp = TMP_ALLOC_LIMBS (tn); rbitpos = 0; while (rbitpos + chunk_nbits <= nbits) @@ -283,7 +283,7 @@ void gmp_randinit_lc_2exp (gmp_randstate_t rstate, mpz_srcptr a, unsigned long int c, - unsigned long int m2exp) + mp_bitcnt_t m2exp) { gmp_rand_lc_struct *p; mp_size_t seedn = BITS_TO_LIMBS (m2exp); diff --git a/contrib/gmp/scanf/Makefile.am b/contrib/gmp/scanf/Makefile.am deleted file mode 100644 index 5359b5e5e6..0000000000 --- a/contrib/gmp/scanf/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -## Process this file with automake to generate Makefile.in - -# Copyright 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - - -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) - -noinst_LTLIBRARIES = libscanf.la - -libscanf_la_SOURCES = \ - doscan.c fscanf.c fscanffuns.c scanf.c sscanf.c sscanffuns.c \ - vfscanf.c vscanf.c vsscanf.c diff --git a/contrib/gmp/scanf/Makefile.in b/contrib/gmp/scanf/Makefile.in deleted file mode 100644 index 028a8c853a..0000000000 --- a/contrib/gmp/scanf/Makefile.in +++ /dev/null @@ -1,503 +0,0 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Copyright 2001, 2002 Free Software Foundation, Inc. -# -# This file is part of the GNU MP Library. -# -# The GNU MP Library is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# The GNU MP Library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public -# License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. - -SOURCES = $(libscanf_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ANSI2KNR = $(top_builddir)/ansi2knr -subdir = scanf -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libscanf_la_LIBADD = -am_libscanf_la_OBJECTS = doscan$U.lo fscanf$U.lo fscanffuns$U.lo \ - scanf$U.lo sscanf$U.lo sscanffuns$U.lo vfscanf$U.lo \ - vscanf$U.lo vsscanf$U.lo -libscanf_la_OBJECTS = $(am_libscanf_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libscanf_la_SOURCES) -DIST_SOURCES = $(libscanf_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABI = @ABI@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -ASMFLAGS = @ASMFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ -CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ -CC = @CC@ -CCAS = @CCAS@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPP_FOR_BUILD = @CPP_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ -ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ -EXEEXT = @EXEEXT@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_NAIL_BITS = @GMP_NAIL_BITS@ -GREP = @GREP@ -HAVE_CLOCK_01 = @HAVE_CLOCK_01@ -HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@ -HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@ -HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@ -HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@ -HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@ -HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@ -HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ -HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ -HAVE_STACK_T_01 = @HAVE_STACK_T_01@ -HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCURSES = @LIBCURSES@ -LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@ -LIBGMP_DLL = @LIBGMP_DLL@ -LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@ -LIBM = @LIBM@ -LIBM_FOR_BUILD = @LIBM_FOR_BUILD@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE = @LIBREADLINE@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -M4 = @M4@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ -STRIP = @STRIP@ -TAL_OBJECT = @TAL_OBJECT@ -TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ -U = @U@ -U_FOR_BUILD = @U_FOR_BUILD@ -VERSION = @VERSION@ -WANT_CXX_FALSE = @WANT_CXX_FALSE@ -WANT_CXX_TRUE = @WANT_CXX_TRUE@ -WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ -WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ -WITH_READLINE_01 = @WITH_READLINE_01@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__leading_dot = @am__leading_dot@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gmp_srclinks = @gmp_srclinks@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mpn_objects = @mpn_objects@ -mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ -mpn_objs_in_libmp = @mpn_objs_in_libmp@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) -noinst_LTLIBRARIES = libscanf.la -libscanf_la_SOURCES = \ - doscan.c fscanf.c fscanffuns.c scanf.c sscanf.c sscanffuns.c \ - vfscanf.c vscanf.c vsscanf.c - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libscanf.la: $(libscanf_la_OBJECTS) $(libscanf_la_DEPENDENCIES) - $(LINK) $(libscanf_la_LDFLAGS) $(libscanf_la_OBJECTS) $(libscanf_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c -$(top_builddir)/ansi2knr: - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -mostlyclean-kr: - -test "$U" = "" || rm -f *_.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< -doscan_.c: doscan.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doscan.c; then echo $(srcdir)/doscan.c; else echo doscan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fscanf_.c: fscanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fscanf.c; then echo $(srcdir)/fscanf.c; else echo fscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -fscanffuns_.c: fscanffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fscanffuns.c; then echo $(srcdir)/fscanffuns.c; else echo fscanffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -scanf_.c: scanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scanf.c; then echo $(srcdir)/scanf.c; else echo scanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sscanf_.c: sscanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sscanf.c; then echo $(srcdir)/sscanf.c; else echo sscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -sscanffuns_.c: sscanffuns.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sscanffuns.c; then echo $(srcdir)/sscanffuns.c; else echo sscanffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vfscanf_.c: vfscanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vfscanf.c; then echo $(srcdir)/vfscanf.c; else echo vfscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vscanf_.c: vscanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vscanf.c; then echo $(srcdir)/vscanf.c; else echo vscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -vsscanf_.c: vsscanf.c $(ANSI2KNR) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsscanf.c; then echo $(srcdir)/vsscanf.c; else echo vsscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -doscan_.$(OBJEXT) doscan_.lo fscanf_.$(OBJEXT) fscanf_.lo \ -fscanffuns_.$(OBJEXT) fscanffuns_.lo scanf_.$(OBJEXT) scanf_.lo \ -sscanf_.$(OBJEXT) sscanf_.lo sscanffuns_.$(OBJEXT) sscanffuns_.lo \ -vfscanf_.$(OBJEXT) vfscanf_.lo vscanf_.$(OBJEXT) vscanf_.lo \ -vsscanf_.$(OBJEXT) vsscanf_.lo : $(ANSI2KNR) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/gmp/scanf/doscan.c b/contrib/gmp/scanf/doscan.c index 0f70629264..2c5b1d9876 100644 --- a/contrib/gmp/scanf/doscan.c +++ b/contrib/gmp/scanf/doscan.c @@ -70,7 +70,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ It's necessary to parse up the format string to recognise the GMP extra types F, Q and Z. Other types and conversions are passed across to the standard sscanf or fscanf via funs->scan, for ease of - implemenation. This is essential in the case of something like glibc + implementation. This is essential in the case of something like glibc %p where the pointer format isn't actually documented. Because funs->scan doesn't get the whole input it can't put the right diff --git a/contrib/gmp/ylwrap b/contrib/gmp/ylwrap new file mode 100755 index 0000000000..84d563405e --- /dev/null +++ b/contrib/gmp/ylwrap @@ -0,0 +1,222 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, +# 2007, 2009 Free Software Foundation, Inc. +# +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input="$1" +shift +case "$input" in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input="`pwd`/$input" + ;; +esac + +pairlist= +while test "$#" -ne 0; do + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift +done + +# The program to run. +prog="$1" +shift +# Make any relative path in $prog absolute. +case "$prog" in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; +esac + +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) "$prog" "$input" ;; + *) "$prog" "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # We do not want to overwrite a header file if it hasn't + # changed. This avoid useless recompilations. However the + # parser itself (the first file) should always be updated, + # because it is the destination of the .y.c rule in the + # Makefile. Divert the output of all other files to a temporary + # file so we can compare them to existing versions. + if test $first = no; then + realtarget="$target" + target="tmp-`echo $target | sed s/.*[\\/]//g`" + fi + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + + sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ + -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$? + + # Check whether header files must be updated. + if test $first = no; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$2" is unchanged + rm -f "$target" + else + echo updating "$2" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + ret=1 + fi + fi + shift + shift + first=no + done +else + ret=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: -- 2.41.0