1
dnl Process this file with autoconf to produce a configure script.
6
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
9
This file is part of the GNU MP Library.
11
The GNU MP Library is free software; you can redistribute it and/or modify
12
it under the terms of the GNU Lesser General Public License as published
13
by the Free Software Foundation; either version 2.1 of the License, or (at
14
your option) any later version.
16
The GNU MP Library is distributed in the hope that it will be useful, but
17
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19
License for more details.
21
You should have received a copy of the GNU Lesser General Public License
22
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
23
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28
AC_REVISION($Revision: 1.5 $)
31
m4_pattern_forbid([^[ \t]*GMP_])
32
m4_pattern_forbid([^[ \t]*MPFR_CONFIGS])
33
m4_pattern_allow(GMP_LDFLAGS)
34
m4_pattern_allow(GMP_LIMB_BITS)
35
m4_pattern_allow(GMP_MPARAM_H_SUGGEST)
36
m4_pattern_allow(GMP_NAIL_BITS)
37
m4_pattern_allow(GMP_NUMB_BITS)
39
# If --target is not used then $target_alias is empty, but if say
40
# "./configure athlon-pc-freebsd3.5" is used, then all three of
41
# $build_alias, $host_alias and $target_alias are set to
42
# "athlon-pc-freebsd3.5".
44
if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then
45
AC_MSG_ERROR([--target is not appropriate for GMP
46
Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
47
explicitly. Use --host if cross-compiling (see "Installing GMP" in the
48
manual for more on this).])
54
tmp_host=`echo $host_cpu | sed 's/\./_/'`
55
AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
56
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST)
58
AM_INIT_AUTOMAKE(gmp, GMP_VERSION)
59
AM_CONFIG_HEADER(config.h:config.in)
64
AC_HELP_STRING([--enable-assert],[enable ASSERT checking [[default=no]]]),
67
*) AC_MSG_ERROR([bad value $enableval for --enable-assert, need yes or no]) ;;
71
if test "$enable_assert" = "yes"; then
72
AC_DEFINE(WANT_ASSERT,1,
73
[./configure --enable-assert option, to enable some ASSERT()s])
78
AC_HELP_STRING([--enable-alloca],[how to get temp memory [[default=reentrant]]]),
80
alloca|malloc-reentrant|malloc-notreentrant) ;;
81
yes|no|reentrant|notreentrant) ;;
84
AC_MSG_ERROR([bad value $enableval for --enable-alloca, need one of:
85
yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug]) ;;
87
[enable_alloca=reentrant])
90
# IMPROVE ME: The default for C++ is disabled. The tests currently
91
# performed below for a working C++ compiler are not particularly strong,
92
# and in general can't be expected to get the right setup on their own. The
93
# most significant problem is getting the ABI the same. Defaulting CXXFLAGS
94
# to CFLAGS takes only a small step towards this. It's also probably worth
95
# worrying whether the C and C++ runtimes from say gcc and a vendor C++ can
96
# work together. Some rather broken C++ installations were encountered
97
# during testing, and though such things clearly aren't GMP's problem, if
98
# --enable-cxx=detect were to be the default then some careful checks of
99
# which, if any, C++ compiler on the system is up to scratch would be
103
AC_HELP_STRING([--enable-cxx],[enable C++ support [[default=no]]]),
106
*) AC_MSG_ERROR([bad value $enableval for --enable-cxx, need yes/no/detect]) ;;
112
AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [[default=yes]]]),
115
*) AC_MSG_ERROR([bad value $enableval for --enable-fft, need yes or no]) ;;
119
if test "$enable_fft" = "yes"; then
120
AC_DEFINE(WANT_FFT,1,
121
[./configure --enable-fft option, to enable FFTs for multiplication])
126
AC_HELP_STRING([--enable-mpbsd],
127
[build Berkeley MP compatibility library [[default=no]]]),
130
*) AC_MSG_ERROR([bad value $enableval for --enable-mpbsd, need yes or no]) ;;
133
AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes")
137
AC_HELP_STRING([--enable-mpfr],[build MPFR [[default=no]]]),
140
*) AC_MSG_ERROR([bad value $enableval for --enable-mpfr, need yes or no]) ;;
143
AM_CONDITIONAL(WANT_MPFR, test "$enable_mpfr" = "yes")
147
AC_HELP_STRING([--enable-nails],[use nails on limbs [[default=no]]]),
149
[yes|no|[0-9]|[0-9][0-9]]) ;;
150
*) AC_MSG_ERROR([bad value $enableval for --enable-nails, need yes/no/number]) ;;
154
case $enable_nails in
155
yes) GMP_NAIL_BITS=2 ;;
156
no) GMP_NAIL_BITS=0 ;;
157
*) GMP_NAIL_BITS=$enable_nails ;;
159
AC_SUBST(GMP_NAIL_BITS)
162
AC_ARG_ENABLE(profiling,
163
AC_HELP_STRING([--enable-profiling],
164
[build with profiler support [[default=no]]]),
167
*) AC_MSG_ERROR([bad value $enableval for --enable-profiling, need no/prof/gprof]) ;;
169
[enable_profiling=no])
171
case $enable_profiling in
173
AC_DEFINE(WANT_PROFILING_PROF, 1,
174
[Define to 1 if --enable-profiling=prof])
177
AC_DEFINE(WANT_PROFILING_GPROF, 1,
178
[Define to 1 if --enable-profiling=gprof])
182
GMP_DEFINE_RAW(["define(<WANT_PROFILING>,<\`$enable_profiling'>)"])
184
# -fomit-frame-pointer is incompatible with -pg, on x86s at least
185
if test "$enable_profiling" = gprof; then
188
fomit_frame_pointer="-fomit-frame-pointer"
192
AC_ARG_WITH(readline,
193
AC_HELP_STRING([--with-readline],
194
[readline support in calc demo program [[default=detect]]]),
197
*) AC_MSG_ERROR([bad value $withval for --with-readline, need yes/no/detect]) ;;
199
[with_readline=detect])
203
# Table of compilers, options, and mpn paths. This code has various related
206
# - better default CC/CFLAGS selections than autoconf otherwise gives
207
# - default CC/CFLAGS selections for extra CPU types specific to GMP
208
# - a few tests for known bad compilers
209
# - choice of ABIs on suitable systems
210
# - selection of corresponding mpn search path
212
# After GMP specific searches and tests, the standard autoconf AC_PROG_CC is
213
# called. User selections of CC etc are respected.
215
# Care is taken not to use macros like AC_TRY_COMPILE during the GMP
216
# pre-testing, since they of course depend on AC_PROG_CC, and also some of
217
# them cache their results, which is not wanted.
219
# The ABI selection mechanism is unique to GMP. All that reaches autoconf
220
# is a different selection of CC/CFLAGS according to the best ABI the system
221
# supports, and/or what the user selects. Naturally the mpn assembler code
222
# selected is very dependent on the ABI.
224
# The closest the standard tools come to a notion of ABI is something like
225
# "sparc64" which encodes a CPU and an ABI together. This doesn't seem to
226
# scale well for GMP, where exact CPU types like "ultrasparc2" are wanted,
227
# separate from the ABI used on them.
230
# The variables set here are
232
# cclist the compiler choices
233
# xx_cflags flags for compiler xx
234
# xx_cppflags cpp flags for compiler xx
235
# xx_cflags_optlist list of sets of optional flags
236
# xx_cflags_yyy set yyy of optional flags for compiler xx
237
# xx_ldflags -Wc,-foo flags for libtool linking with compiler xx
238
# ar_flags extra flags for $AR
239
# nm_flags extra flags for $NM
240
# limb limb size, can be "longlong"
241
# path mpn search path
242
# extra_functions extra mpn functions
244
# Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are
245
# tried, and the first flag that works will be used. An optlist like "arch
246
# cpu optimize" can be used to get multiple independent sets of flags tried.
247
# The first that works from each will be used. If no flag in a set works
248
# then nothing from that set is added.
250
# For multiple ABIs, the scheme extends as follows.
252
# abilist set of ABI choices
253
# cclist_aa compiler choices in ABI aa
254
# xx_aa_cflags flags for xx in ABI aa
255
# xx_aa_cppflags cpp flags for xx in ABI aa
256
# xx_aa_cflags_optlist list of sets of optional flags in ABI aa
257
# xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa
258
# xx_aa_ldflags -Wc,-foo flags for libtool linking
259
# ar_aa_flags extra flags for $AR in ABI aa
260
# nm_aa_flags extra flags for $NM in ABI aa
261
# limb_aa limb size in ABI aa, can be "longlong"
262
# path_aa mpn search path in ABI aa
263
# extra_functions_aa extra mpn functions in ABI aa
265
# As a convenience, the unadorned xx_cflags (etc) are used for the last ABI
266
# in ablist, if an xx_aa_cflags for that ABI isn't given. For example if
267
# abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but
268
# for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is
269
# defined. This makes it easy to add some 64-bit compilers and flags to an
270
# unadorned 32-bit set.
272
# limb=longlong (or limb_aa=longlong) applies to all compilers within that
273
# ABI. It won't work to have some needing long long and some not, since a
274
# single instantiated gmp.h will be used by both.
276
# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are
277
# also set here, with an ABI suffix.
281
# A table-driven approach like this to mapping cpu type to good compiler
282
# options is a bit of a maintenance burden, but there's not much uniformity
283
# between options specifications on different compilers. Some sort of
284
# separately updatable tool might be cute.
286
# The use of lots of variables like this, direct and indirect, tends to
287
# obscure when and how various things are done, but unfortunately it's
288
# pretty much the only way. If shell subroutines were portable then actual
289
# code like "if this .. do that" could be written, but attempting the same
290
# with full copies of GMP_PROG_CC_WORKS etc expanded at every point would
291
# hugely bloat the output.
294
AC_ARG_VAR(ABI, [desired ABI (for processors supporting more than one ABI)])
296
# abilist needs to be non-empty, "standard" is just a generic name here
299
# FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring
300
# c89 over cc here. But note that on HP-UX c89 provides a castrated
301
# environment, and would want to be excluded somehow. Maybe
302
# AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and
303
# we don't need to worry.
308
gcc_64_cflags="-g -O2"
312
SPEED_CYCLECOUNTER_OBJ=
315
AC_SUBST(HAVE_HOST_CPU_FAMILY_power, 0)
316
AC_SUBST(HAVE_HOST_CPU_FAMILY_powerpc,0)
327
alphaev5* | alphapca5*) path="alpha/ev5 alpha" ;;
328
alphaev6*) path="alpha/ev6 alpha/ev5 alpha" ;;
331
extra_functions="cntlz"
332
gcc_cflags_optlist="cpu asm"
334
# gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently.
335
# gcc 2.95 and 3.0 know ev4, ev5, ev56, pca56, ev6.
336
# gcc 3.1 pre-releases add ev67.
339
alpha) gcc_cflags_cpu="-mcpu=ev4" ;;
340
alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;;
341
alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;;
342
alphapca56 | alphapca57)
343
gcc_cflags_cpu="-mcpu=pca56" ;;
344
alphaev6) gcc_cflags_cpu="-mcpu=ev6" ;;
345
alphaev67 | alphaev68)
346
gcc_cflags_cpu="-mcpu=ev67 -mcpu=ev6" ;;
349
# On old versions of gcc, which don't know -mcpu=, we believe an
350
# explicit -Wa,-mev5 etc will be necessary to put the assembler in
351
# the right mode for our .asm files and longlong.h asm blocks.
353
# On newer versions of gcc, when -mcpu= is known, we must give a
354
# -Wa which is at least as high as the code gcc will generate,
355
# since the options ordering seems to make our setting override
356
# that passed by gcc.
358
# gas prior to 2.14 doesn't accept -mev67, but -mev6 seems enough for
359
# ctlz and cttz (in 2.10.0 at least).
361
# OSF `as' accepts ev68 but stupidly treats it as ev4. -arch only seems
362
# to affect insns like ldbu which are expanded as macros when necessary.
363
# Insns like ctlz which were never available as macros are always
364
# accepted and always generate their plain code.
367
alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;;
368
alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;;
369
alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;;
370
alphapca56 | alphapca57)
371
gcc_cflags_asm="-Wa,-arch,pca56 -Wa,-mpca56" ;;
372
alphaev6) gcc_cflags_asm="-Wa,-arch,ev6 -Wa,-mev6" ;;
373
alphaev67 | alphaev68)
374
gcc_cflags_asm="-Wa,-arch,ev67 -Wa,-mev67 -Wa,-arch,ev6 -Wa,-mev6" ;;
377
# It might be better to ask "cc" whether it's Cray C or DEC C,
378
# instead of relying on the OS part of $host. But it's hard to
379
# imagine either of those compilers anywhere except their native
384
cc_cflags="-O" # no -g, it silently disables all optimizations
385
GMP_INCLUDE_MPN(alpha/unicos.m4)
386
# Don't perform any assembly syntax tests on this beast.
387
gmp_asm_syntax_testing=no
390
GMP_INCLUDE_MPN(alpha/default.m4)
392
cc_cflags_optlist="opt cpu"
394
# not sure if -fast works on old versions, so make it optional
395
cc_cflags_opt="-fast -O2"
397
# DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6.
398
# Compaq C V6.3-029 adds ev67.
401
alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;;
402
alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;;
403
alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;;
404
alphapca56 | alphapca57)
405
cc_cflags_cpu="-arch~pca56~-tune~pca56" ;;
406
alphaev6) cc_cflags_cpu="-arch~ev6~-tune~ev6" ;;
407
alphaev67 | alphaev68)
408
cc_cflags_cpu="-arch~ev67~-tune~ev67 -arch~ev6~-tune~ev6" ;;
412
GMP_INCLUDE_MPN(alpha/default.m4)
418
# tune/alpha.asm assumes int==4bytes but unicos uses int==8bytes
421
SPEED_CYCLECOUNTER_OBJ=alpha.lo
422
cyclecounter_size=1 ;;
427
# Cray vector machines.
428
# This must come after alpha* so that we can recognize present and future
429
# vector processors with a wildcard.
431
gmp_asm_syntax_testing=no
433
# We used to have -hscalar0 here as a workaround for miscompilation of
434
# mpz/import.c, but let's hope Cray fixes their bugs instead, since
435
# -hscalar0 causes disastrously poor code to be generated.
436
cc_cflags="-O3 -hnofastmd -htask0 -Wa,-B"
443
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
444
gcc_testlist="gcc-arm-umodsi"
445
extra_functions="udiv"
446
GMP_INCLUDE_MPN(arm/arm-defs.m4)
456
[f30[01]-fujitsu-sysv*])
458
# FIXME: flags for vcc?
465
# HP cc is K&R by default, but AM_C_PROTOTYPES will add "-Ae", or "-Aa
466
# -D_HPUX_SOURCE", to put it into ansi mode, if possible.
470
gcc_cflags_optlist="arch"
471
gcc_cflags_arch="-mpa-risc-1-1"
472
cc_cflags="+DA1.1 +O2"
473
path="pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32"
474
extra_functions="udiv_qrnnd"
476
SPEED_CYCLECOUNTER_OBJ=hppa.lo
481
# override back to plain 1.0
487
path="pa32/hppa1_1 pa32"
493
# FIXME: It's suspected that an assembler feature test might be
494
# necessary before -mpa-risc-2-0 can be enabled, since it's not
495
# clear (as of gcc 2.95.2) whether that option always gives an
496
# explicit ".level 2.0" or whatever to the assembler. In any case,
497
# under gcc 2.95.2 it only enables a few extra floating point insns,
498
# so it's not very important.
500
# gmp_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
502
# FIXME: path should be "pa32/hppa2_0 pa32/hppa1_1 pa32"
503
path="pa32/hppa2_0 pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32"
505
# no gcc support for long long in 2.0n
507
# +O3 causes problems with fp rounding in mpfr/tests/tdiv.
508
cc_20n_cflags="+DA2.0 +e +O2"
509
cc_20n_testlist="hpc-hppa-2-0"
512
extra_functions_20n="umul_ppmm udiv_qrnnd"
513
SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo
514
cyclecounter_size_20n=2
516
# ABI=2.0w is available for hppa2.0w and hppa2.0, but not for hppa2.0n.
520
# HPUX 11 or up is required to run 2.0w. Not sure about other
521
# systems (GNU/Linux for instance), but lets assume they're ok.
523
[*-*-hpux1[1-9]*]) abilist="2.0w $abilist" ;;
525
*) abilist="2.0w $abilist" ;;
528
# gcc support for 2.0w is in progress
530
cc_20w_cflags="+DD64 +O2" # +O3 causes problems with fp rounding in mpfr/tests/tdiv.
531
cc_20w_testlist="hpc-hppa-2-0"
533
extra_functions_20w="umul_ppmm udiv_qrnnd"
534
SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo
535
cyclecounter_size_20w=2
550
GMP_INCLUDE_MPN(ia64/default.m4)
551
SPEED_CYCLECOUNTER_OBJ=ia64.lo
558
GMP_INCLUDE_MPN(m68k/m68k-defs.m4)
559
gcc_cflags="-g $fomit_frame_pointer"
560
gcc_cflags_optlist="optimize arch"
561
gcc_cflags_optimize="-O2" # munged below on gcc 2.95.x
563
# gcc 2.7.2 doesn't know -m68060 or -mcpu32, so let them fall back
565
# FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2.
568
m68020-*-*) gcc_cflags_arch="-m68020" ;;
569
m68030-*-*) gcc_cflags_arch="-m68030" ;;
570
m68040-*-*) gcc_cflags_arch="-m68040" ;;
571
m68060-*-*) gcc_cflags_arch="-m68060 -m68000" ;;
572
m68360-*-*) gcc_cflags_arch="-mcpu32 -m68000" ;;
573
*) gcc_cflags_arch="-m68000" ;;
576
# FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be
577
# tested. Will need to introduce an m68k/cpu32 if m68k/mc62020 ever uses
578
# the bitfield instructions.
580
[m680[234]0-*-* | m68360-*-*]) path="m68k/mc68020 m68k"
581
extra_functions="udiv umul" ;;
593
gcc_cflags="-g -O -m88110"
594
path="m88k/mc88110 m88k"
598
# National Semiconductor 32k
604
# IRIX 5 and earlier can only run 32-bit o32.
606
# IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64. n32 is
607
# preferred over 64, but only because that's been the default in past
608
# versions of GMP. The two are equally efficient.
610
# Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not
611
# supporting n32 or 64.
613
# FIXME: It's necessary to pass -mabi or -n32 to the compiler when
614
# linking. Libtool used to strip them, hence the ldflags here. It
615
# looks like it has something equivalent itself now, so perhaps
616
# these can be removed.
620
gcc_cflags_optlist="abi"
621
gcc_cflags_abi="-mabi=32"
622
gcc_testlist="gcc-mips-o32"
624
cc_cflags="-O2 -o32" # no -g, it disables all optimizations
625
extra_functions="umul"
626
# this suits both mips32 and mips64
627
GMP_INCLUDE_MPN(mips32/mips-defs.m4)
630
mips64*-*-* | mips*-*-irix[6789]*)
634
gcc_n32_cflags="-g -O2 -mabi=n32"
635
gcc_n32_ldflags="-Wc,-mabi=n32"
636
# Pass just -O1, MIPSpro 7.2.1 miscompiles mpn/generic/divrem_1.c
637
# cvs version 1.20, for -O2 and -O3
638
cc_n32_cflags="-O1 -n32" # no -g, it disables all optimizations
639
cc_n32_ldflags="-Wc,-n32"
642
extra_functions_n32="umul"
645
gcc_64_cflags="-g -O2 -mabi=64"
646
gcc_64_ldflags="-Wc,-mabi=64"
647
cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
648
cc_64_ldflags="-Wc,-64"
650
extra_functions_64="umul"
656
# Darwin (powerpc-apple-darwin1.3) has gcc installed as cc.
658
# The darwin assembler doesn't accept "-mppc", so gcc_cflags_asm is
659
# optional. The right flag would be "-arch ppc" or some such, but that's
660
# already the default.
662
# The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp
663
# since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h,
664
# and so always ends up running the plain preprocessor anyway. This could
665
# be done in CPPFLAGS rather than CFLAGS, but there's not many places
666
# preprocessing is done separately, and this is only a speedup, the normal
667
# preprocessor gets run if there's any problems.
670
AC_DEFINE(HAVE_HOST_CPU_FAMILY_powerpc)
671
HAVE_HOST_CPU_FAMILY_powerpc=1
674
gcc_cflags="-g -O2 -mpowerpc"
675
gcc_cflags_optlist="asm precomp cpu"
676
gcc_cflags_asm="-Wa,-mppc"
677
gcc_cflags_precomp="-no-cpp-precomp"
678
extra_functions="umul"
681
powerpc740 | powerpc750 | powerpc7400)
682
path="powerpc32/750 powerpc32" ;;
687
# gcc 2.7.2 knows -mcpu=403, 603, 604.
688
# gcc 2.95 adds 401, 505, 602, 603e, ec603e, 604e, 620, 740, 750,
689
# 801, 821, 823, 860.
690
# gcc 3.0 adds 630, rs64a.
691
# gcc 3.1 pre-releases add 405, 7400, 7450.
693
# FIXME: The way 603e falls back to 603 for gcc 2.7.2 should be
694
# done for all the others too. But what would be the correct
698
powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
699
powerpc403) gcc_cflags_cpu="-mcpu=403" ;;
700
powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
701
powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
702
powerpc602) gcc_cflags_cpu="-mcpu=602" ;;
703
powerpc603) gcc_cflags_cpu="-mcpu=603" ;;
704
powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;;
705
powerpc604) gcc_cflags_cpu="-mcpu=604" ;;
706
powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;;
707
powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
708
powerpc630) gcc_cflags_cpu="-mcpu=630" ;;
709
powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
710
powerpc7400) gcc_cflags_cpu="-mcpu=7400" ;;
711
powerpc7450) gcc_cflags_cpu="-mcpu=7450" ;;
712
powerpc750) gcc_cflags_cpu="-mcpu=750" ;;
713
powerpc801) gcc_cflags_cpu="-mcpu=801" ;;
714
powerpc821) gcc_cflags_cpu="-mcpu=821" ;;
715
powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
716
powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
722
xlc_cflags="-g -O2 -qmaxmem=20000"
723
xlc_cflags_optlist="arch"
725
# xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604,
727
# -qarch=ppc is needed, so ensure everything falls back to that.
728
# FIXME: Perhaps newer versions know more flavours.
731
powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
732
powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
733
powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
734
powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
735
powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
736
powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
737
*) xlc_cflags_arch="-qarch=ppc" ;;
744
# On AIX a true 64-bit ABI is available.
747
# Need -Wc to pass object type flags through to the linker.
749
cclist_aix64="gcc xlc"
750
gcc_aix64_cflags="-g -O2 -maix64 -mpowerpc64"
751
gcc_aix64_cflags_optlist="cpu"
752
gcc_aix64_ldflags="-Wc,-maix64"
753
xlc_aix64_cflags="-g -O2 -q64 -qtune=pwr3 -qmaxmem=20000"
754
xlc_aix64_ldflags="-Wc,-q64"
755
# Must indicate object type to ar and nm
756
ar_aix64_flags="-X64"
757
nm_aix64_flags="-X64"
758
path_aix64="powerpc64"
759
extra_functions_aix64="umul"
762
# On GNU/Linux, assume the processor is in 64-bit mode. Some
763
# environments have a gcc that is always in 64-bit mode, while
764
# others require -m64, hence the use of cflags_maybe. The
765
# sizeof-long-8 test checks the mode is right (for the no option
768
# -mpowerpc64 is not used, since it should be the default in
769
# 64-bit mode. (We need its effect for the various longlong.h
770
# asm macros to be right of course.)
772
# gcc64 was an early port of gcc to 64-bit mode, but should be
773
# obsolete before too long. We prefer plain gcc when it knows
776
abilist="64 $abilist"
777
cclist_64="gcc gcc64"
778
gcc_64_cflags_maybe="-m64"
780
gcc_64_cflags_optlist="cpu"
782
any_64_testlist="sizeof-long-8"
783
gmp_cv_asm_underscore=no # Kludge
792
[power-*-* | power[12]-*-* | power2sc-*-*])
793
AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
794
HAVE_HOST_CPU_FAMILY_power=1
796
extra_functions="udiv_w_sdiv"
799
gcc_cflags_optlist="cpu"
801
power-*-*) gcc_cflags_cpu="-mcpu=power -mpower" ;;
802
power1-*-*) gcc_cflags_cpu="-mcpu=rios1 -mpower" ;;
803
power2-*-*) gcc_cflags_cpu="-mcpu=rios2 -mpower" ;;
804
power2sc-*-*) gcc_cflags_cpu="-mcpu=rsc -mpower" ;;
809
xlc_cflags="-g -O2 -qarch=pwr -qmaxmem=20000"
815
# FIXME: ppc601 isn't accepted by config.sub.
817
path="power powerpc32"
826
# IBM s/370 and similar
828
gcc_cflags="-g -O2 $fomit_frame_pointer"
830
extra_functions="udiv_w_sdiv"
835
sh2-*-*) path="sh/sh2 sh" ;;
839
# For cc and acc, -g disables -O, so it's not used
843
gcc_cflags_optlist="cpu"
847
GMP_INCLUDE_MPN(sparc32/sparc-defs.m4)
849
# FIXME: This should be selected according to the CPU
850
if test x${floating_point} = xno
851
then extra_functions="udiv_nfp"
852
else extra_functions="udiv_fp"
856
sparcv8*-*-* | supersparc*-*-* | microsparc*-*-*)
857
gcc_cflags_cpu="-mcpu=v8 -mv8"
858
acc_cflags="-O2 -cg92"
859
path="sparc32/v8 sparc32"
860
extra_functions="udiv"
863
*-*-solaris2.*) cc_cflags="-xtarget=native -xarch=v8 -xO4" ;;
866
supersparc*-*-*) path="sparc32/v8/supersparc sparc32/v8 sparc32" ;;
870
# sparc64-*-linux-gnu is a misnomer, since there's no support for any
871
# 64-bit operations in user mode. We assume that a future release
872
# will have some 64-bit support and that the gcc options will be the
873
# same as on solaris.
875
# cc -xarch actually controls the ABI, hence it must be v8 for 32-bit,
876
# even though the chip is v9.
878
sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
879
path="sparc32/v9 sparc32/v8 sparc32"
880
extra_functions="udiv_fp"
882
SPEED_CYCLECOUNTER_OBJ=sparcv9.lo
884
gcc_cflags="-g -O2 -Wa,-xarch=v8plus"
885
gcc_cflags_cpu="-mcpu=ultrasparc -mcpu=v9 -mcpu=v8 -mv8"
887
# must have -xarch=v8plus here, to get the right assembler options
888
# for our mpn/sparc32/v9 code
889
cc_cflags="-xtarget=native -xarch=v8plus -xO4"
892
[*-*-solaris2.[7-9]])
893
# solaris prior to 2.6 doesn't save registers properly, so the
894
# 64-bit ABI is only available for 2.7 up
898
gcc_64_cflags="-g -O2 -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9"
899
gcc_64_ldflags="-Wc,-m64"
900
# -fast enables different optimizations depending compiler version
901
# -fns=no and -fsimple=1 disables some transformations that
902
# conflict with IEEE 754, which some compiler versions perform.
903
cc_64_cflags="-fast -fns=no -fsimple=1 -xarch=v9"
904
SPEED_CYCLECOUNTER_OBJ_64=sparcv9.lo
905
cyclecounter_size_64=2
908
# NetBSD and OpenBSD sparc64
923
# Currently (version 3.0) gcc on vax always uses a frame pointer
924
# (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
927
gcc_cflags="-g -O2 $fomit_frame_pointer"
929
extra_functions="udiv_w_sdiv"
933
# AMD and Intel x86 configurations
934
X86_PATTERN | x86_64-*-*)
935
AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86)
936
# Rumour has it gcc -O2 used to give worse register allocation than just
937
# -O, but lets assume that's no longer true.
938
gcc_cflags="-g -O2 $fomit_frame_pointer"
939
GMP_INCLUDE_MPN(x86/x86-defs.m4)
940
extra_functions="udiv umul"
941
CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo'
943
# Availability of rdtsc is checked at run-time.
944
SPEED_CYCLECOUNTER_OBJ=pentium.lo
946
# gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These
947
# represent -mcpu= since -m486 doesn't generate 486 specific insns. The
948
# -mcpu= and -march= options will fail, leaving just -m486.
950
# gcc 2.95.2 adds k6, pentium and pentiumpro, and allows -march= and
953
# gcc 3.0 adds athlon.
955
# gcc 3.1 adds pentium4.
957
# Defaults for anything not otherwise mentioned.
959
gcc_cflags_optlist="cpu arch"
960
gcc_cflags_cpu="-mcpu=i486 -m486"
961
gcc_cflags_arch="-march=i486"
965
# Because i386 means generic x86, -mcpu=i486 is used since that
966
# should better suit newer processors.
967
# FIXME: How would a user ask for an actual 80386? Currently only by
968
# using CFLAGS="-mcpu=386" or whatever.
969
gcc_cflags_cpu="-mcpu=i486 -m486"
970
gcc_cflags_arch="-march=i386"
972
i586*-*-* | pentium-*-* | pentiummmx-*-*)
973
gcc_cflags_cpu="-mcpu=pentium -m486"
974
gcc_cflags_arch="-march=pentium"
976
[i686*-*-* | pentiumpro-*-* | pentium[23]-*-*])
977
gcc_cflags_cpu="-mcpu=pentiumpro -mcpu=i486 -m486"
978
gcc_cflags_arch="-march=pentiumpro -march=pentium -march=i486"
981
gcc_cflags_cpu="-mcpu=k6 -mcpu=i486 -m486"
982
gcc_cflags_arch="-march=k6 -march=i486"
985
# Athlon instruction costs are close to P6 (3 cycle load latency,
986
# 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
987
# know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
988
gcc_cflags_cpu="-mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
989
gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium -march=i486"
991
pentium4-*-* | i786-*-*)
992
# pentium4 is known to gcc 3.1 and up, not sure what cpu choice
993
# would best suit previous versions, pentiumpro will get us cmov
994
# from gcc 2.95.4 up, otherwise let's just try i486.
995
gcc_cflags_cpu="-mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
996
gcc_cflags_arch="-march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium -march=i486"
999
# Not sure of the best fallbacks here for -mcpu.
1000
# c3-2 has sse and mmx, so pentium3 is good for -march.
1001
gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
1002
gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
1005
# Not sure of the best fallbacks here.
1006
gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
1007
gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
1010
gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
1011
gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
1016
i486*-*-*) path="x86/i486 x86" ;;
1017
i586*-*-* | pentium-*-*) path="x86/pentium x86" ;;
1018
pentiummmx-*-*) path="x86/pentium/mmx x86/pentium x86" ;;
1019
i686*-*-* | pentiumpro-*-*) path="x86/p6 x86" ;;
1020
pentium2-*-*) path="x86/p6/mmx x86/p6 x86" ;;
1021
pentium3-*-*) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
1022
[k6[23]*-*-*]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
1023
k6*-*-*) path="x86/k6/mmx x86/k6 x86" ;;
1024
# we don't have any specific 32-bit code for opteron (x86_64), the
1025
# athlon code should be reasonable
1026
athlon-*-* | x86_64-*-*) path="x86/k7/mmx x86/k7 x86" ;;
1027
i786-*-* | pentium4-*-*)
1028
path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
1029
# VIA/Centaur processors, sold as CyrixIII and C3.
1030
viac32-*-*) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
1031
viac3*-*-*) path="x86/pentium/mmx x86/pentium x86";;
1040
gcc_64_cflags="-O2 -m64"
1041
gcc_64_cflags_optlist="cpu"
1047
# FIXME: z8kx won't get through config.sub. Could make 16 versus 32 bit
1048
# limb an ABI option perhaps.
1051
extra_functions="udiv_w_sdiv"
1055
extra_functions="udiv_w_sdiv"
1059
# Special CPU "none" selects generic C. -DNO_ASM is used to disable gcc
1060
# asm blocks in longlong.h (since they're driven by cpp pre-defined
1061
# symbols like __alpha rather than the configured $host_cpu).
1064
abilist="long longlong"
1066
gcc_long_cflags=$gcc_cflags
1067
gcc_long_cppflags="-DNO_ASM"
1068
cc_long_cflags=$cc_cflags
1069
cclist_longlong=$cclist
1070
gcc_longlong_cflags=$gcc_cflags
1071
gcc_longlong_cppflags="-DNO_ASM"
1072
cc_longlong_cflags=$cc_cflags
1073
limb_longlong=longlong
1079
CFLAGS_or_unset=${CFLAGS-'(unset)'}
1080
CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'}
1082
cat >&AC_FD_CC <<EOF
1083
configure:__line__: User:
1086
CFLAGS=$CFLAGS_or_unset
1087
CPPFLAGS=$CPPFLAGS_or_unset
1089
configure:__line__: GMP:
1095
test_CFLAGS=${CFLAGS+set}
1096
test_CPPFLAGS=${CPPFLAGS+set}
1098
for abi in $abilist; do
1102
# If the user specifies an ABI then it must be in $abilist, after that
1103
# $abilist is restricted to just that choice.
1105
if test -n "$ABI"; then
1107
for abi in $abilist; do
1108
if test $abi = "$ABI"; then found=yes; break; fi
1110
if test $found = no; then
1111
AC_MSG_ERROR([ABI=$ABI is not among the following valid choices: $abilist])
1118
for abi in $abilist; do
1120
# Suppose abilist="64 32", then for abi=64, will have abi1="_64" and
1121
# abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how
1122
# $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the
1123
# abilist), but there's no fallback for $gcc_64_cflags.
1125
abi1=[`echo _$abi | sed 's/[.]//g'`]
1126
if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi
1128
# Compiler choices under this ABI
1129
eval cclist_chosen=\"\$cclist$abi1\"
1130
test -n "$cclist_chosen" || eval cclist_chosen=\"\$cclist$abi2\"
1132
# If there's a user specified $CC then don't use a list for
1133
# $cclist_chosen, just a single value for $ccbase.
1135
if test -n "$CC"; then
1137
# The first word of $CC, stripped of any directory. For instance
1138
# CC="/usr/local/bin/gcc -pipe" will give "gcc".
1140
for ccbase in $CC; do break; done
1141
ccbase=`echo $ccbase | sed 's:.*/::'`
1143
# If this $ccbase is in $cclist_chosen then it's a compiler we know and
1144
# we can do flags defaulting with it. If not, then $cclist_chosen is
1145
# set to "unrecognised" so no default flags are used.
1147
# "unrecognised" is used to avoid bad effects with eval if $ccbase has
1148
# non-symbol characters. For instance ccbase=my+cc would end up with
1149
# something like cflags="$my+cc_cflags" which would give
1150
# cflags="+cc_cflags" rather than the intended empty string for an
1154
for i in $cclist_chosen; do
1155
if test "$ccbase" = $i; then
1160
cclist_chosen=$found
1163
for ccbase in $cclist_chosen; do
1165
# When cross compiling, look for a compiler with the $host_alias as a
1166
# prefix, the same way that AC_CHECK_TOOL does. But don't do this to a
1167
# user-selected $CC.
1169
# $cross_compiling will be yes/no/maybe at this point. Do the host
1170
# prefixing for "maybe" as well as "yes".
1172
if test "$cross_compiling" != no && test -z "$CC"; then
1173
cross_compiling_prefix="${host_alias}-"
1176
for ccprefix in $cross_compiling_prefix ""; do
1179
test -n "$cc" || cc="$ccprefix$ccbase"
1181
# If the compiler is gcc but installed under another name, then change
1182
# $ccbase so as to use the flags we know for gcc. This helps for
1183
# instance when specifying CC=gcc272 on Debian GNU/Linux, or the
1184
# native cc which is really gcc on NeXT or MacOS-X.
1186
# FIXME: There's a slight misfeature here. If cc is actually gcc but
1187
# gcc is not a known compiler under this $abi then we'll end up
1188
# testing it with no flags and it'll work, but chances are it won't be
1189
# in the right mode for the ABI we desire. Let's quietly hope this
1192
if test $ccbase != gcc; then
1193
GMP_PROG_CC_IS_GNU($cc,ccbase=gcc)
1196
# Similarly if the compiler is IBM xlc but invoked as cc or whatever
1197
# then change $ccbase and make the default xlc flags available.
1198
if test $ccbase != xlc; then
1199
GMP_PROG_CC_IS_XLC($cc,ccbase=xlc)
1202
# Any user CFLAGS, even an empty string, takes precendence
1203
eval cflags=\"\$${ccbase}${abi1}_cflags\"
1204
test -n "$cflags" || eval cflags=\"\$${ccbase}${abi2}_cflags\"
1205
if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
1207
# Any user CPPFLAGS, even an empty string, takes precendence
1208
eval cppflags=\"\$${ccbase}${abi1}_cppflags\"
1209
test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\"
1210
if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
1212
# --enable-profiling adds -p/-pg even to user-specified CFLAGS.
1213
# This is convenient, but it's perhaps a bit naughty to modify user
1215
case "$enable_profiling" in
1216
prof) cflags="$cflags -p" ;;
1217
gprof) cflags="$cflags -pg" ;;
1220
GMP_PROG_CC_WORKS($cc $cflags $cppflags,,continue)
1222
# The tests to perform on this $cc, if any
1223
eval testlist=\"\$${ccbase}${abi1}_testlist\"
1224
test -n "$testlist" || eval testlist=\"\$${ccbase}${abi2}_testlist\"
1227
for tst in $testlist; do
1229
hpc-hppa-2-0) GMP_HPC_HPPA_2_0($cc,,testlist_pass=no) ;;
1230
gcc-arm-umodsi) GMP_GCC_ARM_UMODSI($cc,,testlist_pass=no) ;;
1231
gcc-mips-o32) GMP_GCC_MIPS_O32($cc,,testlist_pass=no) ;;
1233
if test $testlist_pass = no; then break; fi
1236
if test $testlist_pass = yes; then
1242
if test $found_compiler = yes; then break; fi
1245
if test $found_compiler = yes; then break; fi
1249
# If we recognised the CPU, as indicated by $path being set, then insist
1250
# that we have a working compiler, either from our $cclist choices or from
1251
# $CC. We can't let AC_PROG_CC look around for a compiler because it might
1252
# find one that we've rejected (for not supporting the modes our asm code
1255
# If we didn't recognise the CPU (and this includes host_cpu=none), then
1256
# fall through and let AC_PROG_CC look around for a compiler too. This is
1257
# mostly in the interests of following a standard autoconf setup, after all
1258
# we've already tested cc and gcc adequately (hopefully). As of autoconf
1259
# 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft
1260
# C on MS-DOS systems).
1262
if test $found_compiler = no && test -n "$path"; then
1263
AC_MSG_ERROR([could not find a working compiler])
1267
if test $found_compiler = yes; then
1269
# If we're creating CFLAGS, then look for optional additions. If the user
1270
# set CFLAGS then leave it alone.
1272
if test "$test_CFLAGS" != set; then
1273
eval optlist=\"\$${ccbase}${abi1}_cflags_optlist\"
1274
test -n "$optlist" || eval optlist=\"\$${ccbase}${abi2}_cflags_optlist\"
1276
for opt in $optlist; do
1277
eval optflags=\"\$${ccbase}${abi1}_cflags_${opt}\"
1278
test -n "$optflags" || eval optflags=\"\$${ccbase}${abi2}_cflags_${opt}\"
1279
test -n "$optflags" || eval optflags=\"\$${ccbase}_cflags_${opt}\"
1281
for flag in $optflags; do
1283
# ~ respresents a space in an option spec
1284
flag=`echo "$flag" | tr '~' ' '`
1288
# ease back to just -O on m68k gcc 2.95.x
1289
GMP_GCC_M68K_OPTIMIZE($ccbase,$cc,flag)
1292
# special check, avoiding a warning
1293
GMP_GCC_NO_CPP_PRECOMP($ccbase,$cc,$cflags,
1294
[cflags="$cflags $flag"
1301
GMP_GCC_WA_MCPU($cc $cflags, $flag, , [continue])
1307
GMP_PROG_CC_WORKS($cc $cflags $cppflags $flag,
1308
[cflags="$cflags $flag"
1317
CPPFLAGS="$cppflags"
1320
# Could easily have this in config.h too, if desired.
1321
ABI_nodots=`echo $ABI | sed 's/\./_/'`
1322
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST)
1325
# GMP_LDFLAGS substitution, selected according to ABI.
1326
# These are needed on libgmp.la and libmp.la, but currently not on
1327
# convenience libraries like tune/libspeed.la or mpz/libmpz.la.
1329
eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
1330
test -n "$GMP_LDFLAGS" || eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
1331
AC_SUBST(GMP_LDFLAGS)
1333
# extra_functions, selected according to ABI
1334
eval tmp=\"\$extra_functions$abi1\"
1335
test -n "$tmp" || eval tmp=\"\$extra_functions$abi2\"
1336
extra_functions="$tmp"
1339
# Cycle counter, selected according to ABI.
1341
eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi1\"
1342
test -n "$tmp" || eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi2\"
1343
SPEED_CYCLECOUNTER_OBJ="$tmp"
1344
eval tmp=\"\$cyclecounter_size$abi1\"
1345
test -n "$tmp" || eval tmp=\"\$cyclecounter_size$abi2\"
1346
cyclecounter_size="$tmp"
1348
if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
1349
AC_DEFINE_UNQUOTED(HAVE_SPEED_CYCLECOUNTER, $cyclecounter_size,
1350
[Tune directory speed_cyclecounter, undef=none, 1=32bits, 2=64bits)])
1352
AC_SUBST(SPEED_CYCLECOUNTER_OBJ)
1355
# Calling conventions checking, selected according to ABI.
1357
eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\"
1358
test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\"
1359
CALLING_CONVENTIONS_OBJS="$tmp"
1361
if test -n "$CALLING_CONVENTIONS_OBJS"; then
1362
AC_DEFINE(HAVE_CALLING_CONVENTIONS,1,
1363
[Define if tests/libtests has calling conventions checking for the CPU])
1365
AC_SUBST(CALLING_CONVENTIONS_OBJS)
1370
# If the user gave an MPN_PATH, use that verbatim, otherwise choose
1371
# according to the ABI and add "generic".
1373
if test -n "$MPN_PATH"; then
1376
eval tmp=\"\$path$abi1\"
1377
test -n "$tmp" || eval tmp=\"\$path$abi2\"
1382
# Whether using a long long limb in this ABI.
1383
eval limb_chosen=\"\$limb$abi1\"
1384
test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\"
1385
case $limb_chosen in
1386
longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;;
1387
*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
1389
AC_SUBST(DEFN_LONG_LONG_LIMB)
1392
# The C compiler and preprocessor, put into ANSI mode if possible.
1399
# The C++ compiler, if desired.
1401
if test $enable_cxx != no; then
1402
test_CXXFLAGS=${CXXFLAGS+set}
1405
echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC
1406
cxxflags_ac_prog_cxx=$CXXFLAGS
1407
cxxflags_list=ac_prog_cxx
1409
# If the user didn't specify $CXXFLAGS, then try $CFLAGS, with -g removed
1410
# if AC_PROG_CXX thinks that doesn't work. $CFLAGS stands a good chance
1411
# of working, eg. on a GNU system where CC=gcc and CXX=g++.
1413
if test "$test_CXXFLAGS" != set; then
1414
cxxflags_cflags=$CFLAGS
1415
cxxflags_list="cflags $cxxflags_list"
1416
if test "$ac_prog_cxx_g" = no; then
1417
cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'`
1421
# See if the C++ compiler works. If the user specified CXXFLAGS then all
1422
# we're doing is checking whether AC_PROG_CXX succeeded, since it doesn't
1423
# give a fatal error, just leaves CXX set to a default g++. If on the
1424
# other hand the user didn't specify CXXFLAGS then we get to try here our
1425
# $cxxflags_list alternatives.
1427
for cxxflags_choice in $cxxflags_list; do
1428
eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\"
1429
GMP_PROG_CXX_WORKS($CXX $CXXFLAGS,
1434
# If --enable-cxx=yes but a C++ compiler can't be found, then abort.
1435
if test $want_cxx = no && test $enable_cxx = yes; then
1436
AC_MSG_ERROR([C++ compiler not available])
1440
AM_CONDITIONAL(WANT_CXX, test $want_cxx = yes)
1442
# FIXME: We're not interested in CXXCPP for ourselves, but if we don't call
1443
# it here then AC_PROG_LIBTOOL (via _LT_AC_TAGCONFIG) will do so
1444
# unconditionally, and that will fail if there's no C++ compiler (and no
1445
# generic /lib/cpp).
1447
if test $want_cxx = yes; then
1457
[add_path="cray/ieee"],
1458
[add_path="cray/cfp"; extra_functions="mulwwc90"]) ;;
1460
extra_functions="mulwwj90"
1461
add_path="cray/cfp" ;;
1464
if test -z "$MPN_PATH"; then
1465
path="$add_path $path"
1468
# for a nail build, also look in "nails" subdirectories
1469
if test $GMP_NAIL_BITS != 0 && test -z "$MPN_PATH"; then
1473
generic) new_path="$new_path $i" ;;
1474
*) new_path="$new_path $i/nails $i" ;;
1481
cat >&AC_FD_CC <<EOF
1482
configure:__line__: Decided:
1487
GMP_LDFLAGS=$GMP_LDFLAGS
1492
echo "using ABI=\"$ABI\""
1494
echo " CFLAGS=\"$CFLAGS\""
1495
echo " CPPFLAGS=\"$CPPFLAGS\""
1496
if test $want_cxx = yes; then
1497
echo " CXX=\"$CXX\""
1498
echo " CXXFLAGS=\"$CXXFLAGS\""
1500
echo " MPN_PATH=\"$path\""
1503
# Automake ansi2knr support.
1510
# FIXME: On AIX 3 and 4, $libname.a is included in libtool
1511
# $library_names_spec, so libgmp.a becomes a symlink to libgmp.so, making
1512
# it impossible to build shared and static libraries simultaneously.
1513
# Disable shared libraries by default, but let the user override with
1514
# --enable-shared --disable-static.
1516
# FIXME: This $libname.a problem looks like it might apply to *-*-amigaos*
1517
# and *-*-os2* too, but wait for someone to test this before worrying
1518
# about it. If there is a problem then of course libtool is the right
1522
if test -z "$enable_shared"; then enable_shared=no; fi ;;
1524
# FIXME: Libtool recognises djgpp can't build shared libraries, but still
1525
# makes tests/.libs/libtests.al out of PIC objects, which then fail to
1526
# link into the test programs. Forcibly disable shared stuff until
1527
# libtool gets it right,
1532
# FIXME: On SCO 5, an explicit -lc is not wanted when making shared
1533
# libraries. Giving it makes strange things happen, like ctype.h macros
1534
# not working and profiler mcount calls segfaulting. Libtool ought to
1535
# know about this, but as of Dec 2000 it doesn't, so forcibly disable -lc
1536
# on relevant systems.
1539
lt_cv_archive_cmds_need_lc=no ;;
1541
# FIXME: Shared libraries aren't supported on unicos, but as of Dec 2000
1542
# libtool doesn't seem to detect this correctly, so forcibly disable them.
1547
# It seems there are no shared libs on ultrix, and it is not very important
1548
# to work on this. Just disable for now.
1553
# FIXME: AC_LIBTOOL_SYS_MAX_CMD_LEN has been reported to blow up in some
1554
# fashion on windows 9x (but not 2k), taking a very long time and
1555
# temporarily locking the whole PC. Clearly this is a libtool problem, but
1556
# for now force a sensible value to avoid the test.
1560
if test -z "$lt_cv_sys_max_cmd_len"; then
1561
lt_cv_sys_max_cmd_len=20000
1567
# Configs for Windows DLLs.
1569
AC_LIBTOOL_WIN32_DLL
1571
AC_SUBST(LIBGMP_DLL,0)
1573
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1574
# By default, build only static.
1575
if test -z "$enable_shared"; then
1578
# Don't allow both static and DLL.
1579
if test "$enable_shared" != no && test "$enable_static" != no; then
1580
AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
1581
Use "--disable-static --enable-shared" to build just a DLL.])
1583
if test "$enable_shared" = yes; then
1584
# libtool requires "-no-undefined", see AC_LIBTOOL_WIN32_DLL doco.
1585
GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined"
1591
# When cross compiling a DLL, libtool requires $HOST_CC, to compile impgen.c
1592
# on the build system. It's a well-known misfeature that libtool doesn't
1593
# hunt around for a useful HOST_CC on its own.
1594
# FIXME: Newer libtool looks like it'll need this only for "*-*-mingw* |
1595
# *-*-pw32*", not *-*-cygwin*.
1598
*-*-cygwin* | *-*-mingw* | *-*-pw32*)
1599
if test "$cross_compiling" != no && test "$enable_shared" != no; then
1606
# Ensure that $CONFIG_SHELL is available for AC_LIBTOOL_SYS_MAX_CMD_LEN.
1607
# It's often set already by _LT_AC_PROG_ECHO_BACKSLASH or
1608
# _AS_LINENO_PREPARE, but not always.
1610
# The symptom of CONFIG_SHELL unset is some "expr" errors during the test,
1611
# and an empty result. This only happens when invoked as "sh configure",
1612
# ie. no path, and can be seen for instance on ia64-*-hpux*.
1614
# FIXME: Newer libtool should have it's own fix for this.
1616
if test -z "$CONFIG_SHELL"; then
1620
# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on
1621
# mingw and cygwin. Under --disable-cxx this avoids some error messages
1622
# from libtool arising from the fact we didn't actually run AC_PROG_CXX.
1623
# Notice that any user-supplied --with-tags setting takes precedence.
1625
# FIXME: Is this the right way to get this effect? Very possibly not, but
1626
# the current _LT_AC_TAGCONFIG doesn't really suggest an alternative.
1628
if test "${with_tags+set}" != set; then
1629
if test $want_cxx = yes; then
1638
# Generate an error here if attempting to build both shared and static when
1639
# $libname.a is in $library_names_spec (as mentioned above), rather than
1640
# wait for ar or ld to fail.
1642
if test "$enable_shared" = yes && test "$enable_static" = yes; then
1643
case $library_names_spec in
1645
AC_MSG_ERROR([cannot create both shared and static libraries on this system, --disable one of the two])
1651
# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am.
1652
# Using the compiler is a lot easier than figuring out how to invoke the
1653
# assembler directly.
1655
test -n "$CCAS" || CCAS="$CC -c"
1659
X86_PATTERN | x86_64-*-*)
1660
# If there's any sse2 or mmx in the path, check whether the assembler
1661
# supports it, and remove if not.
1663
*mmx*) GMP_ASM_X86_MMX( , [GMP_STRIP_PATH(*mmx*)]) ;;
1666
*sse2*) GMP_ASM_X86_SSE2( , [GMP_STRIP_PATH(sse2)]) ;;
1672
# The library and header checks are mostly for the benefit of supplementary
1673
# programs. libgmp doesn't use anything too weird.
1678
# Reasons for testing:
1679
# sys/param.h - not in mingw
1680
# sys/processor.h - solaris specific, though also present in macos
1681
# sys/resource.h - not in mingw
1682
# sys/sysctl.h - not in mingw
1683
# sys/syssgi.h - IRIX specific
1684
# sys/systemcfg.h - AIX specific
1685
# sys/times.h - not in mingw
1687
# inttypes.h, stdint.h, unistd.h and sys/types.h are already in the autoconf
1690
AC_CHECK_HEADERS(fcntl.h locale.h sys/mman.h sys/param.h sys/processor.h sys/resource.h sys/sysctl.h sys/syssgi.h sys/systemcfg.h sys/time.h sys/times.h)
1692
# optarg should be in unistd.h, which is already in the default includes
1693
AC_CHECK_DECLS([fgetc, fscanf, optarg, ungetc, vfprintf])
1697
# the default includes are sufficient for all these types
1698
AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t])
1703
GMP_C_ATTRIBUTE_CONST
1704
GMP_C_ATTRIBUTE_MALLOC
1705
GMP_C_ATTRIBUTE_MODE
1706
GMP_C_ATTRIBUTE_NORETURN
1719
GMP_IMPL_H_IEEE_FLOATS
1721
# FIXME: Autoconf 2.52 AC_C_BIGENDIAN bombs when cross compiling, but in the
1722
# future the probes will be better and this override can be removed.
1723
if test "$cross_compiling" = yes; then
1724
ac_cv_c_bigendian=unknown
1727
# Enhancement: In the future AC_C_BIGENDIAN will accept these actions as
1729
case $ac_cv_c_bigendian in
1730
yes) AC_DEFINE(HAVE_LIMB_BIG_ENDIAN, 1) ;;
1731
no) AC_DEFINE(HAVE_LIMB_LITTLE_ENDIAN, 1) ;;
1733
*) AC_MSG_ERROR([Oops, unrecognised ac_cv_c_bigendian]) ;;
1735
AH_VERBATIM([HAVE_LIMB],
1736
[/* Define one (just one) of the following for the endiannes of `mp_limb_t'.
1737
If the endianness is not a simple big or little, or you don't know what
1738
it is, then leave both of these undefined. */
1739
#undef HAVE_LIMB_BIG_ENDIAN
1740
#undef HAVE_LIMB_LITTLE_ENDIAN])
1745
# On m68k NetBSD 1.4.1 getrusage() is doubtful. ru_utime looks microsecond
1746
# accurate but has been seen remaining unchanged after many microseconds
1747
# have elapsed. This upsets the tune and speed programs, so pretend it
1750
# FIXME: Would prefer tune/time.c to do a run-time test for this rather than
1751
# driving it from the system name.
1754
m68*-*-netbsd1.4*) ac_cv_func_getrusage=no ;;
1757
# Reasons for testing:
1758
# alarm - not in mingw
1759
# clock_gettime - not in glibc 2.2.4, only very recent systems
1760
# cputime - not in glibc
1761
# gettimeofday - not in mingw
1762
# mmap - not in mingw, djgpp
1763
# obstack_vprintf - glibc specific
1764
# processor_info - solaris specific
1765
# read_real_time - AIX specific
1766
# sigaction - not in mingw
1767
# sigaltstack - not in mingw, old AIX (reputedly)
1768
# sigstack - not in mingw
1769
# strnlen - glibc extension
1770
# syssgi - IRIX specific
1771
# times - not in mingw
1773
# clock_gettime is in librt on *-*-osf5.1. We could look for it
1774
# there, but that's not worth bothering with unless it has a decent
1775
# resolution (in a quick test clock_getres said only 1 millisecond).
1777
AC_CHECK_FUNCS(alarm clock clock_gettime cputime getpagesize getrusage gettimeofday localeconv memset mmap mprotect obstack_vprintf popen processor_info read_real_time sigaction sigaltstack sigstack syssgi strchr strnlen strtoul sysconf sysctl sysctlbyname times)
1779
# FIXME: Would have done this with an AM_CONDITIONAL, but automake 1.5
1780
# doesn't like that under libgmp_la_DEPENDENCIES.
1782
if test "$gmp_cv_func_vsnprintf" = no; then
1783
AC_SUBST(REPL_VSNPRINTF_PRINTF_OBJ, 'printf/repl-vsnprintf$U.lo')
1784
AC_SUBST(REPL_VSNPRINTF_OBJ, 'repl-vsnprintf$U.lo')
1787
GMP_FUNC_SSCANF_WRITABLE_INPUT
1790
# Pick the correct source files in $path and link them to mpn/.
1791
# $gmp_mpn_functions lists all functions we need.
1793
# The rule is to find a file with the function name and a .asm, .S,
1794
# .s, or .c extension. Certain multi-function files with special names
1795
# can provide some functions too. (mpn/Makefile.am passes
1796
# -DOPERATION_<func> to get them to generate the right code.)
1798
# FIXME: udiv and umul aren't in $gmp_mpn_functions_optional yet since
1799
# there's some versions of those files which should be checked for bit
1800
# rot first. Put them in $extra_functions for each host for now,
1801
# change to standard optionals when all are ready.
1803
# Note: The following lines defining $gmp_mpn_functions_optional
1804
# and $gmp_mpn_functions are parsed by the "macos/configure"
1805
# Perl script. So if you change the lines in a major way
1806
# make sure to run and examine the output from
1808
# % (cd macos; perl configure)
1810
# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former
1811
# can optionally provide the latter as an extra entrypoint. Likewise
1812
# divrem_1 and pre_divrem_1.
1814
gmp_mpn_functions_optional="copyi copyd com_n
1815
and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
1816
gcd_finda invert_limb sqr_diagonal \
1817
mul_2 mul_3 mul_4 addmul_2 addmul_3 addmul_4"
1819
gmp_mpn_functions="$extra_functions \
1820
add add_1 add_n sub sub_1 sub_n mul_1 addmul_1 \
1821
submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
1822
fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
1823
mul mul_fft mul_n mul_basecase sqr_basecase random random2 pow_1 \
1824
rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
1825
bdivmod gcd_1 gcd gcdext tdiv_qr dc_divrem_n sb_divrem_mn jacbase \
1826
$gmp_mpn_functions_optional"
1828
# the list of all object files used by mpn/Makefile.in and the
1829
# top-level Makefile.in, respectively
1831
mpn_objs_in_libgmp="mpn/mp_bases.lo"
1833
# links from the sources, to be removed by "make distclean"
1836
define(MPN_SUFFIXES,[asm S s c])
1838
for tmp_ext in MPN_SUFFIXES; do
1839
eval found_$tmp_ext=no
1842
for tmp_fn in $gmp_mpn_functions; do
1843
for tmp_ext in MPN_SUFFIXES; do
1844
test "$no_create" = yes || rm -f mpn/$tmp_fn.$tmp_ext
1847
# mpn_preinv_divrem_1 might have been provided by divrem_1.asm, likewise
1848
# mpn_preinv_mod_1 by mod_1.asm.
1851
if test "$HAVE_NATIVE_mpn_preinv_divrem_1" = yes; then continue; fi ;;
1853
if test "$HAVE_NATIVE_mpn_preinv_mod_1" = yes; then continue; fi ;;
1856
# functions that can be provided by multi-function files
1859
add_n|sub_n) tmp_mulfunc="aors_n" ;;
1860
addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
1861
popcount|hamdist) tmp_mulfunc="popham" ;;
1862
and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
1863
tmp_mulfunc="logops_n" ;;
1864
lshift|rshift) tmp_mulfunc="lorrshift";;
1868
for tmp_dir in $path; do
1869
for tmp_base in $tmp_fn $tmp_mulfunc; do
1870
for tmp_ext in MPN_SUFFIXES; do
1871
tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
1872
if test -f $tmp_file; then
1874
# For a nails build, check if the file supports our nail bits.
1875
# Generic code always supports all nails.
1877
# FIXME: When a multi-function file is selected to provide one of
1878
# the nails-neutral routines, like logops_n for and_n, the
1879
# PROLOGUE grepping will create HAVE_NATIVE_mpn_<foo> defines for
1880
# all functions in that file, even if they haven't all been
1881
# nailified. Not sure what to do about this, it's only really a
1882
# problem for logops_n, and it's not too terrible to insist those
1883
# get nailified alwasy.
1885
if test $GMP_NAIL_BITS != 0 && test $tmp_dir != generic; then
1887
and_n | ior_n | xor_n | \
1889
popcount | hamdist | \
1890
udiv | udiv_qrnnd | udiv_w_sdiv | udiv_fp | udiv_nfp | \
1891
umul | umul_ppmm | \
1892
cntlz | invert_limb)
1893
# these operations are either unaffected by nails or defined
1894
# to operate on full limbs
1897
nails=[`sed -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file `]
1901
n_start=`echo "$n" | sed -n 's/\(.*\)-.*/\1/p'`
1902
n_end=`echo "$n" | sed -n 's/.*-\(.*\)/\1/p'`
1909
if test $GMP_NAIL_BITS -ge $n_start && test $GMP_NAIL_BITS -le $n_end; then
1914
if test $found != yes; then
1922
eval found_$tmp_ext=yes
1924
if test $tmp_ext = c; then
1930
mpn_objects="$mpn_objects $tmp_fn$tmp_u.lo"
1931
mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/$tmp_fn$tmp_u.lo"
1932
AC_CONFIG_LINKS(mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext)
1933
gmp_srclinks="$gmp_srclinks mpn/$tmp_fn.$tmp_ext"
1935
# Duplicate AC_DEFINEs are harmless, so it doesn't matter
1936
# that multi-function files get grepped here repeatedly.
1937
# The PROLOGUE pattern excludes the optional second parameter.
1939
sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ;
1940
sed -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file
1942
for gmp_tmp in $gmp_ep; do
1943
AC_DEFINE_UNQUOTED(HAVE_NATIVE_$gmp_tmp)
1944
eval HAVE_NATIVE_$gmp_tmp=yes
1948
sqr_basecase) sqr_basecase_source=$tmp_file ;;
1954
if test $found = yes; then break ; fi
1956
if test $found = yes; then break ; fi
1959
if test $found = no; then
1960
for tmp_optional in $gmp_mpn_functions_optional; do
1961
if test $tmp_optional = $tmp_fn; then
1965
if test $found = no; then
1966
AC_MSG_ERROR([no version of $tmp_fn found in path: $path])
1971
# All cycle counters are .asm files currently
1972
if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
1977
# Don't demand an m4 unless it's actually needed.
1978
if test $found_asm = yes; then
1980
GMP_M4_M4WRAP_SPURIOUS
1985
# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
1986
if test $found_asm = no && test $found_S = no; then
1987
gmp_asm_syntax_testing=no
1990
if test "$gmp_asm_syntax_testing" != no; then
1993
GMP_ASM_LABEL_SUFFIX
2006
GMP_ASM_M68K_INSTRUCTION
2007
GMP_ASM_M68K_ADDRESSING
2008
GMP_ASM_M68K_BRANCHES
2011
GMP_ASM_POWERPC_R_REGISTERS
2012
GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
2016
64 | aix64) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;;
2017
*) GMP_INCLUDE_MPN(powerpc32/aix.m4) ;;
2022
64) GMP_INCLUDE_MPN(powerpc64/linux64.m4) ;;
2028
GMP_INCLUDE_MPN(powerpc32/aix.m4)
2030
sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
2033
GMP_ASM_SPARC_REGISTER
2037
X86_PATTERN | x86_64-*-*)
2038
GMP_ASM_ALIGN_FILL_0x90
2039
GMP_ASM_X86_SHLDL_CL
2040
if test "$enable_profiling" != no; then
2045
GMP_DEFINE(_GLOBAL_OFFSET_TABLE_,__GLOBAL_OFFSET_TABLE_)
2053
# Create link for gmp-mparam.h.
2055
for gmp_mparam_dir in $path; do
2056
test "$no_create" = yes || rm -f gmp-mparam.h
2057
tmp_file=$srcdir/mpn/$gmp_mparam_dir/gmp-mparam.h
2058
if test -f $tmp_file; then
2059
AC_CONFIG_LINKS(gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h)
2060
gmp_srclinks="$gmp_srclinks gmp-mparam.h"
2061
gmp_mparam_source=$tmp_file
2065
if test -z "$gmp_mparam_source"; then
2066
AC_MSG_ERROR([no version of gmp-mparam.h found in path: $path])
2069
# For a helpful message from tune/tuneup.c
2070
gmp_mparam_suggest=$gmp_mparam_source
2071
if test "$gmp_mparam_dir" = generic; then
2072
for i in $path; do break; done
2073
if test "$i" != generic; then
2074
gmp_mparam_suggest="new file $srcdir/mpn/$i/gmp-mparam.h"
2077
AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source",
2078
[The gmp-mparam.h to update when tuning.])
2081
# Copy any SQR_KARATSUBA_THRESHOLD from gmp-mparam.h to config.m4.
2082
# Some versions of sqr_basecase.asm use this.
2083
tmp_gmp_karatsuba_sqr_threshold=`sed -n 's/^#define SQR_KARATSUBA_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
2084
if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then
2085
GMP_DEFINE_RAW(["define(<SQR_KARATSUBA_THRESHOLD>,<$tmp_gmp_karatsuba_sqr_threshold>)"])
2088
# This must come after gmp-mparam.h has been chosen.
2091
GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$BITS_PER_MP_LIMB)"])
2092
GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"])
2093
GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"])
2096
# Exclude the mpn random functions from mpbsd since that would drag in the
2097
# top-level rand things, all of which are unnecessary for libmp. There's
2098
# other unnecessary objects too actually, if we could be bothered figuring
2099
# out exactly which they are.
2102
for i in $mpn_objs_in_libgmp; do
2105
*) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;;
2108
AC_SUBST(mpn_objs_in_libmp)
2110
AC_SUBST(mpn_objects)
2111
AC_SUBST(mpn_objs_in_libgmp)
2112
AC_SUBST(gmp_srclinks)
2117
if test $enable_mpfr = yes; then
2124
AC_SUBST(MPFR_CFLAGS,$CFLAGS)
2125
AC_SUBST(MPFR_LIBS, $LIBS)
2131
# A recompiled sqr_basecase for use in the tune program, if necessary.
2133
test -d tune || mkdir tune
2134
case $sqr_basecase_source in
2136
sqr_max=[`sed -n 's/^def...(SQR_KARATSUBA_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`]
2137
if test -n "$sqr_max"; then
2138
TUNE_SQR_OBJ=sqr_asm.o
2139
AC_DEFINE_UNQUOTED(TUNE_SQR_KARATSUBA_MAX,$sqr_max,
2140
[Maximum size the tune program can test for SQR_KARATSUBA_THRESHOLD])
2142
cat >tune/sqr_basecase.c <<EOF
2143
/* not sure that an empty file can compile, so put in a dummy */
2144
int sqr_basecase_dummy;
2149
AC_DEFINE(TUNE_SQR_KARATSUBA_MAX,SQR_KARATSUBA_MAX_GENERIC)
2150
cat >tune/sqr_basecase.c <<EOF
2151
#define TUNE_PROGRAM_BUILD 1
2152
#define TUNE_PROGRAM_BUILD_SQR 1
2153
#include "mpn/sqr_basecase.c"
2157
AC_SUBST(TUNE_SQR_OBJ)
2160
# Configs for demos/pexpr.c.
2162
AC_CONFIG_FILES(demos/pexpr-config.h:demos/pexpr-config-h.in)
2163
GMP_SUBST_CHECK_FUNCS(clock, cputime, getrusage, gettimeofday, sigaction, sigaltstack, sigstack)
2164
GMP_SUBST_CHECK_HEADERS(sys/resource.h)
2165
AC_CHECK_TYPES([stack_t], HAVE_STACK_T_01=1, HAVE_STACK_T_01=0,
2166
[#include <signal.h>])
2167
AC_SUBST(HAVE_STACK_T_01)
2169
# Configs for demos/calc directory
2171
# AC_SUBST is used here since with AM_CONFIG_HEADER automake would put
2172
# demos/calc in the default $(DEFAULT_INCLUDES) for every directory,
2173
# which would look very strange. Likewise demos/expr below.
2175
AC_CONFIG_FILES(demos/calc/calc-config.h:demos/calc/calc-config-h.in)
2176
use_readline=$with_readline
2177
if test $with_readline = detect; then
2178
AC_CHECK_LIB(readline, readline, use_readline=yes)
2180
if test $use_readline = yes; then
2181
AC_SUBST(WITH_READLINE_01, 1)
2182
AC_SUBST(LIBREADLINE, -lreadline)
2189
# Configs for demos/expr directory
2190
AC_CONFIG_FILES(demos/expr/expr-config.h:demos/expr/expr-config-h.in)
2191
if test $enable_mpfr = yes; then
2192
AC_SUBST(HAVE_MPFR_01, 1)
2196
if test $ac_cv_have_decl_optarg = yes; then
2197
AC_SUBST(HAVE_DECL_OPTARG, 1)
2207
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
2208
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
2210
AC_OUTPUT(Makefile \
2211
mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile \
2212
mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile \
2213
tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile \
2214
tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \
2215
tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \
2216
tests/cxx/Makefile \
2217
mpfr/Makefile mpfr/tests/Makefile \
2219
demos/Makefile demos/calc/Makefile demos/expr/Makefile \
2220
gmp.h:gmp-h.in mp.h:mp-h.in)