1
dnl Process this file with autoconf to produce a configure script.
4
# Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
6
# This file is part of the GNU MP Library.
8
# The GNU MP Library is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU Lesser General Public License as published
10
# by the Free Software Foundation; either version 2.1 of the License, or (at
11
# your option) any later version.
13
# The GNU MP Library is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16
# License for more details.
18
# You should have received a copy of the GNU Lesser General Public License
19
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24
AC_REVISION($Revision: 1.2 $)
27
m4_pattern_forbid([^[ \t]*GMP_])
28
m4_pattern_allow(GMP_LDFLAGS)
30
# If --target is not used then $target_alias is empty, but if say
31
# "./configure athlon-pc-freebsd3.5" is used, then all three of
32
# $build_alias, $host_alias and $target_alias are set to
33
# "athlon-pc-freebsd3.5".
35
if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then
36
AC_MSG_ERROR([--target is not appropriate for GMP
37
Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
38
explicitly. Use --host if cross-compiling (see "Installing GMP" in the
39
manual for more on this).])
45
tmp_host=`echo $host_cpu | sed 's/\./_/'`
46
AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
47
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST)
49
AM_INIT_AUTOMAKE(gmp, GMP_VERSION)
50
AM_CONFIG_HEADER(config.h:config.in)
55
AC_HELP_STRING([--enable-assert],[enable ASSERT checking [default=no]]),
58
*) AC_MSG_ERROR([bad value $enableval for --enable-assert, need yes or no]) ;;
62
if test "$enable_assert" = "yes"; then
63
AC_DEFINE(WANT_ASSERT,1,
64
[./configure --enable-assert option, to enable some ASSERT()s])
69
AC_HELP_STRING([--enable-alloca],[how to get temp memory [default=reentrant]]),
71
alloca|malloc-reentrant|malloc-notreentrant) ;;
72
yes|no|reentrant|notreentrant) ;;
75
AC_MSG_ERROR([bad value $enableval for --enable-alloca, need one of:
76
yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug]) ;;
78
[enable_alloca=reentrant])
81
# IMPROVE ME: The default for C++ is disabled. The tests currently
82
# performed below for a working C++ compiler are not particularly strong,
83
# and in general can't be expected to get the right setup on their own. The
84
# most significant problem is getting the ABI the same. Defaulting CXXFLAGS
85
# to CFLAGS takes only a small step towards this. It's also probably worth
86
# worrying whether the C and C++ runtimes from say gcc and a vendor C++ can
87
# work together. Some rather broken C++ installations were encountered
88
# during testing, and though such things clearly aren't GMP's problem, if
89
# --enable-cxx=detect were to be the default then some careful checks of
90
# which, if any, C++ compiler on the system is up to scratch would be
94
AC_HELP_STRING([--enable-cxx],[enable C++ support [default=detect]]),
97
*) AC_MSG_ERROR([bad value $enableval for --enable-cxx, need yes/no/detect]) ;;
103
AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [default=yes]]),
106
*) AC_MSG_ERROR([bad value $enableval for --enable-fft, need yes or no]) ;;
110
if test "$enable_fft" = "yes"; then
111
AC_DEFINE(WANT_FFT,1,
112
[./configure --enable-fft option, to enable FFTs for multiplication])
117
AC_HELP_STRING([--enable-mpbsd],
118
[build Berkley MP compatibility library [default=no]]),
121
*) AC_MSG_ERROR([bad value $enableval for --enable-mpbsd, need yes or no]) ;;
124
AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes")
128
AC_HELP_STRING([--enable-mpfr],[build MPFR [default=no]]),
131
*) AC_MSG_ERROR([bad value $enableval for --enable-mpfr, need yes or no]) ;;
134
AM_CONDITIONAL(WANT_MPFR, test "$enable_mpfr" = "yes")
137
AC_ARG_ENABLE(profiling,
138
AC_HELP_STRING([--enable-profiling],
139
[build with profiler support [default=no]]),
142
*) AC_MSG_ERROR([bad value $enableval for --enable-profiling, need no/prof/gprof]) ;;
144
[enable_profiling=no])
146
GMP_DEFINE_RAW(["define(<WANT_PROFILING>,<\`$enable_profiling'>)"])
148
# -fomit-frame-pointer is incompatible with -pg, on x86s at least
149
if test "$enable_profiling" = gprof; then
152
fomit_frame_pointer="-fomit-frame-pointer"
157
# Table of compilers, options, and mpn paths. This code has a couple of
160
# - better default CC/CFLAGS selections than autoconf otherwise gives
161
# - default CC/CFLAGS selections for extra CPU types specific to GMP
162
# - a few tests for known bad compilers
163
# - choice of ABIs on suitable systems
164
# - selection of corresponding mpn search path
166
# After GMP specific searches and tests, the standard autoconf AC_PROG_CC is
167
# called. User selections of CC etc are respected.
169
# Care is taken not to use macros like AC_TRY_COMPILE during the GMP
170
# pre-testing, since they of course depend on AC_PROG_CC, and also some of
171
# them cache their results, which is not wanted.
173
# The ABI selection mechanism is unique to GMP. All that reaches autoconf
174
# is a different selection of CC/CFLAGS according to the best ABI the system
175
# supports, and/or what the user selects. Naturally the mpn assembler code
176
# selected is very dependent on the ABI.
178
# The closest the standard tools come to a notion of ABI is something like
179
# "sparc64" which encodes a CPU and an ABI together. This doesn't seem to
180
# scale well for GMP, where exact CPU types like "ultrasparc2" are wanted,
181
# separate from the ABI used on them.
184
# The variables set here are
186
# cclist the compiler choices
187
# xx_cflags flags for compiler xx
188
# xx_cppflags cpp flags for compiler xx
189
# xx_cflags_optlist list of sets of optional flags
190
# xx_cflags_yyy set yyy of optional flags for compiler xx
191
# xx_ldflags -Wc,-foo flags for libtool linking with compiler xx
192
# ar_flags extra flags for $AR
193
# nm_flags extra flags for $NM
194
# limb limb size, can be "longlong"
195
# path mpn search path
196
# extra_functions extra mpn functions
198
# Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are
199
# tried, and the first flag that works will be used. An optlist like "arch
200
# cpu optimize" can be used to get multiple independent sets of flags tried.
201
# The first that works from each will be used. If no flag in a set works
202
# then nothing from that set is added.
204
# For multiple ABIs, the scheme extends as follows.
206
# abilist set of ABI choices
207
# cclist_aa compiler choices in ABI aa
208
# xx_aa_cflags flags for xx in ABI aa
209
# xx_aa_cppflags cpp flags for xx in ABI aa
210
# xx_aa_cflags_optlist list of sets of optional flags in ABI aa
211
# xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa
212
# xx_aa_ldflags -Wc,-foo flags for libtool linking
213
# ar_aa_flags extra flags for $AR in ABI aa
214
# nm_aa_flags extra flags for $NM in ABI aa
215
# limb_aa limb size in ABI aa, can be "longlong"
216
# path_aa mpn search path in ABI aa
217
# extra_functions_aa extra mpn functions in ABI aa
219
# As a convenience, the unadorned xx_cflags (etc) are used for the last ABI
220
# in ablist, if an xx_aa_cflags for that ABI isn't given. For example if
221
# abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but
222
# for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is
223
# defined. This makes it easy to add some 64-bit compilers and flags to an
224
# unadorned 32-bit set.
226
# limb=longlong (or limb_aa=longlong) applies to all compilers within that
227
# ABI. It won't work to have some needing long long and some not, since a
228
# single instantiated gmp.h will be used by both.
230
# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are
231
# also set here, with an ABI suffix.
234
AC_ARG_VAR(ABI,[intended ABI (for processors supporting more than one ABI)])
236
# abilist needs to be non-empty, "standard" is just a generic name here
239
# FIXME: Prefer c89 to cc.
243
gcc_64_cflags="-g -O2"
247
SPEED_CYCLECOUNTER_OBJ=
250
AC_SUBST(__GMP_HAVE_HOST_CPU_FAMILY_power, 0)
251
AC_SUBST(__GMP_HAVE_HOST_CPU_FAMILY_powerpc,0)
262
extra_functions="cntlz"
264
alphaev5*-*-* | alphapca56*-*-*) path="alpha/ev5 alpha" ;;
265
alphaev6*-*-*) path="alpha/ev6 alpha/ev5 alpha" ;;
268
SPEED_CYCLECOUNTER_OBJ=alpha.lo
271
flavour=`echo $host_cpu | sed 's/^alpha//g'`
273
# compilers don't seem to understand `ev67' and such.
274
ev6? | ev7*) flavour=ev6 ;;
279
# FIXME: Maybe a feature test should find out whether -Wa,arch is
281
if test -n "$flavour"; then
282
gcc_cflags_optlist="cpu arch"
283
gcc_cflags_cpu="-march=$flavour"
284
gcc_cflags_arch="-Wa,-arch,$flavour -Wa,-m$flavour"
289
# FIXME: Is GCC available for these systems? Hopefully it doesn't
290
# hurt to check for it anyway.
291
cc_cflags="-O" # no -g, it silently disables all optimizations
292
GMP_INCLUDE_MPN(alpha/unicos.m4)
293
# Don't perform any assembly syntax tests on this beast.
294
gmp_asm_syntax_testing=no
295
# tune/alpha.asm assumes int==4bytes but unicos uses int=8bytes
296
SPEED_CYCLECOUNTER_OBJ=
299
cc_cflags_optlist="cpu"
300
cc_cflags="-arch $flavour -tune $flavour"
301
GMP_INCLUDE_MPN(alpha/default.m4)
304
GMP_INCLUDE_MPN(alpha/default.m4)
310
# Cray vector machines.
311
# This must come after alpha* so that we can recognize present and future
312
# vector processors with a wildcard.
314
gmp_asm_syntax_testing=no
316
cc_cflags="-O3 -htask0 -Wa,-B"
323
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
324
gcc_testlist="gcc-arm-umodsi"
325
extra_functions="udiv"
326
GMP_INCLUDE_MPN(arm/arm-defs.m4)
336
[f30[01]-fujitsu-sysv*])
338
# FIXME: flags for vcc?
345
# HP cc is K&R by default, but AM_C_PROTOTYPES will add "-Ae", or "-Aa
346
# -D_HPUX_SOURCE", to put it into ansi mode, if possible.
350
gcc_cflags_optlist="arch"
351
gcc_cflags_arch="-mpa-risc-1-1"
352
cc_cflags="+DA1.1 +O2"
353
path="hppa/hppa1_1/pa7100 hppa/hppa1_1 hppa"
354
extra_functions="udiv_qrnnd"
356
SPEED_CYCLECOUNTER_OBJ=hppa.lo
361
# override back to plain 1.0
367
path="hppa/hppa1_1 hppa"
373
# FIXME: It's suspected that an assembler feature test might be
374
# necessary before -mpa-risc-2-0 can be enabled, since it's not
375
# clear (as of gcc 2.95.2) whether that option always gives an
376
# explicit ".level 2.0" or whatever to the assembler. In any case,
377
# under gcc 2.95.2 it only enables a few extra floating point insns,
378
# so it's not very important.
380
# gmp_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
382
# FIXME: path should be "hppa/hppa2_0 hppa/hppa1_1 hppa"
383
path="hppa/hppa2_0 hppa/hppa1_1/pa7100 hppa/hppa1_1 hppa"
385
# no gcc support for long long in 2.0n
387
# +O2 to cc triggers bug in mpz/powm.c (cvs version 1.4)
388
cc_20n_cflags="+DA2.0 +e +O3"
389
cc_20n_testlist="hpc-hppa-2-0"
392
extra_functions_20n="umul_ppmm udiv_qrnnd"
393
SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo
394
cyclecounter_size_20n=2
396
# ABI=2.0w is available for hppa2.0w and hppa2.0, but not for hppa2.0n.
400
# HPUX 11 or up is required to run 2.0w. Not sure about other
401
# systems (GNU/Linux for instance), but lets assume they're ok.
403
[*-*-hpux1[1-9]*]) abilist="2.0w $abilist" ;;
405
*) abilist="2.0w $abilist" ;;
408
# gcc support for 2.0w is in progress
410
cc_20w_cflags="+DD64 +O3"
411
cc_20w_testlist="hpc-hppa-2-0"
413
extra_functions_20w="umul_ppmm udiv_qrnnd"
414
SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo
415
cyclecounter_size_20w=2
430
GMP_INCLUDE_MPN(ia64/default.m4)
431
SPEED_CYCLECOUNTER_OBJ=ia64.lo
438
GMP_INCLUDE_MPN(m68k/m68k-defs.m4)
439
gcc_cflags="-g $fomit_frame_pointer"
440
gcc_cflags_optlist="optimize arch"
441
gcc_cflags_optimize="-O2" # munged below on gcc 2.95.x
443
# gcc 2.7.2 doesn't know -m68060 or -mcpu32, so let them fall back
445
# FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2.
448
m68020-*-*) gcc_cflags_arch="-m68020" ;;
449
m68030-*-*) gcc_cflags_arch="-m68030" ;;
450
m68040-*-*) gcc_cflags_arch="-m68040" ;;
451
m68060-*-*) gcc_cflags_arch="-m68060 -m68040" ;;
452
m68360-*-*) gcc_cflags_arch="-mcpu32 -m68000" ;;
453
*) gcc_cflags_arch="-m68000" ;;
456
# FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be
457
# tested. Will need to introduce an m68k/cpu32 if m68k/mc62020 ever uses
458
# the bitfield instructions.
460
[m680[2346]0-*-* | m68360-*-*]) path="m68k/mc68020 m68k"
461
extra_functions="udiv umul" ;;
473
gcc_cflags="-g -O -m88110"
474
path="m88k/mc88110 m88k"
478
# National Semiconductor 32k
484
# IRIX 5 and earlier can only run 32-bit o32.
486
# IRIX 6 and up can run n32 or 64, and GMP uses a 64-bit limb on both. It
487
# could run the mips2 code in n32 with a 32-bit limb, which we could
488
# perhaps call 32, but since that would just create a slower library, we
489
# don't give that option.
491
# Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not
492
# supporting n32 or 64.
494
# We here use ldflags for passing options with libtool to the compiler
495
# when generating the shared library.
497
[mips*-*-irix[6789]*])
500
# let the $found_compiler test below know that the cpu is recognised
504
gcc_n32_cflags="-g -O2 -mabi=n32"
505
gcc_n32_ldflags="-Wc,-mabi=n32"
506
cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
507
cc_n32_ldflags="-Wc,-n32"
512
gcc_64_cflags="-g -O2 -mabi=64"
513
gcc_64_ldflags="-Wc,-mabi=64"
514
cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
515
cc_64_ldflags="-Wc,-64"
518
GMP_INCLUDE_MPN(mips3/mips.m4)
526
# Darwin (powerpc-apple-darwin1.3) has gcc installed as cc.
528
# The darwin assembler doesn't accept "-mppc", so gcc_cflags_asm is
529
# optional. The right flag would be "-arch ppc" or some such, but that's
530
# already the default.
532
# The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp
533
# since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h,
534
# and so always ends up running the plain preprocessor anyway. This could
535
# be done in CPPFLAGS rather than CFLAGS, but there's not many places
536
# preprocessing is done separately, and this is only a speedup, the normal
537
# preprocessor gets run if there's any problems.
540
AC_DEFINE(HAVE_HOST_CPU_FAMILY_powerpc)
541
__GMP_HAVE_HOST_CPU_FAMILY_powerpc=1
544
gcc_cflags="-g -O2 -mpowerpc"
545
gcc_cflags_optlist="asm precomp"
546
gcc_cflags_asm="-Wa,-mppc"
547
gcc_cflags_precomp="-no-cpp-precomp"
549
extra_functions="umul"
551
*-*-aix*) cclist="gcc xlc cc"
552
xlc_cflags="-g -O2 -qarch=ppc -qmaxmem=20000" ;;
557
# CPU type powerpc64 forces to a 64-bit limb
559
powerpc64-*-*) abilist="32L" ;;
560
*) abilist="32L 32" ;;
563
gcc_32L_cflags="-g -O2 -mpowerpc64"
567
# On AIX a true 64-bit ABI is available.
570
# Need -Wc to pass object type flags through to the linker.
571
abilist="aix64 $abilist"
572
cclist_aix64="gcc xlc"
573
gcc_aix64_cflags="-g -O2 -maix64 -mpowerpc64"
574
gcc_aix64_ldflags="-Wc,-maix64"
575
xlc_aix64_cflags="-g -O2 -q64 -qtune=pwr3 -qmaxmem=20000"
576
xlc_aix64_ldflags="-Wc,-q64"
577
# Must indicate object type to ar and nm
578
ar_aix64_flags="-X64"
579
nm_aix64_flags="-X64"
580
path_aix64="powerpc64"
589
[power-*-* | power[12]-*-* | power2sc-*-*])
590
AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
591
__GMP_HAVE_HOST_CPU_FAMILY_power=1
593
extra_functions="udiv_w_sdiv"
596
gcc_cflags_optlist="cpu"
598
power-*-*) gcc_cflags_cpu="-march=power -mpower" ;;
599
power1-*-*) gcc_cflags_cpu="-march=rios1 -mpower" ;;
600
power2-*-*) gcc_cflags_cpu="-march=rios2 -mpower" ;;
601
power2sc-*-*) gcc_cflags_cpu="-march=rsc -mpower" ;;
606
xlc_cflags="-g -O2 -qarch=pwr -qmaxmem=20000"
612
# FIXME: ppc601 isn't accepted by config.sub.
614
path="power powerpc32"
623
# IBM s/370 and similar
625
gcc_cflags="-g -O2 $fomit_frame_pointer"
627
extra_functions="udiv_w_sdiv"
632
sh2-*-*) path="sh/sh2 sh" ;;
636
# For cc and acc, -g disables -O, so it's not used
640
gcc_cflags_optlist="cpu"
645
# FIXME: This should be selected according to the CPU
646
if test x${floating_point} = xno
647
then extra_functions="udiv_nfp"
648
else extra_functions="udiv_fp"
652
sparcv8*-*-* | supersparc*-*-* | microsparc*-*-*)
653
gcc_cflags_cpu="-march=v8 -mv8"
654
acc_cflags="-O2 -cg92"
655
path="sparc32/v8 sparc32"
658
*-*-solaris2.*) cc_cflags="-xtarget=native -xarch=v8 -xO4" ;;
661
supersparc*-*-*) path="sparc32/v8/supersparc sparc32/v8 sparc32"
662
extra_functions="udiv" ;;
666
# sparc64-*-linux-gnu is a misnomer, since there's no support for any
667
# 64-bit operations in user mode. We assume that a future release
668
# will have some 64-bit support and that the gcc options will be the
669
# same as on solaris.
671
# cc -xarch actually controls the ABI, hence it must be v8 for 32-bit,
672
# even though the chip is v9.
674
sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
675
path="sparc32/v9 sparc32/v8 sparc32"
676
extra_functions="udiv_fp"
678
SPEED_CYCLECOUNTER_OBJ=sparcv9.lo
680
gcc_cflags="-g -O2 -Wa,-xarch=v8plus"
681
gcc_cflags_cpu="-march=ultrasparc -march=v9 -march=v8 -mv8"
683
cc_cflags="-xtarget=native -xarch=v8 -xO4"
686
[*-*-solaris2.[7-9]])
687
# solaris prior to 2.6 doesn't save registers properly, so the
688
# 64-bit ABI is only available for 2.7 up
692
gcc_64_cflags="-g -O2 -m64 -mptr64 -Wa,-xarch=v9 -march=v9"
693
cc_64_cflags="-xtarget=native -xarch=v9 -xO4"
703
# Currently (version 3.0) gcc on vax always uses a frame pointer
704
# (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
707
gcc_cflags="-g -O2 $fomit_frame_pointer"
709
extra_functions="udiv_w_sdiv"
713
# AMD and Intel x86 configurations
715
AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86)
716
# Rumour has it gcc -O2 used to give worse register allocation than just
717
# -O, but lets assume that's no longer true.
718
gcc_cflags="-g -O2 $fomit_frame_pointer"
719
GMP_INCLUDE_MPN(x86/x86-defs.m4)
720
extra_functions="udiv umul"
721
CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo'
723
# Availability of rdtsc is checked at run-time.
724
SPEED_CYCLECOUNTER_OBJ=pentium.lo
726
# gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These
727
# represent -march= since -m486 doesn't generate 486 specific insns. The
728
# -march= and -march= options will fail, leaving just -m486.
730
# gcc 2.95.2 adds k6, pentium and pentiumpro, and allows -march= and
733
# gcc 3.0 adds athlon.
735
# gcc 3.1 adds pentium4.
737
# Defaults for anything not otherwise mentioned.
739
gcc_cflags_optlist="cpu arch"
740
gcc_cflags_cpu="-march=i486 -m486"
741
gcc_cflags_arch="-march=i486"
745
# Because i386 means generic x86, -march=i486 is used since that
746
# should better suit newer processors.
747
# FIXME: How would a user ask for an actual 80386? Currently only by
748
# using CFLAGS="-march=386" or whatever.
749
gcc_cflags_cpu="-march=i486 -m486"
750
gcc_cflags_arch="-march=i386"
752
i586*-*-* | pentium-*-* | pentiummmx-*-*)
753
gcc_cflags_cpu="-march=pentium -m486"
754
gcc_cflags_arch="-march=pentium"
756
[i686*-*-* | pentiumpro-*-* | pentium[23]-*-*])
757
gcc_cflags_cpu="-march=pentiumpro -march=i486 -m486"
758
gcc_cflags_arch="-march=pentiumpro -march=i486"
761
gcc_cflags_cpu="-march=k6 -march=i486 -m486"
762
gcc_cflags_arch="-march=k6 -march=i486"
765
# Athlon instruction costs are close to P6 (3 cycle load latency,
766
# 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
767
# know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
768
gcc_cflags_cpu="-march=athlon -march=pentiumpro -march=i486 -m486"
769
gcc_cflags_arch="-march=athlon -march=pentiumpro -march=i486"
772
# pentium4 is known to gcc 3.1 and up, not sure what cpu choice
773
# would best suit previous versions, pentiumpro will get us cmov
774
# from gcc 2.95.4 up, otherwise let's just try i486.
775
gcc_cflags_cpu="-march=pentium4 -march=pentiumpro -march=i486 -m486"
776
gcc_cflags_arch="-march=pentium4 -march=pentiumpro -march=i486"
781
i486*-*-*) path="x86/i486 x86" ;;
782
i586*-*-* | pentium-*-*) path="x86/pentium x86" ;;
783
pentiummmx-*-*) path="x86/pentium/mmx x86/pentium x86" ;;
784
i686*-*-* | pentiumpro-*-*) path="x86/p6 x86" ;;
785
pentium2-*-*) path="x86/p6/mmx x86/p6 x86" ;;
786
pentium3-*-*) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
787
[k6[23]*-*-*]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
788
k6*-*-*) path="x86/k6/mmx x86/k6 x86" ;;
789
athlon-*-*) path="x86/k7/mmx x86/k7 x86" ;;
790
pentium4-*-*) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
795
# FIXME: z8kx won't get through config.sub. Could make 16 versus 32 bit
796
# limb an ABI option perhaps.
799
extra_functions="udiv_w_sdiv"
803
extra_functions="udiv_w_sdiv"
807
# Special CPU "none" selects generic C. -DNO_ASM is used to disable gcc
808
# asm blocks in longlong.h (since they're driven by cpp pre-defined
809
# symbols like __alpha rather than the configured $host_cpu).
812
abilist="long longlong"
814
gcc_long_cflags=$gcc_cflags
815
gcc_long_cppflags="-DNO_ASM"
816
cc_long_cflags=$cc_cflags
817
cclist_longlong=$cclist
818
gcc_longlong_cflags=$gcc_cflags
819
gcc_longlong_cppflags="-DNO_ASM"
820
cc_longlong_cflags=$cc_cflags
821
limb_longlong=longlong
827
CFLAGS_or_unset=${CFLAGS-'(unset)'}
828
CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'}
831
configure:__line__: User:
834
CFLAGS=$CFLAGS_or_unset
835
CPPFLAGS=$CPPFLAGS_or_unset
837
configure:__line__: GMP:
843
test_CFLAGS=${CFLAGS+set}
844
test_CPPFLAGS=${CPPFLAGS+set}
846
for abi in $abilist; do
850
# If the user specifies an ABI then it must be in $abilist, after that
851
# $abilist is restricted to just that choice.
853
if test -n "$ABI"; then
855
for abi in $abilist; do
856
if test $abi = "$ABI"; then found=yes; break; fi
858
if test $found = no; then
859
AC_MSG_ERROR([ABI=$ABI is not among the following valid choices: $abilist])
866
for abi in $abilist; do
868
# Suppose abilist="64 32", then for abi=64, will have abi1="_64" and
869
# abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how
870
# $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the
871
# abilist), but there's no fallback for $gcc_64_cflags.
873
abi1=[`echo _$abi | sed 's/[.]//g'`]
874
if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi
876
# Compiler choices under this ABI
877
eval cclist_chosen=\"\$cclist$abi1\"
878
test -n "$cclist_chosen" || eval cclist_chosen=\"\$cclist$abi2\"
880
# If there's a user specified $CC then don't use a list for
881
# $cclist_chosen, just a single value for $ccbase.
883
if test -n "$CC"; then
885
# The first word of $CC, stripped of any directory. For instance
886
# CC="/usr/local/bin/gcc -pipe" will give "gcc".
888
for ccbase in $CC; do break; done
889
ccbase=`echo $ccbase | sed 's:.*/::'`
891
# If this $ccbase is in $cclist_chosen then it's a compiler we know and
892
# we can do flags defaulting with it. If not, then $cclist_chosen is
893
# set to "unrecognised" so no default flags are used.
895
# "unrecognised" is used to avoid bad effects with eval if $ccbase has
896
# non-symbol characters. For instance ccbase=my+cc would end up with
897
# something like cflags="$my+cc_cflags" which would give
898
# cflags="+cc_cflags" rather than the intended empty string for an
902
for i in $cclist_chosen; do
903
if test "$ccbase" = $i; then
911
for ccbase in $cclist_chosen; do
913
# When cross compiling, look for a compiler with the $host_alias as a
914
# prefix, the same way that AC_CHECK_TOOL does. But don't do this to a
917
# $cross_compiling will be yes/no/maybe at this point. Do the host
918
# prefixing for "maybe" as well as "yes".
920
if test "$cross_compiling" != no && test -z "$CC"; then
921
cross_compiling_prefix="${host_alias}-"
924
for ccprefix in $cross_compiling_prefix ""; do
927
test -n "$cc" || cc="$ccprefix$ccbase"
929
# If the compiler is gcc but installed under another name, then change
930
# $ccbase so as to use the flags we know for gcc. This helps for
931
# instance when specifying CC=gcc272 on Debian GNU/Linux, or the
932
# native cc which is really gcc on NeXT or MacOS-X.
934
# FIXME: There's a slight misfeature here. If cc is actually gcc but
935
# gcc is not a known compiler under this $abi then we'll end up
936
# testing it with no flags and it'll work, but chances are it won't be
937
# in the right mode for the ABI we desire. Let's quietly hope this
940
if test $ccbase != gcc; then
941
GMP_PROG_CC_IS_GNU($cc,ccbase=gcc)
944
# Similarly if the compiler is IBM xlc but invoked as cc or whatever
945
# then change $ccbase and make the default xlc flags available.
946
if test $ccbase != xlc; then
947
GMP_PROG_CC_IS_XLC($cc,ccbase=xlc)
950
# Any user CFLAGS, even an empty string, takes precendence
951
eval cflags=\"\$${ccbase}${abi1}_cflags\"
952
test -n "$cflags" || eval cflags=\"\$${ccbase}${abi2}_cflags\"
953
if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
955
# Any user CPPFLAGS, even an empty string, takes precendence
956
eval cppflags=\"\$${ccbase}${abi1}_cppflags\"
957
test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\"
958
if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
960
# --enable-profiling adds -p/-pg even to user-specified CFLAGS.
961
# This is convenient, but it's perhaps a bit naughty to modify user
963
case "$enable_profiling" in
964
prof) cflags="$cflags -p" ;;
965
gprof) cflags="$cflags -pg" ;;
968
GMP_PROG_CC_WORKS($cc $cflags $cppflags,,continue)
970
# The tests to perform on this $cc, if any
971
eval testlist=\"\$${ccbase}${abi1}_testlist\"
972
test -n "$testlist" || eval testlist=\"\$${ccbase}${abi2}_testlist\"
975
for tst in $testlist; do
977
hpc-hppa-2-0) GMP_HPC_HPPA_2_0($cc,,testlist_pass=no) ;;
978
gcc-arm-umodsi) GMP_GCC_ARM_UMODSI($cc,,testlist_pass=no) ;;
980
if test $testlist_pass = no; then break; fi
983
if test $testlist_pass = yes; then
989
if test $found_compiler = yes; then break; fi
992
if test $found_compiler = yes; then break; fi
996
# If we recognised the CPU, as indicated by $path being set, then insist
997
# that we have a working compiler, either from our $cclist choices or from
998
# $CC. We can't let AC_PROG_CC look around for a compiler because it might
999
# find one that we've rejected (for not supporting the modes our asm code
1002
# If we didn't recognise the CPU (and this includes host_cpu=none), then
1003
# fall through and let AC_PROG_CC look around for a compiler too. This is
1004
# mostly in the interests of following a standard autoconf setup, after all
1005
# we've already tested cc and gcc adequately (hopefully). As of autoconf
1006
# 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft
1007
# C on MS-DOS systems).
1009
if test $found_compiler = no && test -n "$path"; then
1010
AC_MSG_ERROR([could not find a working compiler])
1014
if test $found_compiler = yes; then
1016
# If we're creating CFLAGS, then look for optional additions. If the user
1017
# set CFLAGS then leave it alone.
1019
if test "$test_CFLAGS" != set; then
1020
eval optlist=\"\$${ccbase}${abi1}_cflags_optlist\"
1021
test -n "$optlist" || eval optlist=\"\$${ccbase}${abi2}_cflags_optlist\"
1023
for opt in $optlist; do
1024
eval optflags=\"\$${ccbase}${abi1}_cflags_${opt}\"
1025
test -n "$optflags" || eval optflags=\"\$${ccbase}${abi2}_cflags_${opt}\"
1027
for flag in $optflags; do
1031
# tickles stack slot bugs on some gcc, exclude as necessary
1032
GMP_GCC_MARCH_PENTIUMPRO($cc,,continue)
1035
# ease back to just -O on m68k gcc 2.95.x
1036
GMP_GCC_M68K_OPTIMIZE($ccbase,$cc,flag)
1039
# special check, avoiding a warning
1040
GMP_GCC_NO_CPP_PRECOMP($ccbase,$cc,$cflags,
1041
[cflags="$cflags $flag"
1047
GMP_PROG_CC_WORKS($cc $cflags $cppflags $flag,
1048
[cflags="$cflags $flag"
1057
CPPFLAGS="$cppflags"
1060
# Could easily have this in config.h too, if desired.
1061
ABI_nodots=`echo $ABI | sed 's/\./_/'`
1062
GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST)
1065
# GMP_LDFLAGS substitution, selected according to ABI.
1066
# These are needed on libgmp.la and libmp.la, but currently not on
1067
# convenience libraries like tune/libspeed.la or mpz/libmpz.la.
1069
eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
1070
test -n "$GMP_LDFLAGS" || eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
1071
AC_SUBST(GMP_LDFLAGS)
1073
# extra_functions, selected according to ABI
1074
eval tmp=\"\$extra_functions$abi1\"
1075
test -n "$tmp" || eval tmp=\"\$extra_functions$abi2\"
1076
extra_functions="$tmp"
1079
# Cycle counter, selected according to ABI.
1081
eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi1\"
1082
test -n "$tmp" || eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi2\"
1083
SPEED_CYCLECOUNTER_OBJ="$tmp"
1084
eval tmp=\"\$cyclecounter_size$abi1\"
1085
test -n "$tmp" || eval tmp=\"\$cyclecounter_size$abi2\"
1086
cyclecounter_size="$tmp"
1088
if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
1089
AC_DEFINE_UNQUOTED(HAVE_SPEED_CYCLECOUNTER, $cyclecounter_size,
1090
[Tune directory speed_cyclecounter, undef=none, 1=32bits, 2=64bits)])
1092
AC_SUBST(SPEED_CYCLECOUNTER_OBJ)
1095
# Calling conventions checking, selected according to ABI.
1097
eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\"
1098
test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\"
1099
CALLING_CONVENTIONS_OBJS="$tmp"
1101
if test -n "$CALLING_CONVENTIONS_OBJS"; then
1102
AC_DEFINE(HAVE_CALLING_CONVENTIONS,1,
1103
[Define if tests/libtests has calling conventions checking for the CPU])
1105
AC_SUBST(CALLING_CONVENTIONS_OBJS)
1110
# If the user gave an MPN_PATH, use that verbatim, otherwise choose
1111
# according to the ABI and add "generic".
1113
if test -n "$MPN_PATH"; then
1116
eval tmp=\"\$path$abi1\"
1117
test -n "$tmp" || eval tmp=\"\$path$abi2\"
1122
# Whether using a long long limb in this ABI.
1123
eval limb_chosen=\"\$limb$abi1\"
1124
test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\"
1125
case $limb_chosen in
1126
longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;;
1127
*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
1129
AC_SUBST(DEFN_LONG_LONG_LIMB)
1132
# The C compiler and preprocessor, put into ANSI mode if possible.
1139
# The C++ compiler, if desired.
1141
if test $enable_cxx != no; then
1142
test_CXXFLAGS=${CXXFLAGS+set}
1145
echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC
1146
cxxflags_ac_prog_cxx=$CXXFLAGS
1147
cxxflags_list=ac_prog_cxx
1149
# If the user didn't specify $CXXFLAGS, then try $CFLAGS, with -g removed
1150
# if AC_PROG_CXX thinks that doesn't work. $CFLAGS stands a good chance
1151
# of working, eg. on a GNU system where CC=gcc and CXX=g++.
1153
if test "$test_CXXFLAGS" != set; then
1154
cxxflags_cflags=$CFLAGS
1155
cxxflags_list="cflags $cxxflags_list"
1156
if test "$ac_prog_cxx_g" = no; then
1157
cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'`
1161
# See if the C++ compiler works. If the user specified CXXFLAGS then all
1162
# we're doing is checking whether AC_PROG_CXX succeeded, since it doesn't
1163
# give a fatal error, just leaves CXX set to a default g++. If on the
1164
# other hand the user didn't specify CXXFLAGS then we get to try here our
1165
# $cxxflags_list alternatives.
1167
for cxxflags_choice in $cxxflags_list; do
1168
eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\"
1169
GMP_PROG_CXX_WORKS($CXX $CXXFLAGS,
1174
# If --enable-cxx=yes but a C++ compiler can't be found, then abort.
1175
if test $want_cxx = no && test $enable_cxx = yes; then
1176
AC_MSG_ERROR([C++ compiler not available])
1180
AM_CONDITIONAL(WANT_CXX, test $want_cxx = yes)
1182
# FIXME: We're not interested in CXXCPP for ourselves, but if we don't call
1183
# it here then AC_PROG_LIBTOOL (via _LT_AC_TAGCONFIG) will do so
1184
# unconditionally, and that will fail if there's no C++ compiler (and no
1185
# generic /lib/cpp).
1187
if test $want_cxx = yes; then
1191
cat >&AC_FD_CC <<EOF
1192
configure:__line__: Decided:
1197
GMP_LDFLAGS=$GMP_LDFLAGS
1202
echo "using ABI=\"$ABI\""
1204
echo " CFLAGS=\"$CFLAGS\""
1205
echo " CPPFLAGS=\"$CPPFLAGS\""
1206
if test $want_cxx = yes; then
1207
echo " CXX=\"$CXX\""
1208
echo " CXXFLAGS=\"$CXXFLAGS\""
1217
[add_path="cray/ieee"],
1218
[add_path="cray/cfp"; extra_functions="mulwwc90"]) ;;
1220
extra_functions="mulwwj90"
1221
add_path="cray/cfp" ;;
1224
if test -z "$MPN_PATH"; then
1225
path="$add_path $path"
1229
# Automake ansi2knr support.
1236
# FIXME: On AIX 3 and 4, $libname.a is included in libtool
1237
# $library_names_spec, so libgmp.a becomes a symlink to libgmp.so, making
1238
# it impossible to build shared and static libraries simultaneously.
1239
# Disable shared libraries by default, but let the user override with
1240
# --enable-shared --disable-static.
1242
# FIXME: This $libname.a problem looks like it might apply to *-*-amigaos*
1243
# and *-*-os2* too, but wait for someone to test this before worrying
1244
# about it. If there is a problem then of course libtool is the right
1248
if test -z "$enable_shared"; then enable_shared=no; fi ;;
1250
# On Windows, build only static by default, and don't allow both static
1251
# and DLL. libtool -no-undefined is needed for a DLL, as per the
1252
# AC_LIBTOOL_WIN32_DLL doco.
1254
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1255
if test -z "$enable_shared"; then
1258
if test "$enable_shared" != no && test "$enable_static" != no; then
1259
AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
1260
Use "--disable-static --enable-shared" to build just a DLL.])
1262
if test "$enable_shared" = yes; then
1263
GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined"
1267
# FIXME: Libtool recognises djgpp can't build shared libraries, but still
1268
# makes tests/.libs/libtests.al out of PIC objects, which then fail to
1269
# link into the test programs. Forcibly disable shared stuff until
1270
# libtool gets it right,
1275
# FIXME: On SCO 5, an explicit -lc is not wanted when making shared
1276
# libraries. Giving it makes strange things happen, like ctype.h macros
1277
# not working and profiler mcount calls segfaulting. Libtool ought to
1278
# know about this, but as of Dec 2000 it doesn't, so forcibly disable -lc
1279
# on relevant systems.
1282
lt_cv_archive_cmds_need_lc=no ;;
1284
# FIXME: Shared libraries aren't supported on unicos, but as of Dec 2000
1285
# libtool doesn't seem to detect this correctly, so forcibly disable them.
1290
# It seems there are no shared libs on ultrix, and it is not very important
1291
# to work on this. Just disable for now.
1296
# Libtool runs an impgen.c program on the build system when making windows
1297
# DLLs. If we're cross compiling then look for a suitable build system
1298
# compiler, since $CC can't be expected to work.
1299
# FIXME: Libtool ought to do this itself.
1301
if test "$cross_compiling" != no && test "$enable_shared" != no; then
1303
*-*-cygwin* | *-*-mingw* | *-*-pw32*)
1309
# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on
1310
# mingw and cygwin. Under --disable-cxx this avoids some error messages
1311
# from libtool arising from the fact we didn't actually run AC_PROG_CXX.
1312
# Notice that any user-supplied --with-tags setting takes precedence.
1314
# FIXME: Is this the right way to get this effect? Very possibly not, but
1315
# the current _LT_AC_TAGCONFIG doesn't really suggest an alternative.
1317
if test "${with_tags+set}" != set; then
1318
if test $want_cxx = yes; then
1325
AC_LIBTOOL_WIN32_DLL
1328
# Generate an error here if attempting to build both shared and static when
1329
# $libname.a is in $library_names_spec (as mentioned above), rather than
1330
# wait for ar or ld to fail.
1332
if test "$enable_shared" = yes && test "$enable_static" = yes; then
1333
case $library_names_spec in
1335
AC_MSG_ERROR([cannot create both shared and static libraries on this system, --disable one of the two])
1340
# Encode in gmp.h whether a shared or static library is available.
1341
# Currently only used for the windows DLL stuff.
1343
case $enable_shared in
1344
yes) __GMP_LIBGMP_SHARED=1 ;;
1345
no) __GMP_LIBGMP_SHARED=0 ;;
1347
AC_SUBST(__GMP_LIBGMP_SHARED)
1349
case $enable_static in
1350
yes) __GMP_LIBGMP_STATIC=1 ;;
1351
no) __GMP_LIBGMP_STATIC=0 ;;
1353
AC_SUBST(__GMP_LIBGMP_STATIC)
1356
# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am.
1357
# Using the compiler is a lot easier than figuring out how to invoke the
1358
# assembler directly.
1360
test -n "$CCAS" || CCAS="$CC -c"
1365
# If there's any sse2 or mmx in the path, check whether the assembler
1366
# supports it, and remove if not.
1368
*mmx*) GMP_ASM_X86_MMX( , [GMP_STRIP_PATH(*mmx*)]) ;;
1371
*sse2*) GMP_ASM_X86_SSE2( , [GMP_STRIP_PATH(sse2)]) ;;
1377
# The library and header checks are mostly for the benefit of supplementary
1378
# programs. libgmp doesn't use anything too weird.
1383
# stdint.h, unistd.h and sys/types.h are already in the autoconf default
1385
AC_CHECK_HEADERS(locale.h sys/mman.h sys/param.h sys/processor.h sys/resource.h sys/sysctl.h sys/systemcfg.h sys/time.h sys/times.h)
1387
# optarg should be in unistd.h, which is already in the default includes
1388
AC_CHECK_DECLS([fgetc, fscanf, optarg, ungetc, vfprintf])
1392
# the default includes are sufficient for all these types
1393
AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t])
1397
GMP_C_ATTRIBUTE_CONST
1398
GMP_C_ATTRIBUTE_MALLOC
1399
GMP_C_ATTRIBUTE_MODE
1400
GMP_C_ATTRIBUTE_NORETURN
1413
GMP_IMPL_H_IEEE_FLOATS
1416
# On m68k NetBSD 1.4.1 getrusage() is doubtful. ru_utime looks microsecond
1417
# accurate but has been seen remaining unchanged after many microseconds
1418
# have elapsed. This upsets the tune and speed programs, so pretend it
1421
# FIXME: Would prefer tune/time.c to do a run-time test for this rather than
1422
# driving it from the system name.
1425
m68*-*-netbsd1.4*) ac_cv_func_getrusage=no ;;
1428
AC_CHECK_FUNCS(alarm getpagesize getrusage gettimeofday localeconv memset mmap mprotect obstack_vprintf popen processor_info read_real_time strchr strnlen strtoul sysconf sysctl sysctlbyname times)
1430
# FIXME: Would have done this with an AM_CONDITIONAL, but automake 1.5
1431
# doesn't like that under libgmp_la_DEPENDENCIES.
1433
if test "$gmp_cv_func_vsnprintf" = no; then
1434
AC_SUBST(REPL_VSNPRINTF_PRINTF_OBJ, 'printf/repl-vsnprintf$U.lo')
1435
AC_SUBST(REPL_VSNPRINTF_OBJ, 'repl-vsnprintf$U.lo')
1438
GMP_FUNC_SSCANF_WRITABLE_INPUT
1441
# Pick the correct source files in $path and link them to mpn/.
1442
# $gmp_mpn_functions lists all functions we need.
1444
# The rule is to find a file with the function name and a .asm, .S,
1445
# .s, or .c extension. Certain multi-function files with special names
1446
# can provide some functions too. (mpn/Makefile.am passes
1447
# -DOPERATION_<func> to get them to generate the right code.)
1449
# FIXME: udiv and umul aren't in $gmp_mpn_functions_optional yet since
1450
# there's some versions of those files which should be checked for bit
1451
# rot first. Put them in $extra_functions for each host for now,
1452
# change to standard optionals when all are ready.
1454
# Note: The following lines defining $gmp_mpn_functions_optional
1455
# and $gmp_mpn_functions are parsed by the "macos/configure"
1456
# Perl script. So if you change the lines in a major way
1457
# make sure to run and examine the output from
1459
# % (cd macos; perl configure)
1461
# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former
1462
# can optionally provide the latter as an extra entrypoint.
1464
gmp_mpn_functions_optional="copyi copyd com_n \
1465
and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
1466
gcd_finda invert_limb sqr_diagonal"
1468
gmp_mpn_functions="$extra_functions \
1469
add add_1 add_n sub sub_1 sub_n mul_1 addmul_1 \
1470
submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
1471
fib2_ui mod_1 mod_34lsub1 mode1o pre_mod_1 dump \
1472
mul mul_fft mul_n mul_basecase sqr_basecase random \
1473
random2 sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
1474
bdivmod gcd_1 gcd gcdext tdiv_qr dc_divrem_n sb_divrem_mn jacbase \
1475
$gmp_mpn_functions_optional"
1477
# the list of all object files used by mpn/Makefile.in and the
1478
# top-level Makefile.in, respectively
1480
mpn_objs_in_libgmp="mpn/mp_bases.lo"
1482
# links from the sources, to be removed by "make distclean"
1485
define(MPN_SUFFIXES,[asm S s c])
1487
for tmp_ext in MPN_SUFFIXES; do
1488
eval found_$tmp_ext=no
1491
for tmp_fn in $gmp_mpn_functions; do
1492
for tmp_ext in MPN_SUFFIXES; do
1493
test "$no_create" = yes || rm -f mpn/$tmp_fn.$tmp_ext
1496
# Don't need pre_mod_1 if it's already been provided (by an asm mod_1).
1499
if test "$HAVE_NATIVE_mpn_preinv_mod_1" = yes; then continue; fi ;;
1502
# functions that can be provided by multi-function files
1505
add_n|sub_n) tmp_mulfunc="aors_n" ;;
1506
addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
1507
popcount|hamdist) tmp_mulfunc="popham" ;;
1508
and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
1509
tmp_mulfunc="logops_n" ;;
1510
lshift|rshift) tmp_mulfunc="lorrshift";;
1514
for tmp_dir in $path; do
1515
for tmp_base in $tmp_fn $tmp_mulfunc; do
1516
for tmp_ext in MPN_SUFFIXES; do
1517
tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
1518
if test -f $tmp_file; then
1520
eval found_$tmp_ext=yes
1522
if test $tmp_ext = c; then
1528
mpn_objects="$mpn_objects $tmp_fn$tmp_u.lo"
1529
mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/$tmp_fn$tmp_u.lo"
1530
AC_CONFIG_LINKS(mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext)
1531
gmp_srclinks="$gmp_srclinks mpn/$tmp_fn.$tmp_ext"
1533
# Duplicate AC_DEFINEs are harmless, so it doesn't matter
1534
# that multi-function files get grepped here repeatedly.
1535
# The PROLOGUE pattern has ".*" so that alpha PROLOGUE_GP matches.
1537
sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ;
1538
sed -n 's/^[ ]*PROLOGUE.*(\(.*\))/\1/p' $tmp_file
1540
for gmp_tmp in $gmp_ep; do
1541
AC_DEFINE_UNQUOTED(HAVE_NATIVE_$gmp_tmp)
1542
eval HAVE_NATIVE_$gmp_tmp=yes
1546
sqr_basecase) sqr_basecase_source=$tmp_file ;;
1552
if test $found = yes; then break ; fi
1554
if test $found = yes; then break ; fi
1557
if test $found = no; then
1558
for tmp_optional in $gmp_mpn_functions_optional; do
1559
if test $tmp_optional = $tmp_fn; then
1563
if test $found = no; then
1564
AC_MSG_ERROR([no version of $tmp_fn found in path: $path])
1569
# All cycle counters are .asm files currently
1570
if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
1575
# Don't demand an m4 unless it's actually needed.
1576
if test $found_asm = yes; then
1578
GMP_M4_M4WRAP_SPURIOUS
1583
# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
1584
if test $found_asm = no && test $found_S = no; then
1585
gmp_asm_syntax_testing=no
1588
if test "$gmp_asm_syntax_testing" != no; then
1591
GMP_ASM_LABEL_SUFFIX
1604
GMP_ASM_M68K_INSTRUCTION
1605
GMP_ASM_M68K_ADDRESSING
1606
GMP_ASM_M68K_BRANCHES
1609
GMP_ASM_POWERPC_R_REGISTERS
1610
GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
1612
powerpc64*-*-aix*) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;;
1613
*-*-aix*) GMP_INCLUDE_MPN(powerpc32/aix.m4) ;;
1618
GMP_ASM_ALIGN_FILL_0x90
1619
GMP_ASM_X86_SHLDL_CL
1620
if test "$enable_profiling" != no; then
1628
# Create link for gmp-mparam.h.
1630
for tmp_dir in $path; do
1631
test "$no_create" = yes || rm -f gmp-mparam.h
1632
tmp_file=$srcdir/mpn/$tmp_dir/gmp-mparam.h
1633
if test -f $tmp_file; then
1634
AC_CONFIG_LINKS(gmp-mparam.h:mpn/$tmp_dir/gmp-mparam.h)
1635
gmp_srclinks="$gmp_srclinks gmp-mparam.h"
1636
gmp_mparam_source=$tmp_file
1640
if test -z "$gmp_mparam_source"; then
1641
AC_MSG_ERROR([no version of gmp-mparam.h found in path: $path])
1644
# Copy any KARATSUBA_SQR_THRESHOLD from gmp-mparam.h to config.m4.
1645
# Some versions of sqr_basecase.asm use this.
1646
tmp_gmp_karatsuba_sqr_threshold=`sed -n 's/^#define KARATSUBA_SQR_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
1647
if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then
1648
GMP_DEFINE_RAW(["define(<KARATSUBA_SQR_THRESHOLD>,<$tmp_gmp_karatsuba_sqr_threshold>)"])
1651
# This must come after gmp-mparam.h has been chosen.
1655
# Exclude the mpn random functions from mpbsd since that would drag in the
1656
# top-level rand things, all of which are unnecessary for libmp. There's
1657
# other unnecessary objects too actually, if we could be bothered figuring
1658
# out exactly which they are.
1661
for i in $mpn_objs_in_libgmp; do
1664
*) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;;
1667
AC_SUBST(mpn_objs_in_libmp)
1669
AC_SUBST(mpn_objects)
1670
AC_SUBST(mpn_objs_in_libgmp)
1671
AC_SUBST(gmp_srclinks)
1674
# A recompiled sqr_basecase for use in the tune program, if necessary.
1676
test -d tune || mkdir tune
1677
case $sqr_basecase_source in
1679
sqr_max=[`sed -n 's/^def...(KARATSUBA_SQR_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`]
1680
if test -n "$sqr_max"; then
1681
TUNE_SQR_OBJ=sqr_asm.o
1682
AC_DEFINE_UNQUOTED(TUNE_KARATSUBA_SQR_MAX,$sqr_max,
1683
[Maximum size the tune program can test for KARATSUBA_SQR_THRESHOLD])
1685
cat >tune/sqr_basecase.c <<EOF
1686
/* not sure that an empty file can compile, so put in a dummy */
1687
int sqr_basecase_dummy;
1692
AC_DEFINE(TUNE_KARATSUBA_SQR_MAX,KARATSUBA_SQR_MAX_GENERIC)
1693
cat >tune/sqr_basecase.c <<EOF
1694
#define TUNE_PROGRAM_BUILD 1
1695
#define TUNE_PROGRAM_BUILD_SQR 1
1696
#include "mpn/sqr_basecase.c"
1700
AC_SUBST(TUNE_SQR_OBJ)
1703
# Configs for demos/expr directory
1704
if test $enable_mpfr = yes; then
1716
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
1717
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
1719
AC_OUTPUT(Makefile \
1720
mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile \
1721
mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile \
1722
tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile \
1723
tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \
1724
tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \
1725
tests/cxx/Makefile \
1727
demos/Makefile demos/calc/Makefile demos/expr/Makefile \
1728
gmp.h:gmp-h.in mp.h:mp-h.in \
1729
demos/expr/expr-impl.h:demos/expr/expr-impl-h.in)
1731
dnl mpfr temporarily removed from the distribution
1732
dnl mpfr/Makefile mpfr/tests/Makefile