1 diff -urN gmp-6.0.0.org/configure.ac gmp-6.0.0/configure.ac
2 --- gmp-6.0.0.org/configure.ac 2014-03-25 15:37:55.000000000 +0100
3 +++ gmp-6.0.0/configure.ac 2014-03-26 20:43:38.290317434 +0100
5 AC_MSG_ERROR([--enable-fake-cpuid requires --enable-fat])
9 -tmp_host=`echo $host_cpu | sed 's/\./_/'`
11 +AC_HELP_STRING([--with-cpu],
12 + [specify CPU type [[default=host_cpu]]]),
13 +[gmp_cpu=$withval], [gmp_cpu=$host_cpu])
15 +tmp_host=`echo $gmp_cpu | sed 's/\./_/'`
16 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
17 GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST)
22 AC_DEFINE(HAVE_HOST_CPU_FAMILY_alpha)
25 alphaev5* | alphapca5*)
26 path="alpha/ev5 alpha" ;;
27 alphaev67 | alphaev68 | alphaev7*)
29 # compiler errors too easily and is rejected by GMP_PROG_CC_WORKS. Each
30 # -mcpu=ev6 below has a fallback to -mcpu=ev56 for this reason.
34 alpha) gcc_cflags_cpu="-mcpu=ev4" ;;
35 alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;;
36 alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;;
38 # Insns like ctlz which were never available as macros are always
39 # accepted and always generate their plain code.
43 alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;;
44 alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;;
45 alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;;
47 # DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6.
48 # Compaq C V6.3-029 adds ev67.
52 alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;;
53 alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;;
54 alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;;
56 # FIXME: We make mandatory compiler options optional here. We should
57 # either enforce them, or organise to strip paths as the corresponding
61 armsa1 | arm9tdmi | armv4*)
63 gcc_cflags_arch="-march=armv4"
65 # (Can't remember why this isn't done already, have to check what .asm
66 # files are available in each and how they run on a typical 2.0 cpu.)
70 hppa1.0*) path="pa32" ;;
71 hppa7000*) path="pa32/hppa1_1 pa32" ;;
74 # probably be safe, but let's not take the chance. In any case, a
75 # configuration like --host=hppa2.0 ABI=1.0 is far from optimal.
79 hppa1.0*) gcc_cflags_arch="-mpa-risc-1-0" ;;
81 gcc_cflags_arch="-mpa-risc-1-1" ;;
86 hppa1.0*) cc_cflags="+O2" ;;
88 cc_cflags="+DA1.1 +O2" ;;
90 SPEED_CYCLECOUNTER_OBJ=ia64.lo
91 any_32_testlist="sizeof-long-4"
95 itanium) path="ia64/itanium ia64" ;;
96 itanium2) path="ia64/itanium2 ia64" ;;
99 gcc_32_cflags_optlist=$gcc_64_cflags_optlist
101 # gcc pre-release 3.4 adds -mtune itanium and itanium2
104 itanium) gcc_cflags_tune="-mtune=itanium" ;;
105 itanium2) gcc_cflags_tune="-mtune=itanium2" ;;
108 # gcc 2.95 adds -mcpu32, -m68060.
109 # FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2.
113 m68020) gcc_cflags_arch="-m68020" ;;
114 m68030) gcc_cflags_arch="-m68030" ;;
115 m68040) gcc_cflags_arch="-m68040" ;;
117 # FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be
118 # tested. Will need to introduce an m68k/cpu32 if m68k/mc68020 ever uses
119 # the bitfield instructions.
122 [m680[234]0 | m68360]) path="m68k/mc68020 m68k" ;;
126 SPEED_CYCLECOUNTER_OBJ=powerpc.lo
131 powerpc740 | powerpc750)
132 path="powerpc32/750 powerpc32" ;;
133 powerpc7400 | powerpc7410)
140 powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
141 powerpc403) gcc_cflags_cpu="-mcpu=403"
142 xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
143 @@ -1216,7 +1220,7 @@
144 extra_functions="udiv_w_sdiv"
145 gcc_32_cflags_maybe="-m31"
152 @@ -1272,7 +1276,7 @@
154 gcc_64_cflags_optlist="arch"
155 gcc_64_cflags="$gcc_cflags -m64"
156 - path_64="s390_64/$host_cpu s390_64"
157 + path_64="s390_64/$gmp_cpu s390_64"
161 @@ -1297,7 +1301,7 @@
162 any_testlist="sizeof-long-4"
163 GMP_INCLUDE_MPN(sparc32/sparc-defs.m4)
167 sparcv8 | microsparc | turbosparc)
168 path="sparc32/v8 sparc32" ;;
170 @@ -1333,7 +1337,7 @@
171 # plain -m forms will disappear.
172 # gcc 3.3 adds ultrasparc3.
177 gcc_cflags_cpu="-mcpu=supersparc -msupersparc"
178 gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
179 @@ -1381,7 +1385,7 @@
181 # SunOS cc doesn't know -xarch, apparently always generating v7
182 # code, so make this optional
185 sparcv8 | microsparc* | supersparc* | turbosparc | hypersparc*)
186 cc_cflags_arch="-xarch=v8";;
188 @@ -1397,7 +1401,7 @@
189 # micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i.
190 # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu.
194 supersparc*) cc_cflags_cpu="-xchip=super" ;;
195 microsparc*) cc_cflags_cpu="-xchip=micro" ;;
196 turbosparc) cc_cflags_cpu="-xchip=micro2" ;;
197 @@ -1416,7 +1420,7 @@
203 sparc64 | sparcv9* | ultrasparc*)
205 # Solaris 6 and earlier cannot run ABI=64 since it doesn't save
206 @@ -1443,7 +1447,7 @@
207 *) abilist="64 32" ;;
212 ultrasparc | ultrasparc2 | ultrasparc2i)
213 path_64="sparc64/ultrasparc1234 sparc64" ;;
215 @@ -1484,7 +1488,7 @@
217 cclist_64="$cclist_64 cc"
218 cc_64_cflags_optlist="cpu"
222 cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;;
224 @@ -1528,7 +1532,7 @@
226 # -m32 forces 32-bit mode on a bi-arch 32/64 amd64 build of gcc. -m64 is
227 # the default in such a build (we think), so -m32 is essential for ABI=32.
228 - # This is, of course, done for any $host_cpu, not just x86_64, so we can
229 + # This is, of course, done for any $gmp_cpu, not just x86_64, so we can
230 # get such a gcc into the right mode to cross-compile to say i486-*-*.
232 # -m32 is not available in gcc 2.95 and earlier, hence cflags_maybe to use
233 @@ -1585,7 +1589,7 @@
234 # duplicate anything.
236 gcc_cflags_optlist="cpu arch"
240 gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
241 gcc_cflags_arch="-march=i386"
242 diff -urN gmp-6.0.0.org/configure.ac~ gmp-6.0.0/configure.ac~
243 --- gmp-6.0.0.org/configure.ac~ 1970-01-01 01:00:00.000000000 +0100
244 +++ gmp-6.0.0/configure.ac~ 2014-03-25 15:37:55.000000000 +0100
246 +dnl Process this file with autoconf to produce a configure script.
249 +define(GMP_COPYRIGHT,[[
251 +Copyright 1996-2014 Free Software Foundation, Inc.
253 +This file is part of the GNU MP Library.
255 +The GNU MP Library is free software; you can redistribute it and/or modify
256 +it under the terms of either:
258 + * the GNU Lesser General Public License as published by the Free
259 + Software Foundation; either version 3 of the License, or (at your
260 + option) any later version.
264 + * the GNU General Public License as published by the Free Software
265 + Foundation; either version 2 of the License, or (at your option) any
268 +or both in parallel, as here.
270 +The GNU MP Library is distributed in the hope that it will be useful, but
271 +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
272 +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
275 +You should have received copies of the GNU General Public License and the
276 +GNU Lesser General Public License along with the GNU MP Library. If not,
277 +see https://www.gnu.org/licenses/.
280 +AC_COPYRIGHT(GMP_COPYRIGHT)
281 +AH_TOP(/*GMP_COPYRIGHT*/)
283 +AC_REVISION($Revision$)
285 +AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html], gmp)
286 +AC_CONFIG_SRCDIR(gmp-impl.h)
287 +m4_pattern_forbid([^[ \t]*GMP_])
288 +m4_pattern_allow(GMP_LDFLAGS)
289 +m4_pattern_allow(GMP_LIMB_BITS)
290 +m4_pattern_allow(GMP_MPARAM_H_SUGGEST)
291 +m4_pattern_allow(GMP_NAIL_BITS)
292 +m4_pattern_allow(GMP_NUMB_BITS)
293 +m4_pattern_allow(GMP_NONSTD_ABI)
294 +m4_pattern_allow(GMP_CPU_TYPE)
296 +# If --target is not used then $target_alias is empty, but if say
297 +# "./configure athlon-pc-freebsd3.5" is used, then all three of
298 +# $build_alias, $host_alias and $target_alias are set to
299 +# "athlon-pc-freebsd3.5".
301 +if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then
302 + AC_MSG_ERROR([--target is not appropriate for GMP
303 +Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
304 +explicitly. Use --host if cross-compiling (see "Installing GMP" in the
305 +manual for more on this).])
312 +dnl Automake "no-dependencies" is used because include file dependencies
313 +dnl are not useful to us. Pretty much everything depends just on gmp.h,
314 +dnl gmp-impl.h and longlong.h, and yet only rarely does everything need to
315 +dnl be rebuilt for changes to those files.
317 +dnl "no-dependencies" also helps with the way we're setup to run
318 +dnl AC_PROG_CXX only conditionally. If dependencies are used then recent
319 +dnl automake (eg 1.7.2) appends an AM_CONDITIONAL to AC_PROG_CXX, and then
320 +dnl gets upset if it's not actually executed.
322 +dnl Note that there's a copy of these options in the top-level Makefile.am,
323 +dnl so update there too if changing anything.
325 +AM_INIT_AUTOMAKE([1.8 gnu no-dependencies])
326 +AC_CONFIG_HEADERS(config.h:config.in)
330 +AC_ARG_ENABLE(assert,
331 +AC_HELP_STRING([--enable-assert],[enable ASSERT checking [[default=no]]]),
334 +*) AC_MSG_ERROR([bad value $enableval for --enable-assert, need yes or no]) ;;
338 +if test "$enable_assert" = "yes"; then
339 + AC_DEFINE(WANT_ASSERT,1,
340 + [Define to 1 to enable ASSERT checking, per --enable-assert])
345 +GMP_DEFINE_RAW(["define(<WANT_ASSERT>,$want_assert_01)"])
348 +AC_ARG_ENABLE(alloca,
349 +AC_HELP_STRING([--enable-alloca],[how to get temp memory [[default=reentrant]]]),
351 +alloca|malloc-reentrant|malloc-notreentrant) ;;
352 +yes|no|reentrant|notreentrant) ;;
355 + AC_MSG_ERROR([bad value $enableval for --enable-alloca, need one of:
356 +yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug]) ;;
358 +[enable_alloca=reentrant])
361 +# IMPROVE ME: The default for C++ is disabled. The tests currently
362 +# performed below for a working C++ compiler are not particularly strong,
363 +# and in general can't be expected to get the right setup on their own. The
364 +# most significant problem is getting the ABI the same. Defaulting CXXFLAGS
365 +# to CFLAGS takes only a small step towards this. It's also probably worth
366 +# worrying whether the C and C++ runtimes from say gcc and a vendor C++ can
367 +# work together. Some rather broken C++ installations were encountered
368 +# during testing, and though such things clearly aren't GMP's problem, if
369 +# --enable-cxx=detect were to be the default then some careful checks of
370 +# which, if any, C++ compiler on the system is up to scratch would be
374 +AC_HELP_STRING([--enable-cxx],[enable C++ support [[default=no]]]),
377 +*) AC_MSG_ERROR([bad value $enableval for --enable-cxx, need yes/no/detect]) ;;
382 +AC_ARG_ENABLE(assembly,
383 +AC_HELP_STRING([--enable-assembly],[enable the use of assembly loops [[default=yes]]]),
386 +*) AC_MSG_ERROR([bad value $enableval for --enable-assembly, need yes or no]) ;;
388 +[enable_assembly=yes])
390 +if test "$enable_assembly" = "yes"; then
391 + AC_DEFINE(WANT_ASSEMBLY,1,
392 + [Defined to 1 as per --enable-assembly])
397 +AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [[default=yes]]]),
400 +*) AC_MSG_ERROR([bad value $enableval for --enable-fft, need yes or no]) ;;
404 +if test "$enable_fft" = "yes"; then
405 + AC_DEFINE(WANT_FFT,1,
406 + [Define to 1 to enable FFTs for multiplication, per --enable-fft])
410 +AC_ARG_ENABLE(old-fft-full,
411 +AC_HELP_STRING([--enable-old-fft-full],[enable old mpn_mul_fft_full for multiplication [[default=no]]]),
414 +*) AC_MSG_ERROR([bad value $enableval for --enable-old-fft-full, need yes or no]) ;;
416 +[enable_old_fft_full=no])
418 +if test "$enable_old_fft_full" = "yes"; then
419 + AC_DEFINE(WANT_OLD_FFT_FULL,1,
420 + [Define to 1 to enable old mpn_mul_fft_full for multiplication, per --enable-old-fft-full])
424 +AC_ARG_ENABLE(nails,
425 +AC_HELP_STRING([--enable-nails],[use nails on limbs [[default=no]]]),
427 +[yes|no|[02468]|[0-9][02468]]) ;;
429 + AC_MSG_ERROR([bad value $enableval for --enable-nails, only even nail sizes supported]) ;;
431 + AC_MSG_ERROR([bad value $enableval for --enable-nails, need yes/no/number]) ;;
435 +case $enable_nails in
436 +yes) GMP_NAIL_BITS=2 ;;
437 +no) GMP_NAIL_BITS=0 ;;
438 +*) GMP_NAIL_BITS=$enable_nails ;;
440 +AC_SUBST(GMP_NAIL_BITS)
443 +AC_ARG_ENABLE(profiling,
444 +AC_HELP_STRING([--enable-profiling],
445 + [build with profiler support [[default=no]]]),
447 +no|prof|gprof|instrument) ;;
448 +*) AC_MSG_ERROR([bad value $enableval for --enable-profiling, need no/prof/gprof/instrument]) ;;
450 +[enable_profiling=no])
452 +case $enable_profiling in
454 + AC_DEFINE(WANT_PROFILING_PROF, 1,
455 + [Define to 1 if --enable-profiling=prof])
458 + AC_DEFINE(WANT_PROFILING_GPROF, 1,
459 + [Define to 1 if --enable-profiling=gprof])
462 + AC_DEFINE(WANT_PROFILING_INSTRUMENT, 1,
463 + [Define to 1 if --enable-profiling=instrument])
467 +GMP_DEFINE_RAW(["define(<WANT_PROFILING>,<\`$enable_profiling'>)"])
469 +# -fomit-frame-pointer is incompatible with -pg on some chips
470 +if test "$enable_profiling" = gprof; then
471 + fomit_frame_pointer=
473 + fomit_frame_pointer="-fomit-frame-pointer"
477 +AC_ARG_WITH(readline,
478 +AC_HELP_STRING([--with-readline],
479 + [readline support in calc demo program [[default=detect]]]),
482 +*) AC_MSG_ERROR([bad value $withval for --with-readline, need yes/no/detect]) ;;
484 +[with_readline=detect])
488 +AC_HELP_STRING([--enable-fat],
489 + [build a fat binary on systems that support it [[default=no]]]),
492 +*) AC_MSG_ERROR([bad value $enableval for --enable-fat, need yes or no]) ;;
497 +AC_ARG_ENABLE(minithres,
498 +AC_HELP_STRING([--enable-minithres],
499 + [choose minimal thresholds for testing [[default=no]]]),
502 +*) AC_MSG_ERROR([bad value $enableval for --enable-minithres, need yes or no]) ;;
504 +[enable_minithres=no])
507 +AC_ARG_ENABLE(fake-cpuid,
508 +AC_HELP_STRING([--enable-fake-cpuid],[enable GMP_CPU_TYPE faking cpuid [[default=no]]]),
511 +*) AC_MSG_ERROR([bad value $enableval for --enable-fake-cpuid, need yes or no]) ;;
513 +[enable_fake_cpuid=no])
515 +if test "$enable_fake_cpuid" = "yes"; then
516 + AC_DEFINE(WANT_FAKE_CPUID,1,
517 + [Define to 1 to enable GMP_CPU_TYPE faking cpuid, per --enable-fake-cpuid])
521 +if test $enable_fat = yes && test $enable_assembly = no ; then
522 + AC_MSG_ERROR([when doing a fat build, disabling assembly will not work])
525 +if test $enable_fake_cpuid = yes && test $enable_fat = no ; then
526 + AC_MSG_ERROR([--enable-fake-cpuid requires --enable-fat])
530 +tmp_host=`echo $host_cpu | sed 's/\./_/'`
531 +AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host)
532 +GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST)
534 +dnl The HAVE_HOST_CPU_ list here only needs to have entries for those which
535 +dnl are going to be tested, not everything that can possibly be selected.
537 +dnl The HAVE_HOST_CPU_FAMILY_ list similarly, and note that the AC_DEFINEs
538 +dnl for these are under the cpu specific setups below.
540 +AH_VERBATIM([HAVE_HOST_CPU_1],
541 +[/* Define one of these to 1 for the host CPU family.
542 + If your CPU is not in any of these families, leave all undefined.
543 + For an AMD64 chip, define "x86" in ABI=32, but not in ABI=64. */
544 +#undef HAVE_HOST_CPU_FAMILY_alpha
545 +#undef HAVE_HOST_CPU_FAMILY_m68k
546 +#undef HAVE_HOST_CPU_FAMILY_power
547 +#undef HAVE_HOST_CPU_FAMILY_powerpc
548 +#undef HAVE_HOST_CPU_FAMILY_x86
549 +#undef HAVE_HOST_CPU_FAMILY_x86_64
551 +/* Define one of the following to 1 for the host CPU, as per the output of
552 + ./config.guess. If your CPU is not listed here, leave all undefined. */
553 +#undef HAVE_HOST_CPU_alphaev67
554 +#undef HAVE_HOST_CPU_alphaev68
555 +#undef HAVE_HOST_CPU_alphaev7
556 +#undef HAVE_HOST_CPU_m68020
557 +#undef HAVE_HOST_CPU_m68030
558 +#undef HAVE_HOST_CPU_m68040
559 +#undef HAVE_HOST_CPU_m68060
560 +#undef HAVE_HOST_CPU_m68360
561 +#undef HAVE_HOST_CPU_powerpc604
562 +#undef HAVE_HOST_CPU_powerpc604e
563 +#undef HAVE_HOST_CPU_powerpc750
564 +#undef HAVE_HOST_CPU_powerpc7400
565 +#undef HAVE_HOST_CPU_supersparc
566 +#undef HAVE_HOST_CPU_i386
567 +#undef HAVE_HOST_CPU_i586
568 +#undef HAVE_HOST_CPU_i686
569 +#undef HAVE_HOST_CPU_pentium
570 +#undef HAVE_HOST_CPU_pentiummmx
571 +#undef HAVE_HOST_CPU_pentiumpro
572 +#undef HAVE_HOST_CPU_pentium2
573 +#undef HAVE_HOST_CPU_pentium3
574 +#undef HAVE_HOST_CPU_s390_z900
575 +#undef HAVE_HOST_CPU_s390_z990
576 +#undef HAVE_HOST_CPU_s390_z9
577 +#undef HAVE_HOST_CPU_s390_z10
578 +#undef HAVE_HOST_CPU_s390_z196
580 +/* Define to 1 iff we have a s390 with 64-bit registers. */
581 +#undef HAVE_HOST_CPU_s390_zarch])
584 +# Table of compilers, options, and mpn paths. This code has various related
587 +# - better default CC/CFLAGS selections than autoconf otherwise gives
588 +# - default CC/CFLAGS selections for extra CPU types specific to GMP
589 +# - a few tests for known bad compilers
590 +# - choice of ABIs on suitable systems
591 +# - selection of corresponding mpn search path
593 +# After GMP specific searches and tests, the standard autoconf AC_PROG_CC is
594 +# called. User selections of CC etc are respected.
596 +# Care is taken not to use macros like AC_TRY_COMPILE during the GMP
597 +# pre-testing, since they of course depend on AC_PROG_CC, and also some of
598 +# them cache their results, which is not wanted.
600 +# The ABI selection mechanism is unique to GMP. All that reaches autoconf
601 +# is a different selection of CC/CFLAGS according to the best ABI the system
602 +# supports, and/or what the user selects. Naturally the mpn assembler code
603 +# selected is very dependent on the ABI.
605 +# The closest the standard tools come to a notion of ABI is something like
606 +# "sparc64" which encodes a CPU and an ABI together. This doesn't seem to
607 +# scale well for GMP, where exact CPU types like "ultrasparc2" are wanted,
608 +# separate from the ABI used on them.
611 +# The variables set here are
613 +# cclist the compiler choices
614 +# xx_cflags flags for compiler xx
615 +# xx_cflags_maybe flags for compiler xx, if they work
616 +# xx_cppflags cpp flags for compiler xx
617 +# xx_cflags_optlist list of sets of optional flags
618 +# xx_cflags_yyy set yyy of optional flags for compiler xx
619 +# xx_ldflags -Wc,-foo flags for libtool linking with compiler xx
620 +# ar_flags extra flags for $AR
621 +# nm_flags extra flags for $NM
622 +# limb limb size, can be "longlong"
623 +# path mpn search path
624 +# extra_functions extra mpn functions
625 +# fat_path fat binary mpn search path [if fat binary desired]
626 +# fat_functions fat functions
627 +# fat_thresholds fat thresholds
629 +# Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are
630 +# tried, and the first flag that works will be used. An optlist like "arch
631 +# cpu optimize" can be used to get multiple independent sets of flags tried.
632 +# The first that works from each will be used. If no flag in a set works
633 +# then nothing from that set is added.
635 +# For multiple ABIs, the scheme extends as follows.
637 +# abilist set of ABI choices
638 +# cclist_aa compiler choices in ABI aa
639 +# xx_aa_cflags flags for xx in ABI aa
640 +# xx_aa_cflags_maybe flags for xx in ABI aa, if they work
641 +# xx_aa_cppflags cpp flags for xx in ABI aa
642 +# xx_aa_cflags_optlist list of sets of optional flags in ABI aa
643 +# xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa
644 +# xx_aa_ldflags -Wc,-foo flags for libtool linking
645 +# ar_aa_flags extra flags for $AR in ABI aa
646 +# nm_aa_flags extra flags for $NM in ABI aa
647 +# limb_aa limb size in ABI aa, can be "longlong"
648 +# path_aa mpn search path in ABI aa
649 +# extra_functions_aa extra mpn functions in ABI aa
651 +# As a convenience, the unadorned xx_cflags (etc) are used for the last ABI
652 +# in ablist, if an xx_aa_cflags for that ABI isn't given. For example if
653 +# abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but
654 +# for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is
655 +# defined. This makes it easy to add some 64-bit compilers and flags to an
656 +# unadorned 32-bit set.
658 +# limb=longlong (or limb_aa=longlong) applies to all compilers within that
659 +# ABI. It won't work to have some needing long long and some not, since a
660 +# single instantiated gmp.h will be used by both.
662 +# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are
663 +# also set here, with an ABI suffix.
667 +# A table-driven approach like this to mapping cpu type to good compiler
668 +# options is a bit of a maintenance burden, but there's not much uniformity
669 +# between options specifications on different compilers. Some sort of
670 +# separately updatable tool might be cute.
672 +# The use of lots of variables like this, direct and indirect, tends to
673 +# obscure when and how various things are done, but unfortunately it's
674 +# pretty much the only way. If shell subroutines were portable then actual
675 +# code like "if this .. do that" could be written, but attempting the same
676 +# with full copies of GMP_PROG_CC_WORKS etc expanded at every point would
677 +# hugely bloat the output.
680 +AC_ARG_VAR(ABI, [desired ABI (for processors supporting more than one ABI)])
682 +# abilist needs to be non-empty, "standard" is just a generic name here
685 +# FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring
686 +# c89 over cc here. But note that on HP-UX c89 provides a castrated
687 +# environment, and would want to be excluded somehow. Maybe
688 +# AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and
689 +# we don't need to worry.
693 +gcc_cflags="-O2 -pedantic"
694 +gcc_64_cflags="-O2 -pedantic"
698 +SPEED_CYCLECOUNTER_OBJ=
701 +AC_SUBST(HAVE_HOST_CPU_FAMILY_power, 0)
702 +AC_SUBST(HAVE_HOST_CPU_FAMILY_powerpc,0)
707 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_alpha)
709 + alphaev5* | alphapca5*)
710 + path="alpha/ev5 alpha" ;;
711 + alphaev67 | alphaev68 | alphaev7*)
712 + path="alpha/ev67 alpha/ev6 alpha" ;;
714 + path="alpha/ev6 alpha" ;;
718 + if test "$enable_assembly" = "yes" ; then
719 + extra_functions="cntlz"
721 + gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below
722 + gcc_cflags_maybe="-mieee"
723 + gcc_cflags_oldas="-Wa,-oldas" # see GMP_GCC_WA_OLDAS.
725 + # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently.
726 + # gcc 2.95 knows -mcpu= ev4, ev5, ev56, pca56, ev6.
727 + # gcc 3.0 adds nothing.
728 + # gcc 3.1 adds ev45, ev67 (but ev45 is the same as ev4).
729 + # gcc 3.2 adds nothing.
731 + # gcc version "2.9-gnupro-99r1" under "-O2 -mcpu=ev6" strikes internal
732 + # compiler errors too easily and is rejected by GMP_PROG_CC_WORKS. Each
733 + # -mcpu=ev6 below has a fallback to -mcpu=ev56 for this reason.
736 + alpha) gcc_cflags_cpu="-mcpu=ev4" ;;
737 + alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;;
738 + alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;;
739 + alphapca56 | alphapca57)
740 + gcc_cflags_cpu="-mcpu=pca56" ;;
741 + alphaev6) gcc_cflags_cpu="-mcpu=ev6 -mcpu=ev56" ;;
742 + alphaev67 | alphaev68 | alphaev7*)
743 + gcc_cflags_cpu="-mcpu=ev67 -mcpu=ev6 -mcpu=ev56" ;;
746 + # gcc version "2.9-gnupro-99r1" on alphaev68-dec-osf5.1 has been seen
747 + # accepting -mcpu=ev6, but not putting the assembler in the right mode
748 + # for what it produces. We need to do this for it, and need to do it
749 + # before testing the -mcpu options.
751 + # On old versions of gcc, which don't know -mcpu=, we believe an
752 + # explicit -Wa,-mev5 etc will be necessary to put the assembler in
753 + # the right mode for our .asm files and longlong.h asm blocks.
755 + # On newer versions of gcc, when -mcpu= is known, we must give a -Wa
756 + # which is at least as high as the code gcc will generate. gcc
757 + # establishes what it needs with a ".arch" directive, our command line
758 + # option seems to override that.
760 + # gas prior to 2.14 doesn't accept -mev67, but -mev6 seems enough for
761 + # ctlz and cttz (in 2.10.0 at least).
763 + # OSF `as' accepts ev68 but stupidly treats it as ev4. -arch only seems
764 + # to affect insns like ldbu which are expanded as macros when necessary.
765 + # Insns like ctlz which were never available as macros are always
766 + # accepted and always generate their plain code.
769 + alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;;
770 + alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;;
771 + alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;;
772 + alphapca56 | alphapca57)
773 + gcc_cflags_asm="-Wa,-arch,pca56 -Wa,-mpca56" ;;
774 + alphaev6) gcc_cflags_asm="-Wa,-arch,ev6 -Wa,-mev6" ;;
775 + alphaev67 | alphaev68 | alphaev7*)
776 + gcc_cflags_asm="-Wa,-arch,ev67 -Wa,-mev67 -Wa,-arch,ev6 -Wa,-mev6" ;;
779 + # It might be better to ask "cc" whether it's Cray C or DEC C,
780 + # instead of relying on the OS part of $host. But it's hard to
781 + # imagine either of those compilers anywhere except their native
784 + GMP_INCLUDE_MPN(alpha/alpha-defs.m4)
787 + cc_cflags="-O" # no -g, it silently disables all optimizations
788 + GMP_INCLUDE_MPN(alpha/unicos.m4)
789 + # Don't perform any assembly syntax tests on this beast.
790 + gmp_asm_syntax_testing=no
793 + GMP_INCLUDE_MPN(alpha/default.m4)
795 + cc_cflags_optlist="opt cpu"
797 + # not sure if -fast works on old versions, so make it optional
798 + cc_cflags_opt="-fast -O2"
800 + # DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6.
801 + # Compaq C V6.3-029 adds ev67.
804 + alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;;
805 + alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;;
806 + alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;;
807 + alphapca56 | alphapca57)
808 + cc_cflags_cpu="-arch~pca56~-tune~pca56" ;;
809 + alphaev6) cc_cflags_cpu="-arch~ev6~-tune~ev6" ;;
810 + alphaev67 | alphaev68 | alphaev7*)
811 + cc_cflags_cpu="-arch~ev67~-tune~ev67 -arch~ev6~-tune~ev6" ;;
815 + GMP_INCLUDE_MPN(alpha/default.m4)
821 + # tune/alpha.asm assumes int==4bytes but unicos uses int==8bytes
824 + SPEED_CYCLECOUNTER_OBJ=alpha.lo
825 + cyclecounter_size=1 ;;
830 + # Cray vector machines.
831 + # This must come after alpha* so that we can recognize present and future
832 + # vector processors with a wildcard.
834 + gmp_asm_syntax_testing=no
836 + # We used to have -hscalar0 here as a workaround for miscompilation of
837 + # mpz/import.c, but let's hope Cray fixes their bugs instead, since
838 + # -hscalar0 causes disastrously poor code to be generated.
839 + cc_cflags="-O3 -hnofastmd -htask0 -Wa,-B"
844 + arm64*-*-* | aarch64*-*-*)
850 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
851 + gcc_cflags_optlist="arch neon tune"
852 + gcc_cflags_maybe="-marm"
853 + gcc_testlist="gcc-arm-umodsi"
854 + GMP_INCLUDE_MPN(arm/arm-defs.m4)
855 + CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo'
857 + # FIXME: We make mandatory compiler options optional here. We should
858 + # either enforce them, or organise to strip paths as the corresponding
861 + armsa1 | arm9tdmi | armv4*)
863 + gcc_cflags_arch="-march=armv4"
865 + armxscale | arm9te | arm10 | armv5*)
867 + gcc_cflags_arch="-march=armv5"
869 + arm11mpcore | arm1136 | arm1176 | armv6*)
870 + path="arm/v6 arm/v5 arm"
871 + gcc_cflags_arch="-march=armv6"
874 + path="arm/v6t2 arm/v6 arm/v5 arm"
875 + gcc_cflags_arch="-march=armv6t2"
877 + armcortexa5 | armv7a*)
878 + path="arm/v6t2 arm/v6 arm/v5 arm"
879 + gcc_cflags_arch="-march=armv7-a"
882 + path="arm/v6t2 arm/v6 arm/v5 arm"
883 + gcc_cflags_arch="-march=armv7-a"
884 + gcc_cflags_tune="-mtune=cortex-a8"
887 + path="arm/v6t2 arm/v6 arm/v5 arm/neon arm"
888 + gcc_cflags_arch="-march=armv7-a"
889 + gcc_cflags_neon="-mfpu=neon"
890 + gcc_cflags_tune="-mtune=cortex-a8"
893 + path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm"
894 + gcc_cflags_arch="-march=armv7-a"
895 + gcc_cflags_tune="-mtune=cortex-a9"
898 + path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
899 + gcc_cflags_arch="-march=armv7-a"
900 + gcc_cflags_neon="-mfpu=neon"
901 + gcc_cflags_tune="-mtune=cortex-a9"
904 + path="arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm"
905 + gcc_cflags_arch="-march=armv7-a"
906 + gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
909 + path="arm/v7a/cora15/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm/neon arm"
910 + gcc_cflags_arch="-march=armv7-a"
911 + gcc_cflags_neon="-mfpu=neon"
912 + gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9"
922 + [f30[01]-fujitsu-sysv*])
924 + # FIXME: flags for vcc?
931 + # HP cc (the one sold separately) is K&R by default, but AM_C_PROTOTYPES
932 + # will add "-Ae", or "-Aa -D_HPUX_SOURCE", to put it into ansi mode, if
935 + # gcc for hppa 2.0 can be built either for 2.0n (32-bit) or 2.0w
936 + # (64-bit), but not both, so there's no option to choose the desired
937 + # mode, we must instead detect which of the two it is. This is done by
938 + # checking sizeof(long), either 4 or 8 bytes respectively. Do this in
939 + # ABI=1.0 too, in case someone tries to build that with a 2.0w gcc.
941 + gcc_cflags_optlist="arch"
942 + gcc_testlist="sizeof-long-4"
943 + SPEED_CYCLECOUNTER_OBJ=hppa.lo
944 + cyclecounter_size=1
946 + # FIXME: For hppa2.0*, path should be "pa32/hppa2_0 pa32/hppa1_1 pa32".
947 + # (Can't remember why this isn't done already, have to check what .asm
948 + # files are available in each and how they run on a typical 2.0 cpu.)
951 + hppa1.0*) path="pa32" ;;
952 + hppa7000*) path="pa32/hppa1_1 pa32" ;;
954 + path="pa32/hppa2_0 pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;;
955 + *) # default to 7100
956 + path="pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;;
959 + # gcc 2.7.2.3 knows -mpa-risc-1-0 and -mpa-risc-1-1
960 + # gcc 2.95 adds -mpa-risc-2-0, plus synonyms -march=1.0, 1.1 and 2.0
962 + # We don't use -mpa-risc-2-0 in ABI=1.0 because 64-bit registers may not
963 + # be saved by the kernel on an old system. Actually gcc (as of 3.2)
964 + # only adds a few float instructions with -mpa-risc-2-0, so it would
965 + # probably be safe, but let's not take the chance. In any case, a
966 + # configuration like --host=hppa2.0 ABI=1.0 is far from optimal.
969 + hppa1.0*) gcc_cflags_arch="-mpa-risc-1-0" ;;
970 + *) # default to 7100
971 + gcc_cflags_arch="-mpa-risc-1-1" ;;
975 + hppa1.0*) cc_cflags="+O2" ;;
976 + *) # default to 7100
977 + cc_cflags="+DA1.1 +O2" ;;
981 + hppa2.0*-*-* | hppa64-*-*)
982 + cclist_20n="gcc cc"
986 + any_20n_testlist="sizeof-long-4"
987 + SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo
988 + cyclecounter_size_20n=2
990 + # -mpa-risc-2-0 is only an optional flag, in case an old gcc is
991 + # used. Assembler support for 2.0 is essential though, for our asm
993 + gcc_20n_cflags="$gcc_cflags"
994 + gcc_20n_cflags_optlist="arch"
995 + gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
996 + gcc_20n_testlist="sizeof-long-4 hppa-level-2.0"
998 + cc_20n_cflags="+DA2.0 +e +O2 -Wl,+vnocompatwarnings"
999 + cc_20n_testlist="hpc-hppa-2-0"
1001 + # ABI=2.0w is available for hppa2.0w and hppa2.0, but not for
1002 + # hppa2.0n, on the assumption that that the latter indicates a
1003 + # desire for ABI=2.0n.
1007 + # HPUX 10 and earlier cannot run 2.0w. Not sure about other
1008 + # systems (GNU/Linux for instance), but lets assume they're ok.
1010 + [*-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*]) ;;
1011 + [*-*-linux*]) abilist="1.0" ;; # due to linux permanent kernel bug
1012 + *) abilist="2.0w $abilist" ;;
1015 + cclist_20w="gcc cc"
1016 + gcc_20w_cflags="$gcc_cflags -mpa-risc-2-0"
1017 + cc_20w_cflags="+DD64 +O2"
1018 + cc_20w_testlist="hpc-hppa-2-0"
1020 + any_20w_testlist="sizeof-long-8"
1021 + SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo
1022 + cyclecounter_size_20w=2
1032 + GMP_INCLUDE_MPN(ia64/ia64-defs.m4)
1033 + SPEED_CYCLECOUNTER_OBJ=ia64.lo
1034 + any_32_testlist="sizeof-long-4"
1037 + itanium) path="ia64/itanium ia64" ;;
1038 + itanium2) path="ia64/itanium2 ia64" ;;
1042 + gcc_64_cflags_optlist="tune"
1043 + gcc_32_cflags_optlist=$gcc_64_cflags_optlist
1045 + # gcc pre-release 3.4 adds -mtune itanium and itanium2
1047 + itanium) gcc_cflags_tune="-mtune=itanium" ;;
1048 + itanium2) gcc_cflags_tune="-mtune=itanium2" ;;
1054 + icc_cflags="-no-gcc"
1055 + icc_cflags_optlist="opt"
1056 + # Don't use -O3, it is for "large data sets" and also miscompiles GMP.
1057 + # But icc miscompiles GMP at any optimization level, at higher levels
1058 + # it miscompiles more files...
1059 + icc_cflags_opt="-O2 -O1"
1063 + # HP cc sometimes gets internal errors if the optimization level is
1064 + # too high. GMP_PROG_CC_WORKS detects this, the "_opt" fallbacks
1065 + # let us use whatever seems to work.
1068 + any_64_testlist="sizeof-long-8"
1070 + cclist_32="gcc cc"
1073 + cc_32_cflags_optlist="opt"
1074 + cc_32_cflags_opt="+O3 +O2 +O1"
1075 + gcc_32_cflags="$gcc_cflags -milp32"
1077 + SPEED_CYCLECOUNTER_OBJ_32=ia64.lo
1078 + cyclecounter_size_32=2
1080 + # Must have +DD64 in CPPFLAGS to get the right __LP64__ for headers,
1081 + # but also need it in CFLAGS for linking programs, since automake
1082 + # only uses CFLAGS when linking, not CPPFLAGS.
1083 + # FIXME: Maybe should use cc_64_ldflags for this, but that would
1084 + # need GMP_LDFLAGS used consistently by all the programs.
1086 + cc_64_cflags="+DD64"
1087 + cc_64_cppflags="+DD64"
1088 + cc_64_cflags_optlist="opt"
1089 + cc_64_cflags_opt="+O3 +O2 +O1"
1090 + gcc_64_cflags="$gcc_cflags -mlp64"
1099 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_m68k)
1100 + GMP_INCLUDE_MPN(m68k/m68k-defs.m4)
1101 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
1102 + gcc_cflags_optlist="arch"
1104 + # gcc 2.7.2 knows -m68000, -m68020, -m68030, -m68040.
1105 + # gcc 2.95 adds -mcpu32, -m68060.
1106 + # FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2.
1109 + m68020) gcc_cflags_arch="-m68020" ;;
1110 + m68030) gcc_cflags_arch="-m68030" ;;
1111 + m68040) gcc_cflags_arch="-m68040" ;;
1112 + m68060) gcc_cflags_arch="-m68060 -m68000" ;;
1113 + m68360) gcc_cflags_arch="-mcpu32 -m68000" ;;
1114 + *) gcc_cflags_arch="-m68000" ;;
1117 + # FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be
1118 + # tested. Will need to introduce an m68k/cpu32 if m68k/mc68020 ever uses
1119 + # the bitfield instructions.
1121 + [m680[234]0 | m68360]) path="m68k/mc68020 m68k" ;;
1132 + gcc_cflags="$gcc_cflags -m88110"
1133 + path="m88k/mc88110 m88k"
1137 + # IRIX 5 and earlier can only run 32-bit o32.
1139 + # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64. n32 is
1140 + # preferred over 64, but only because that's been the default in past
1141 + # versions of GMP. The two are equally efficient.
1143 + # Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not
1144 + # supporting n32 or 64.
1146 + # For reference, libtool (eg. 1.5.6) recognises the n32 ABI and knows the
1147 + # right options to use when linking (both cc and gcc), so no need for
1148 + # anything special from us.
1152 + gcc_cflags_optlist="abi"
1153 + gcc_cflags_abi="-mabi=32"
1154 + gcc_testlist="gcc-mips-o32"
1156 + cc_cflags="-O2 -o32" # no -g, it disables all optimizations
1157 + # this suits both mips32 and mips64
1158 + GMP_INCLUDE_MPN(mips32/mips-defs.m4)
1161 + [mips64*-*-* | mips*-*-irix[6789]*])
1162 + abilist="n32 64 o32"
1164 + cclist_n32="gcc cc"
1165 + gcc_n32_cflags="$gcc_cflags -mabi=n32"
1166 + cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
1170 + cclist_64="gcc cc"
1171 + gcc_64_cflags="$gcc_cflags -mabi=64"
1172 + gcc_64_ldflags="-Wc,-mabi=64"
1173 + cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
1174 + cc_64_ldflags="-Wc,-64"
1181 + # Darwin (powerpc-apple-darwin1.3) has it's hacked gcc installed as cc.
1182 + # Our usual "gcc in disguise" detection means gcc_cflags etc here gets
1185 + # The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp
1186 + # since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h,
1187 + # and so always ends up running the plain preprocessor anyway. This could
1188 + # be done in CPPFLAGS rather than CFLAGS, but there's not many places
1189 + # preprocessing is done separately, and this is only a speedup, the normal
1190 + # preprocessor gets run if there's any problems.
1192 + # We used to use -Wa,-mppc with gcc, but can't remember exactly why.
1193 + # Presumably it was for old versions of gcc where -mpowerpc doesn't put
1194 + # the assembler in the right mode. In any case -Wa,-mppc is not good, for
1195 + # instance -mcpu=604 makes recent gcc use -m604 to get access to the
1196 + # "fsel" instruction, but a -Wa,-mppc overrides that, making code that
1197 + # comes out with fsel fail.
1199 + # (Note also that the darwin assembler doesn't accept "-mppc", so any
1200 + # -Wa,-mppc was used only if it worked. The right flag on darwin would be
1201 + # "-arch ppc" or some such, but that's already the default.)
1203 + [powerpc*-*-* | power[3-9]-*-*])
1204 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_powerpc)
1205 + HAVE_HOST_CPU_FAMILY_powerpc=1
1209 + gcc_32_cflags="$gcc_cflags -mpowerpc"
1210 + gcc_cflags_optlist="precomp subtype asm cpu"
1211 + gcc_cflags_precomp="-no-cpp-precomp"
1212 + gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin
1217 + # grab this object, though it's not a true cycle counter routine
1218 + SPEED_CYCLECOUNTER_OBJ=powerpc.lo
1219 + cyclecounter_size=0
1222 + powerpc740 | powerpc750)
1223 + path="powerpc32/750 powerpc32" ;;
1224 + powerpc7400 | powerpc7410)
1225 + path="powerpc32/vmx powerpc32/750 powerpc32" ;;
1227 + path="powerpc32/vmx powerpc32" ;;
1229 + path="powerpc32" ;;
1233 + powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
1234 + powerpc403) gcc_cflags_cpu="-mcpu=403"
1235 + xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
1236 + powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
1237 + powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
1238 + powerpc601) gcc_cflags_cpu="-mcpu=601"
1239 + xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
1240 + powerpc602) gcc_cflags_cpu="-mcpu=602"
1241 + xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
1242 + powerpc603) gcc_cflags_cpu="-mcpu=603"
1243 + xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
1244 + powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603"
1245 + xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
1246 + powerpc604) gcc_cflags_cpu="-mcpu=604"
1247 + xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
1248 + powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604"
1249 + xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
1250 + powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
1251 + powerpc630) gcc_cflags_cpu="-mcpu=630"
1252 + xlc_cflags_arch="-qarch=pwr3"
1253 + cpu_path="p3 p3-p7" ;;
1254 + powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
1255 + powerpc7400 | powerpc7410)
1256 + gcc_cflags_asm="-Wa,-maltivec"
1257 + gcc_cflags_cpu="-mcpu=7400 -mcpu=750" ;;
1259 + gcc_cflags_asm="-Wa,-maltivec"
1260 + gcc_cflags_cpu="-mcpu=7450" ;;
1261 + powerpc750) gcc_cflags_cpu="-mcpu=750" ;;
1262 + powerpc801) gcc_cflags_cpu="-mcpu=801" ;;
1263 + powerpc821) gcc_cflags_cpu="-mcpu=821" ;;
1264 + powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
1265 + powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
1266 + powerpc970) gcc_cflags_cpu="-mtune=970"
1267 + xlc_cflags_arch="-qarch=970 -qarch=pwr3"
1268 + vmx_path="powerpc64/vmx"
1269 + cpu_path="p4 p3-p7" ;;
1270 + power4) gcc_cflags_cpu="-mtune=power4"
1271 + xlc_cflags_arch="-qarch=pwr4"
1272 + cpu_path="p4 p3-p7" ;;
1273 + power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4"
1274 + xlc_cflags_arch="-qarch=pwr5"
1275 + cpu_path="p5 p4 p3-p7" ;;
1276 + power6) gcc_cflags_cpu="-mtune=power6"
1277 + xlc_cflags_arch="-qarch=pwr6"
1278 + cpu_path="p6 p3-p7" ;;
1279 + power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5"
1280 + xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5"
1281 + cpu_path="p7 p5 p4 p3-p7" ;;
1286 + cclist="gcc xlc cc"
1287 + gcc_32_cflags_maybe="-maix32"
1288 + xlc_cflags="-O2 -qmaxmem=20000"
1289 + xlc_cflags_optlist="arch"
1290 + xlc_32_cflags_maybe="-q32"
1291 + ar_32_flags="-X32"
1292 + nm_32_flags="-X32"
1296 + POWERPC64_PATTERN)
1299 + # On AIX a true 64-bit ABI is available.
1300 + # Need -Wc to pass object type flags through to the linker.
1301 + abilist="mode64 $abilist"
1302 + cclist_mode64="gcc xlc"
1303 + gcc_mode64_cflags="$gcc_cflags -maix64 -mpowerpc64"
1304 + gcc_mode64_cflags_optlist="cpu"
1305 + gcc_mode64_ldflags="-Wc,-maix64"
1306 + xlc_mode64_cflags="-O2 -q64 -qmaxmem=20000"
1307 + xlc_mode64_cflags_optlist="arch"
1308 + xlc_mode64_ldflags="-Wc,-q64"
1309 + # Must indicate object type to ar and nm
1310 + ar_mode64_flags="-X64"
1311 + nm_mode64_flags="-X64"
1314 + for i in $cpu_path
1315 + do path_mode64="${path_mode64}powerpc64/mode64/$i "
1316 + path_mode64="${path_mode64}powerpc64/$i "
1317 + p="${p} powerpc32/$i "
1319 + path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
1321 + # grab this object, though it's not a true cycle counter routine
1322 + SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
1323 + cyclecounter_size_mode64=0
1326 + # On Darwin we can use 64-bit instructions with a longlong limb,
1327 + # but the chip still in 32-bit mode.
1328 + # In theory this can be used on any OS which knows how to save
1329 + # 64-bit registers in a context switch.
1331 + # Note that we must use -mpowerpc64 with gcc, since the
1332 + # longlong.h macros expect limb operands in a single 64-bit
1333 + # register, not two 32-bit registers as would be given for a
1334 + # long long without -mpowerpc64. In theory we could detect and
1335 + # accommodate both styles, but the proper 64-bit registers will
1336 + # be fastest and are what we really want to use.
1338 + # One would think -mpowerpc64 would set the assembler in the right
1339 + # mode to handle 64-bit instructions. But for that, also
1340 + # -force_cpusubtype_ALL is needed.
1342 + # Do not use -fast for Darwin, it actually adds options
1343 + # incompatible with a shared library.
1345 + abilist="mode64 mode32 $abilist"
1346 + gcc_32_cflags_maybe="-m32"
1347 + gcc_cflags_opt="-O3 -O2 -O1" # will this become used?
1348 + cclist_mode32="gcc"
1349 + gcc_mode32_cflags_maybe="-m32"
1350 + gcc_mode32_cflags="-mpowerpc64"
1351 + gcc_mode32_cflags_optlist="subtype cpu opt"
1352 + gcc_mode32_cflags_subtype="-force_cpusubtype_ALL"
1353 + gcc_mode32_cflags_opt="-O3 -O2 -O1"
1354 + limb_mode32=longlong
1355 + cclist_mode64="gcc"
1356 + gcc_mode64_cflags="-m64"
1357 + gcc_mode64_cflags_optlist="cpu opt"
1358 + gcc_mode64_cflags_opt="-O3 -O2 -O1"
1362 + for i in $cpu_path
1363 + do path_mode64="${path_mode64}powerpc64/mode64/$i "
1364 + path_mode64="${path_mode64}powerpc64/$i "
1365 + path_mode32="${path_mode32}powerpc64/mode32/$i "
1366 + path_mode32="${path_mode32}powerpc64/$i "
1367 + p="${p} powerpc32/$i "
1369 + path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
1370 + path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
1372 + SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
1373 + cyclecounter_size_mode64=0
1374 + any_mode64_testlist="sizeof-long-8"
1376 + *-*-linux* | *-*-*bsd*)
1377 + # On GNU/Linux, assume the processor is in 64-bit mode. Some
1378 + # environments have a gcc that is always in 64-bit mode, while
1379 + # others require -m64, hence the use of cflags_maybe. The
1380 + # sizeof-long-8 test checks the mode is right (for the no option
1383 + # -mpowerpc64 is not used, since it should be the default in
1384 + # 64-bit mode. (We need its effect for the various longlong.h
1385 + # asm macros to be right of course.)
1387 + # gcc64 was an early port of gcc to 64-bit mode, but should be
1388 + # obsolete before too long. We prefer plain gcc when it knows
1391 + abilist="mode64 mode32 $abilist"
1392 + gcc_32_cflags_maybe="-m32"
1393 + cclist_mode32="gcc"
1394 + gcc_mode32_cflags_maybe="-m32"
1395 + gcc_mode32_cflags="-mpowerpc64"
1396 + gcc_mode32_cflags_optlist="cpu opt"
1397 + gcc_mode32_cflags_opt="-O3 -O2 -O1"
1398 + limb_mode32=longlong
1399 + cclist_mode64="gcc gcc64"
1400 + gcc_mode64_cflags_maybe="-m64"
1401 + gcc_mode64_cflags_optlist="cpu opt"
1402 + gcc_mode64_cflags_opt="-O3 -O2 -O1"
1406 + for i in $cpu_path
1407 + do path_mode64="${path_mode64}powerpc64/mode64/$i "
1408 + path_mode64="${path_mode64}powerpc64/$i "
1409 + path_mode32="${path_mode32}powerpc64/mode32/$i "
1410 + path_mode32="${path_mode32}powerpc64/$i "
1411 + p="${p} powerpc32/$i "
1413 + path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
1414 + path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
1416 + SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
1417 + cyclecounter_size_mode64=0
1418 + any_mode64_testlist="sizeof-long-8"
1427 + [power-*-* | power[12]-*-* | power2sc-*-*])
1428 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
1429 + HAVE_HOST_CPU_FAMILY_power=1
1431 + extra_functions="udiv_w_sdiv"
1434 + # gcc 2.7.2 knows rios1, rios2, rsc
1436 + # -mcpu=rios2 can tickle an AIX assembler bug (see GMP_PROG_CC_WORKS) so
1437 + # there needs to be a fallback to just -mpower.
1439 + gcc_cflags_optlist="cpu"
1441 + power-*-*) gcc_cflags_cpu="-mcpu=power -mpower" ;;
1442 + power1-*-*) gcc_cflags_cpu="-mcpu=rios1 -mpower" ;;
1443 + power2-*-*) gcc_cflags_cpu="-mcpu=rios2 -mpower" ;;
1444 + power2sc-*-*) gcc_cflags_cpu="-mcpu=rsc -mpower" ;;
1449 + xlc_cflags="-O2 -qarch=pwr -qmaxmem=20000"
1455 + # IBM System/390 and z/Architecture
1456 + S390_PATTERN | S390X_PATTERN)
1458 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
1459 + gcc_cflags_optlist="arch"
1461 + extra_functions="udiv_w_sdiv"
1462 + gcc_32_cflags_maybe="-m31"
1470 + path="s390_32/esame/$cpu s390_32/esame s390_32"
1471 + gcc_cflags_arch="-march=$gccarch"
1472 + AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
1473 + AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
1474 + extra_functions=""
1479 + path="s390_32/esame/$cpu s390_32/esame s390_32"
1480 + gcc_cflags_arch="-march=$gccarch"
1481 + AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
1482 + AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
1483 + extra_functions=""
1488 + path="s390_32/esame/$cpu s390_32/esame s390_32"
1489 + gcc_cflags_arch="-march=$gccarch"
1490 + AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
1491 + AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
1492 + extra_functions=""
1497 + path="s390_32/esame/$cpu s390_32/esame s390_32"
1498 + gcc_cflags_arch="-march=$gccarch"
1499 + AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
1500 + AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
1501 + extra_functions=""
1506 + path="s390_32/esame/$cpu s390_32/esame s390_32"
1507 + gcc_cflags_arch="-march=$gccarch"
1508 + AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
1509 + AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
1510 + extra_functions=""
1518 + gcc_64_cflags_optlist="arch"
1519 + gcc_64_cflags="$gcc_cflags -m64"
1520 + path_64="s390_64/$host_cpu s390_64"
1521 + extra_functions=""
1527 + sh-*-*) path="sh" ;;
1528 + [sh[2-4]-*-*]) path="sh/sh2 sh" ;;
1532 + # sizeof(long)==4 or 8 is tested, to ensure we get the right ABI. We've
1533 + # had various bug reports where users have set CFLAGS for their desired
1534 + # mode, but not set our ABI. For some reason it's sparc where this
1535 + # keeps coming up, presumably users there are accustomed to driving the
1536 + # compiler mode that way. The effect of our testlist setting is to
1537 + # reject ABI=64 in favour of ABI=32 if the user has forced the flags to
1541 + cclist="gcc acc cc"
1542 + any_testlist="sizeof-long-4"
1543 + GMP_INCLUDE_MPN(sparc32/sparc-defs.m4)
1546 + sparcv8 | microsparc | turbosparc)
1547 + path="sparc32/v8 sparc32" ;;
1549 + path="sparc32/v8/supersparc sparc32/v8 sparc32" ;;
1550 + [sparc64 | sparcv9* | ultrasparc | ultrasparc[234]*])
1551 + path="sparc32/v9 sparc32/v8 sparc32" ;;
1552 + [ultrasparct[12345]])
1553 + path="sparc32/ultrasparct1 sparc32/v8 sparc32" ;;
1558 + # gcc 2.7.2 doesn't know about v9 and doesn't pass -xarch=v8plus to the
1559 + # assembler. Add it explicitly since the solaris assembler won't accept
1560 + # our sparc32/v9 asm code without it. gas accepts -xarch=v8plus too, so
1561 + # it can be in the cflags unconditionally (though gas doesn't need it).
1563 + # gcc -m32 is needed to force 32-bit mode on a dual-ABI system, but past
1564 + # gcc doesn't know that flag, hence cflags_maybe. Note that -m32 cannot
1565 + # be done through the optlist since the plain cflags would be run first
1566 + # and we don't want to require the default mode (whatever it is) works.
1568 + # Note it's gcc_32_cflags_maybe and not gcc_cflags_maybe because the
1569 + # latter would be used in the 64-bit ABI on systems like "*bsd" where
1570 + # abilist="64" only.
1572 + gcc_32_cflags_maybe="-m32"
1573 + gcc_cflags_optlist="cpu asm"
1575 + # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite.
1576 + # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934,
1577 + # sparclet, tsc701, v9, ultrasparc. A warning is given that the
1578 + # plain -m forms will disappear.
1579 + # gcc 3.3 adds ultrasparc3.
1583 + gcc_cflags_cpu="-mcpu=supersparc -msupersparc"
1584 + gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
1585 + sparcv8 | microsparc* | turbosparc | hypersparc*)
1586 + gcc_cflags_cpu="-mcpu=v8 -mv8"
1587 + gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";;
1588 + sparc64 | sparcv9*)
1589 + gcc_cflags_cpu="-mcpu=v9"
1590 + gcc_32_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8plus"
1591 + gcc_64_cflags_asm="-Wa,-Av9 -Wa,-xarch=v9";;
1592 + ultrasparc1 | ultrasparc2*)
1593 + gcc_cflags_cpu="-mcpu=ultrasparc -mcpu=v9"
1594 + gcc_32_cflags_asm="-Wa,-Av8plusa -Wa,-xarch=v8plusa"
1595 + gcc_64_cflags_asm="-Wa,-Av9a -Wa,-xarch=v9a";;
1597 + gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mcpu=v9"
1598 + gcc_32_cflags_asm="-Wa,-Av8plusb -Wa,-xarch=v8plusb"
1599 + gcc_64_cflags_asm="-Wa,-Av9b -Wa,-xarch=v9b";;
1600 + [ultrasparct[12]])
1601 + gcc_cflags_cpu="-mcpu=niagara -mcpu=v9"
1602 + gcc_32_cflags_asm="-Wa,-Av8plusc -Wa,-xarch=v8plusc"
1603 + gcc_64_cflags_asm="-Wa,-Av9c -Wa,-xarch=v9c";;
1605 + gcc_cflags_cpu="-mcpu=niagara3 -mcpu=niagara -mcpu=v9"
1606 + gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
1607 + gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
1609 + gcc_cflags_cpu="-mcpu=niagara4 -mcpu=niagara3 -mcpu=niagara -mcpu=v9"
1610 + gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd"
1611 + gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";;
1613 + gcc_cflags_cpu="-mcpu=v7 -mcypress"
1614 + gcc_cflags_asm="";;
1617 + # SunPRO cc and acc, and SunOS bundled cc
1619 + *-*-solaris* | *-*-sunos*)
1620 + # Note no -g, it disables all optimizations.
1622 + cc_cflags_optlist="opt arch cpu"
1624 + # SunOS cc doesn't know -xO4, fallback to -O2.
1625 + cc_cflags_opt="-xO4 -O2"
1627 + # SunOS cc doesn't know -xarch, apparently always generating v7
1628 + # code, so make this optional
1630 + sparcv8 | microsparc* | supersparc* | turbosparc | hypersparc*)
1631 + cc_cflags_arch="-xarch=v8";;
1632 + [ultrasparct[345]])
1633 + cc_cflags_arch="-xarch=v8plusd" ;;
1634 + sparc64 | sparcv9* | ultrasparc*)
1635 + cc_cflags_arch="-xarch=v8plus" ;;
1637 + cc_cflags_arch="-xarch=v7" ;;
1640 + # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent.
1641 + # SunPRO cc 5 recognises -xchip=generic, old, super, super2, micro,
1642 + # micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i.
1643 + # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu.
1646 + supersparc*) cc_cflags_cpu="-xchip=super" ;;
1647 + microsparc*) cc_cflags_cpu="-xchip=micro" ;;
1648 + turbosparc) cc_cflags_cpu="-xchip=micro2" ;;
1649 + hypersparc*) cc_cflags_cpu="-xchip=hyper" ;;
1650 + ultrasparc) cc_cflags_cpu="-xchip=ultra" ;;
1651 + ultrasparc2) cc_cflags_cpu="-xchip=ultra2 -xchip=ultra" ;;
1652 + ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;;
1653 + ultrasparc3) cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;;
1654 + ultrasparc4) cc_cflags_cpu="-xchip=ultra4 -xchip=ultra3 -xchip=ultra" ;;
1655 + ultrasparct1) cc_cflags_cpu="-xchip=ultraT1" ;;
1656 + ultrasparct2) cc_cflags_cpu="-xchip=ultraT2 -xchip=ultraT1" ;;
1657 + ultrasparct3) cc_cflags_cpu="-xchip=ultraT3 -xchip=ultraT2" ;;
1658 + ultrasparct4) cc_cflags_cpu="-xchip=T4" ;;
1659 + ultrasparct5) cc_cflags_cpu="-xchip=T5 -xchip=T4" ;;
1660 + *) cc_cflags_cpu="-xchip=generic" ;;
1665 + sparc64 | sparcv9* | ultrasparc*)
1667 + # Solaris 6 and earlier cannot run ABI=64 since it doesn't save
1668 + # registers properly, so ABI=32 is left as the only choice.
1670 + [*-*-solaris2.[0-6] | *-*-solaris2.[0-6].*]) ;;
1672 + # BSD sparc64 ports are 64-bit-only systems, so ABI=64 is the only
1673 + # choice. In fact they need no special compiler flags, gcc -m64
1674 + # is the default, but it doesn't hurt to add it. v9 CPUs always
1675 + # use the sparc64 port, since the plain 32-bit sparc ports don't
1678 + *-*-*bsd*) abilist="64" ;;
1680 + # For all other systems, we try both 64 and 32.
1682 + # GNU/Linux sparc64 has only recently gained a 64-bit user mode.
1683 + # In the past sparc64 meant a v9 cpu, but there were no 64-bit
1684 + # operations in user mode. We assume that if "gcc -m64" works
1685 + # then the system is suitable. Hopefully even if someone attempts
1686 + # to put a new gcc and/or glibc on an old system it won't run.
1688 + *) abilist="64 32" ;;
1692 + ultrasparc | ultrasparc2 | ultrasparc2i)
1693 + path_64="sparc64/ultrasparc1234 sparc64" ;;
1695 + path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
1696 + [ultrasparct[12]])
1697 + path_64="sparc64/ultrasparct1 sparc64" ;;
1698 + [ultrasparct[345]])
1699 + path_64="sparc64/ultrasparct3 sparc64" ;;
1705 + any_64_testlist="sizeof-long-8"
1707 + # gcc -mptr64 is probably implied by -m64, but we're not sure if
1708 + # this was always so. On Solaris in the past we always used both
1711 + # gcc -Wa,-xarch=v9 is thought to be necessary in some cases on
1712 + # solaris, but it would seem likely that if gcc is going to generate
1713 + # 64-bit code it will have to add that option itself where needed.
1714 + # An extra copy of this option should be harmless though, but leave
1715 + # it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the
1716 + # higher cpu types instead.)
1718 + gcc_64_cflags="$gcc_cflags -m64 -mptr64"
1719 + gcc_64_ldflags="-Wc,-m64"
1720 + gcc_64_cflags_optlist="cpu asm"
1726 + # We used to have -fast and some fixup options here, but it
1727 + # recurrently caused problems with miscompilation. Of course,
1728 + # -fast is documented as miscompiling things for the sake of speed.
1730 + cclist_64="$cclist_64 cc"
1731 + cc_64_cflags_optlist="cpu"
1733 + [ultrasparct[345]])
1734 + cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;;
1736 + cc_64_cflags="-xO3 -xarch=v9" ;;
1741 + # using the v9 %tick register
1742 + SPEED_CYCLECOUNTER_OBJ_32=sparcv9.lo
1743 + SPEED_CYCLECOUNTER_OBJ_64=sparcv9.lo
1744 + cyclecounter_size_32=2
1745 + cyclecounter_size_64=2
1753 + # Use elf conventions (i.e., '%' register prefix, no global prefix)
1755 + GMP_INCLUDE_MPN(vax/elf.m4)
1756 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
1758 + extra_functions="udiv_w_sdiv"
1761 + # Default to aout conventions (i.e., no register prefix, '_' global prefix)
1763 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
1765 + extra_functions="udiv_w_sdiv"
1769 + # AMD and Intel x86 configurations, including AMD64
1771 + # Rumour has it gcc -O2 used to give worse register allocation than just
1772 + # -O, but lets assume that's no longer true.
1774 + # -m32 forces 32-bit mode on a bi-arch 32/64 amd64 build of gcc. -m64 is
1775 + # the default in such a build (we think), so -m32 is essential for ABI=32.
1776 + # This is, of course, done for any $host_cpu, not just x86_64, so we can
1777 + # get such a gcc into the right mode to cross-compile to say i486-*-*.
1779 + # -m32 is not available in gcc 2.95 and earlier, hence cflags_maybe to use
1780 + # it when it works. We check sizeof(long)==4 to ensure we get the right
1781 + # mode, in case -m32 has failed not because it's an old gcc, but because
1782 + # it's a dual 32/64-bit gcc without a 32-bit libc, or whatever.
1784 + X86_PATTERN | X86_64_PATTERN)
1786 + cclist="gcc icc cc"
1787 + gcc_cflags="$gcc_cflags $fomit_frame_pointer"
1788 + gcc_32_cflags_maybe="-m32"
1789 + icc_cflags="-no-gcc"
1790 + icc_cflags_optlist="opt"
1791 + icc_cflags_opt="-O3 -O2 -O1"
1792 + any_32_testlist="sizeof-long-4"
1793 + CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo'
1795 + # Availability of rdtsc is checked at run-time.
1796 + SPEED_CYCLECOUNTER_OBJ=pentium.lo
1798 + # gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These
1799 + # represent -mcpu= since -m486 doesn't generate 486 specific insns.
1800 + # gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=.
1801 + # gcc 3.0 adds athlon.
1802 + # gcc 3.1 adds k6-2, k6-3, pentium-mmx, pentium2, pentium3, pentium4,
1803 + # athlon-tbird, athlon-4, athlon-xp, athlon-mp.
1804 + # gcc 3.2 adds winchip2.
1805 + # gcc 3.3 adds winchip-c6.
1806 + # gcc 3.3.1 from mandrake adds k8 and knows -mtune.
1807 + # gcc 3.4 adds c3, c3-2, k8, and deprecates -mcpu in favour of -mtune.
1809 + # In gcc 2.95.[0123], -march=pentiumpro provoked a stack slot bug in an
1810 + # old version of mpz/powm.c. Seems to be fine with the current code, so
1811 + # no need for any restrictions on that option.
1813 + # -march=pentiumpro can fail if the assembler doesn't know "cmov"
1814 + # (eg. solaris 2.8 native "as"), so always have -march=pentium after
1815 + # that as a fallback.
1817 + # -march=pentium4 and -march=k8 enable SSE2 instructions, which may or
1818 + # may not be supported by the assembler and/or the OS, and is bad in gcc
1819 + # prior to 3.3. The tests will reject these if no good, so fallbacks
1820 + # like "-march=pentium4 -mno-sse2" are given to try also without SSE2.
1821 + # Note the relevant -march types are listed in the optflags handling
1822 + # below, be sure to update there if adding new types emitting SSE2.
1824 + # -mtune is used at the start of each cpu option list to give something
1825 + # gcc 3.4 will use, thereby avoiding warnings from -mcpu. -mcpu forms
1826 + # are retained for use by prior gcc. For example pentium has
1827 + # "-mtune=pentium -mcpu=pentium ...", the -mtune is for 3.4 and the
1828 + # -mcpu for prior. If there's a brand new choice in 3.4 for a chip,
1829 + # like k8 for x86_64, then it can be the -mtune at the start, no need to
1830 + # duplicate anything.
1832 + gcc_cflags_optlist="cpu arch"
1835 + gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
1836 + gcc_cflags_arch="-march=i386"
1840 + gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
1841 + gcc_cflags_arch="-march=i486"
1842 + path="x86/i486 x86"
1845 + gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
1846 + gcc_cflags_arch="-march=pentium"
1847 + path="x86/pentium x86"
1850 + gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
1851 + gcc_cflags_arch="-march=pentium-mmx -march=pentium"
1852 + path="x86/pentium/mmx x86/pentium x86/mmx x86"
1854 + i686 | pentiumpro)
1855 + gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
1856 + gcc_cflags_arch="-march=pentiumpro -march=pentium"
1860 + gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
1861 + gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
1862 + path="x86/p6/mmx x86/p6 x86/mmx x86"
1865 + gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
1866 + gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
1867 + path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1870 + gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
1871 + gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
1872 + path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1875 + gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
1876 + gcc_cflags_arch="-march=k6"
1877 + path="x86/k6/mmx x86/k6 x86/mmx x86"
1880 + gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
1881 + gcc_cflags_arch="-march=k6-2 -march=k6"
1882 + path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
1885 + gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
1886 + gcc_cflags_arch="-march=k6-3 -march=k6"
1887 + path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
1890 + gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
1891 + gcc_cflags_arch="-march=k6-3 -march=k6"
1892 + path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86"
1895 + # Athlon instruction costs are close to P6 (3 cycle load latency,
1896 + # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
1897 + # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
1898 + gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
1899 + gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
1900 + path="x86/k7/mmx x86/k7 x86/mmx x86"
1903 + # pentiumpro is the primary fallback when gcc doesn't know pentium4.
1904 + # This gets us cmov to eliminate branches. Maybe "athlon" would be
1905 + # a possibility on gcc 3.0.
1907 + gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
1908 + gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
1909 + gcc_64_cflags_cpu="-mtune=nocona"
1910 + path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86/mmx x86"
1911 + path_64="x86_64/pentium4 x86_64"
1914 + # Not sure of the best fallbacks here for -mcpu.
1915 + # c3-2 has sse and mmx, so pentium3 is good for -march.
1916 + gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
1917 + gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
1918 + path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1921 + # Not sure of the best fallbacks here.
1922 + gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
1923 + gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
1924 + path="x86/pentium/mmx x86/pentium x86/mmx x86"
1926 + athlon64 | k8 | x86_64)
1927 + gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
1928 + gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
1929 + path="x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
1930 + path_64="x86_64/k8 x86_64"
1933 + gcc_cflags_cpu="-mtune=amdfam10 -mtune=k8"
1934 + gcc_cflags_arch="-march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1935 + path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86/mmx x86"
1936 + path_64="x86_64/k10 x86_64/k8 x86_64"
1939 + gcc_cflags_cpu="-mtune=btver1 -mtune=amdfam10 -mtune=k8"
1940 + gcc_cflags_arch="-march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1941 + path="x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
1942 + path_64="x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
1945 + gcc_cflags_cpu="-mtune=btver2 -mtune=btver1 -mtune=amdfam10 -mtune=k8"
1946 + gcc_cflags_arch="-march=btver2 -march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1947 + path="x86/jaguar x86/bobcat x86/k7/mmx x86/k7 x86/mmx x86"
1948 + path_64="x86_64/jaguar x86_64/bobcat x86_64/k10 x86_64/k8 x86_64"
1951 + gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8"
1952 + gcc_cflags_arch="-march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1953 + path="x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
1954 + path_64="x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
1957 + gcc_cflags_cpu="-mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
1958 + gcc_cflags_arch="-march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1959 + path="x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
1960 + path_64="x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
1962 + steamroller | bd3)
1963 + gcc_cflags_cpu="-mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
1964 + gcc_cflags_arch="-march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1965 + path="x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
1966 + path_64="x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
1969 + gcc_cflags_cpu="-mtune=bdver4 -mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8"
1970 + gcc_cflags_arch="-march=bdver4 -march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2"
1971 + path="x86/bd4 x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86"
1972 + path_64="x86_64/bd4 x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64"
1975 + gcc_cflags_cpu="-mtune=core2 -mtune=k8"
1976 + gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
1977 + path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1978 + path_64="x86_64/core2 x86_64"
1980 + corei | coreinhm | coreiwsm)
1981 + gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
1982 + gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
1983 + path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1984 + path_64="x86_64/coreinhm x86_64/core2 x86_64"
1987 + gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
1988 + gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
1989 + path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1990 + path_64="x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
1993 + gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
1994 + gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
1995 + path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
1996 + path_64="x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
1999 + gcc_cflags_cpu="-mtune=corei7 -mtune=core2 -mtune=k8"
2000 + gcc_cflags_arch="-march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
2001 + path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86"
2002 + path_64="x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64"
2003 + # extra_functions_64="missing" # enable for bmi2/adx simulation
2006 + gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
2007 + gcc_cflags_arch="-march=atom -march=pentium3"
2008 + path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86"
2009 + path_64="x86_64/atom x86_64"
2012 + gcc_cflags_cpu="-mtune=nano"
2013 + gcc_cflags_arch="-march=nano"
2014 + path="x86/nano x86/mmx x86"
2015 + path_64="x86_64/nano x86_64"
2018 + gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
2019 + gcc_cflags_arch="-march=i486"
2027 + cclist_64="gcc cc"
2028 + gcc_64_cflags="$gcc_cflags -m64"
2029 + gcc_64_cflags_optlist="cpu arch"
2030 + CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
2031 + SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
2032 + cyclecounter_size_64=2
2034 + cclist_x32="gcc cc"
2035 + gcc_x32_cflags="$gcc_cflags -mx32"
2036 + gcc_x32_cflags_optlist="$gcc_64_cflags_optlist"
2037 + CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64"
2038 + SPEED_CYCLECOUNTER_OBJ_x32="$SPEED_CYCLECOUNTER_OBJ_64"
2039 + cyclecounter_size_x32="$cyclecounter_size_64"
2040 + path_x32="$path_64"
2042 + any_x32_testlist="sizeof-long-4"
2044 + abilist="64 x32 32"
2045 + if test "$enable_assembly" = "yes" ; then
2046 + extra_functions_64="$extra_functions_64 invert_limb_table"
2047 + extra_functions_x32=$extra_functions_64
2053 + cc_64_cflags="-xO3 -m64"
2055 + *-*-mingw* | *-*-cygwin)
2057 + CALLING_CONVENTIONS_OBJS_64=""
2058 + AC_DEFINE(HOST_DOS64,1,[Define to 1 for Windos/64])
2059 + GMP_NONSTD_ABI_64=DOS64
2067 + # Special CPU "none" used to select generic C, now this is obsolete.
2069 + enable_assembly=no
2070 + AC_MSG_WARN([the \"none\" host is obsolete, use --disable-assembly])
2075 +# mingw can be built by the cygwin gcc if -mno-cygwin is added. For
2076 +# convenience add this automatically if it works. Actual mingw gcc accepts
2077 +# -mno-cygwin too, but of course is the default. mingw only runs on the
2078 +# x86s, but allow any CPU here so as to catch "none" too.
2082 + gcc_cflags_optlist="$gcc_cflags_optlist nocygwin"
2083 + gcc_cflags_nocygwin="-mno-cygwin"
2088 +CFLAGS_or_unset=${CFLAGS-'(unset)'}
2089 +CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'}
2091 +cat >&AC_FD_CC <<EOF
2095 +CFLAGS=$CFLAGS_or_unset
2096 +CPPFLAGS=$CPPFLAGS_or_unset
2104 +test_CFLAGS=${CFLAGS+set}
2105 +test_CPPFLAGS=${CPPFLAGS+set}
2107 +for abi in $abilist; do
2111 +# If the user specifies an ABI then it must be in $abilist, after that
2112 +# $abilist is restricted to just that choice.
2114 +if test -n "$ABI"; then
2116 + for abi in $abilist; do
2117 + if test $abi = "$ABI"; then found=yes; break; fi
2119 + if test $found = no; then
2120 + AC_MSG_ERROR([ABI=$ABI is not among the following valid choices: $abilist])
2127 +for abi in $abilist; do
2129 + echo "checking ABI=$abi"
2131 + # Suppose abilist="64 32", then for abi=64, will have abi1="_64" and
2132 + # abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how
2133 + # $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the
2134 + # abilist), but there's no fallback for $gcc_64_cflags.
2136 + abi1=[`echo _$abi | sed 's/[.]//g'`]
2137 + if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi
2139 + # Compiler choices under this ABI
2140 + eval cclist_chosen=\"\$cclist$abi1\"
2141 + test -n "$cclist_chosen" || eval cclist_chosen=\"\$cclist$abi2\"
2143 + # If there's a user specified $CC then don't use a list for
2144 + # $cclist_chosen, just a single value for $ccbase.
2146 + if test -n "$CC"; then
2148 + # The first word of $CC, stripped of any directory. For instance
2149 + # CC="/usr/local/bin/gcc -pipe" will give "gcc".
2151 + for ccbase in $CC; do break; done
2152 + ccbase=`echo $ccbase | sed 's:.*/::'`
2154 + # If this $ccbase is in $cclist_chosen then it's a compiler we know and
2155 + # we can do flags defaulting with it. If not, then $cclist_chosen is
2156 + # set to "unrecognised" so no default flags are used.
2158 + # "unrecognised" is used to avoid bad effects with eval if $ccbase has
2159 + # non-symbol characters. For instance ccbase=my+cc would end up with
2160 + # something like cflags="$my+cc_cflags" which would give
2161 + # cflags="+cc_cflags" rather than the intended empty string for an
2162 + # unknown compiler.
2164 + found=unrecognised
2165 + for i in $cclist_chosen; do
2166 + if test "$ccbase" = $i; then
2171 + cclist_chosen=$found
2174 + for ccbase in $cclist_chosen; do
2176 + # When cross compiling, look for a compiler with the $host_alias as a
2177 + # prefix, the same way that AC_CHECK_TOOL does. But don't do this to a
2178 + # user-selected $CC.
2180 + # $cross_compiling will be yes/no/maybe at this point. Do the host
2181 + # prefixing for "maybe" as well as "yes".
2183 + if test "$cross_compiling" != no && test -z "$CC"; then
2184 + cross_compiling_prefix="${host_alias}-"
2187 + for ccprefix in $cross_compiling_prefix ""; do
2190 + test -n "$cc" || cc="$ccprefix$ccbase"
2192 + # If the compiler is gcc but installed under another name, then change
2193 + # $ccbase so as to use the flags we know for gcc. This helps for
2194 + # instance when specifying CC=gcc272 on Debian GNU/Linux, or the
2195 + # native cc which is really gcc on NeXT or MacOS-X.
2197 + # FIXME: There's a slight misfeature here. If cc is actually gcc but
2198 + # gcc is not a known compiler under this $abi then we'll end up
2199 + # testing it with no flags and it'll work, but chances are it won't be
2200 + # in the right mode for the ABI we desire. Let's quietly hope this
2203 + if test $ccbase != gcc; then
2204 + GMP_PROG_CC_IS_GNU($cc,ccbase=gcc)
2207 + # Similarly if the compiler is IBM xlc but invoked as cc or whatever
2208 + # then change $ccbase and make the default xlc flags available.
2209 + if test $ccbase != xlc; then
2210 + GMP_PROG_CC_IS_XLC($cc,ccbase=xlc)
2213 + # acc was Sun's first unbundled compiler back in the SunOS days, or
2214 + # something like that, but today its man page says it's not meant to
2215 + # be used directly (instead via /usr/ucb/cc). The options are pretty
2216 + # much the same as the main SunPRO cc, so share those configs.
2219 + *sparc*-*-solaris* | *sparc*-*-sunos*)
2220 + if test "$ccbase" = acc; then ccbase=cc; fi ;;
2223 + for tmp_cflags_maybe in yes no; do
2224 + eval cflags=\"\$${ccbase}${abi1}_cflags\"
2225 + test -n "$cflags" || eval cflags=\"\$${ccbase}${abi2}_cflags\"
2227 + if test "$tmp_cflags_maybe" = yes; then
2228 + # don't try cflags_maybe when the user set CFLAGS
2229 + if test "$test_CFLAGS" = set; then continue; fi
2230 + eval cflags_maybe=\"\$${ccbase}${abi1}_cflags_maybe\"
2231 + test -n "$cflags_maybe" || eval cflags_maybe=\"\$${ccbase}${abi2}_cflags_maybe\"
2232 + # don't try cflags_maybe if there's nothing set
2233 + if test -z "$cflags_maybe"; then continue; fi
2234 + cflags="$cflags_maybe $cflags"
2237 + # Any user CFLAGS, even an empty string, takes precedence
2238 + if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
2240 + # Any user CPPFLAGS, even an empty string, takes precedence
2241 + eval cppflags=\"\$${ccbase}${abi1}_cppflags\"
2242 + test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\"
2243 + if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
2245 + # --enable-profiling adds -p/-pg even to user-specified CFLAGS.
2246 + # This is convenient, but it's perhaps a bit naughty to modify user
2248 + case "$enable_profiling" in
2249 + prof) cflags="$cflags -p" ;;
2250 + gprof) cflags="$cflags -pg" ;;
2251 + instrument) cflags="$cflags -finstrument-functions" ;;
2254 + GMP_PROG_CC_WORKS($cc $cflags $cppflags,,continue)
2256 + # If we're supposed to be using a "long long" for a limb, check that
2258 + eval limb_chosen=\"\$limb$abi1\"
2259 + test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\"
2260 + if test "$limb_chosen" = longlong; then
2261 + GMP_PROG_CC_WORKS_LONGLONG($cc $cflags $cppflags,,continue)
2264 + # The tests to perform on this $cc, if any
2265 + eval testlist=\"\$${ccbase}${abi1}_testlist\"
2266 + test -n "$testlist" || eval testlist=\"\$${ccbase}${abi2}_testlist\"
2267 + test -n "$testlist" || eval testlist=\"\$any${abi1}_testlist\"
2268 + test -n "$testlist" || eval testlist=\"\$any${abi2}_testlist\"
2271 + for tst in $testlist; do
2273 + hpc-hppa-2-0) GMP_HPC_HPPA_2_0($cc,,testlist_pass=no) ;;
2274 + gcc-arm-umodsi) GMP_GCC_ARM_UMODSI($cc,,testlist_pass=no) ;;
2275 + gcc-mips-o32) GMP_GCC_MIPS_O32($cc,,testlist_pass=no) ;;
2276 + hppa-level-2.0) GMP_HPPA_LEVEL_20($cc $cflags,,testlist_pass=no) ;;
2277 + sizeof*) GMP_C_TEST_SIZEOF($cc $cflags,$tst,,testlist_pass=no) ;;
2279 + if test $testlist_pass = no; then break; fi
2282 + if test $testlist_pass = yes; then
2283 + found_compiler=yes
2288 + if test $found_compiler = yes; then break; fi
2291 + if test $found_compiler = yes; then break; fi
2294 + if test $found_compiler = yes; then break; fi
2298 +# If we recognised the CPU, as indicated by $path being set, then insist
2299 +# that we have a working compiler, either from our $cclist choices or from
2300 +# $CC. We can't let AC_PROG_CC look around for a compiler because it might
2301 +# find one that we've rejected (for not supporting the modes our asm code
2304 +# If we didn't recognise the CPU (and this includes host_cpu=none), then
2305 +# fall through and let AC_PROG_CC look around for a compiler too. This is
2306 +# mostly in the interests of following a standard autoconf setup, after all
2307 +# we've already tested cc and gcc adequately (hopefully). As of autoconf
2308 +# 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft
2309 +# C on MS-DOS systems).
2311 +if test $found_compiler = no && test -n "$path"; then
2312 + AC_MSG_ERROR([could not find a working compiler, see config.log for details])
2316 + X86_PATTERN | X86_64_PATTERN)
2317 + # If the user asked for a fat build, override the path and flags set above
2318 + if test $enable_fat = yes; then
2320 + gcc_cflags_arch=""
2322 + fat_functions="add_n addmul_1 bdiv_dbm1c com cnd_add_n cnd_sub_n
2323 + copyd copyi dive_1 divrem_1
2324 + gcd_1 lshift lshiftc mod_1 mod_1_1 mod_1_1_cps mod_1_2
2325 + mod_1_2_cps mod_1_4 mod_1_4_cps mod_34lsub1 mode1o mul_1
2326 + mul_basecase mullo_basecase pre_divrem_1 pre_mod_1 redc_1
2327 + redc_2 rshift sqr_basecase sub_n submul_1"
2329 + if test "$abi" = 32; then
2330 + extra_functions="$extra_functions fat fat_entry"
2331 + path="x86/fat x86"
2332 + fat_path="x86 x86/fat x86/i486
2333 + x86/k6 x86/k6/mmx x86/k6/k62mmx
2335 + x86/k8 x86/k10 x86/bobcat
2336 + x86/pentium x86/pentium/mmx
2337 + x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
2338 + x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2
2339 + x86/core2 x86/coreinhm x86/coreisbr
2340 + x86/atom x86/atom/mmx x86/atom/sse2 x86/nano"
2343 + if test "$abi" = 64; then
2345 + extra_functions_64="$extra_functions_64 fat fat_entry"
2346 + path_64="x86_64/fat x86_64"
2347 + fat_path="x86_64 x86_64/fat
2348 + x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bobcat
2349 + x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr
2350 + x86_64/coreihwl x86_64/atom x86_64/nano"
2351 + fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
2354 + fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD
2355 + SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD
2356 + BMOD_1_TO_MOD_1_THRESHOLD"
2362 +if test $found_compiler = yes; then
2364 + # If we're creating CFLAGS, then look for optional additions. If the user
2365 + # set CFLAGS then leave it alone.
2367 + if test "$test_CFLAGS" != set; then
2368 + eval optlist=\"\$${ccbase}${abi1}_cflags_optlist\"
2369 + test -n "$optlist" || eval optlist=\"\$${ccbase}${abi2}_cflags_optlist\"
2371 + for opt in $optlist; do
2372 + eval optflags=\"\$${ccbase}${abi1}_cflags_${opt}\"
2373 + test -n "$optflags" || eval optflags=\"\$${ccbase}${abi2}_cflags_${opt}\"
2374 + test -n "$optflags" || eval optflags=\"\$${ccbase}_cflags_${opt}\"
2376 + for flag in $optflags; do
2378 + # ~ represents a space in an option spec
2379 + flag=`echo "$flag" | tr '~' ' '`
2382 + -march=pentium4 | -march=k8)
2383 + # For -march settings which enable SSE2 we exclude certain bad
2384 + # gcc versions and we need an OS knowing how to save xmm regs.
2386 + # This is only for ABI=32, any 64-bit gcc is good and any OS
2387 + # knowing x86_64 will know xmm.
2389 + # -march=k8 was only introduced in gcc 3.3, so we shouldn't need
2390 + # the GMP_GCC_PENTIUM4_SSE2 check (for gcc 3.2 and prior). But
2391 + # it doesn't hurt to run it anyway, sharing code with the
2394 + if test "$abi" = 32; then
2395 + GMP_GCC_PENTIUM4_SSE2($cc $cflags $cppflags,, continue)
2396 + GMP_OS_X86_XMM($cc $cflags $cppflags,, continue)
2400 + # special check, avoiding a warning
2401 + GMP_GCC_NO_CPP_PRECOMP($ccbase,$cc,$cflags,
2402 + [cflags="$cflags $flag"
2409 + GMP_GCC_WA_MCPU($cc $cflags, $flag, , [continue])
2414 + GMP_GCC_WA_OLDAS($cc $cflags $cppflags,
2415 + [cflags="$cflags $flag"
2421 + GMP_PROG_CC_WORKS($cc $cflags $cppflags $flag,
2422 + [cflags="$cflags $flag"
2431 + CPPFLAGS="$cppflags"
2432 + eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI\"
2434 + # Could easily have this in config.h too, if desired.
2435 + ABI_nodots=`echo $ABI | sed 's/\./_/'`
2436 + GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST)
2439 + # GMP_LDFLAGS substitution, selected according to ABI.
2440 + # These are needed on libgmp.la and libmp.la, but currently not on
2441 + # convenience libraries like tune/libspeed.la or mpz/libmpz.la.
2443 + eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
2444 + test -n "$GMP_LDFLAGS" || eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\"
2445 + AC_SUBST(GMP_LDFLAGS)
2446 + AC_SUBST(LIBGMP_LDFLAGS)
2447 + AC_SUBST(LIBGMPXX_LDFLAGS)
2449 + # extra_functions, selected according to ABI
2450 + eval tmp=\"\$extra_functions$abi1\"
2451 + test -n "$tmp" || eval tmp=\"\$extra_functions$abi2\"
2452 + extra_functions="$tmp"
2455 + # Cycle counter, selected according to ABI.
2457 + eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi1\"
2458 + test -n "$tmp" || eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi2\"
2459 + SPEED_CYCLECOUNTER_OBJ="$tmp"
2460 + eval tmp=\"\$cyclecounter_size$abi1\"
2461 + test -n "$tmp" || eval tmp=\"\$cyclecounter_size$abi2\"
2462 + cyclecounter_size="$tmp"
2464 + if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
2465 + AC_DEFINE_UNQUOTED(HAVE_SPEED_CYCLECOUNTER, $cyclecounter_size,
2466 + [Tune directory speed_cyclecounter, undef=none, 1=32bits, 2=64bits)])
2468 + AC_SUBST(SPEED_CYCLECOUNTER_OBJ)
2471 + # Calling conventions checking, selected according to ABI.
2473 + eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\"
2474 + test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\"
2475 + if test "$enable_assembly" = "yes"; then
2476 + CALLING_CONVENTIONS_OBJS="$tmp"
2478 + CALLING_CONVENTIONS_OBJS=""
2481 + if test -n "$CALLING_CONVENTIONS_OBJS"; then
2482 + AC_DEFINE(HAVE_CALLING_CONVENTIONS,1,
2483 + [Define to 1 if tests/libtests has calling conventions checking for the CPU])
2485 + AC_SUBST(CALLING_CONVENTIONS_OBJS)
2490 +# If the user gave an MPN_PATH, use that verbatim, otherwise choose
2491 +# according to the ABI and add "generic".
2493 +if test -n "$MPN_PATH"; then
2496 + eval tmp=\"\$path$abi1\"
2497 + test -n "$tmp" || eval tmp=\"\$path$abi2\"
2498 + path="$tmp generic"
2502 +# Long long limb setup for gmp.h.
2503 +case $limb_chosen in
2504 +longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;;
2505 +*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
2507 +AC_SUBST(DEFN_LONG_LONG_LIMB)
2510 +# The C compiler and preprocessor, put into ANSI mode if possible.
2516 +# The C compiler on the build system, and associated tests.
2517 +GMP_PROG_CC_FOR_BUILD
2518 +GMP_PROG_CPP_FOR_BUILD
2519 +GMP_PROG_EXEEXT_FOR_BUILD
2520 +GMP_C_FOR_BUILD_ANSI
2521 +GMP_CHECK_LIBM_FOR_BUILD
2524 +# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am.
2525 +# Using the compiler is a lot easier than figuring out how to invoke the
2526 +# assembler directly.
2528 +test -n "$CCAS" || CCAS="$CC -c"
2532 +# The C++ compiler, if desired.
2534 +if test $enable_cxx != no; then
2535 + test_CXXFLAGS=${CXXFLAGS+set}
2538 + echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC
2539 + cxxflags_ac_prog_cxx=$CXXFLAGS
2540 + cxxflags_list=ac_prog_cxx
2542 + # If the user didn't specify $CXXFLAGS, then try $CFLAGS, with -g removed
2543 + # if AC_PROG_CXX thinks that doesn't work. $CFLAGS stands a good chance
2544 + # of working, eg. on a GNU system where CC=gcc and CXX=g++.
2546 + if test "$test_CXXFLAGS" != set; then
2547 + cxxflags_cflags=$CFLAGS
2548 + cxxflags_list="cflags $cxxflags_list"
2549 + if test "$ac_prog_cxx_g" = no; then
2550 + cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'`
2554 + # See if the C++ compiler works. If the user specified CXXFLAGS then all
2555 + # we're doing is checking whether AC_PROG_CXX succeeded, since it doesn't
2556 + # give a fatal error, just leaves CXX set to a default g++. If on the
2557 + # other hand the user didn't specify CXXFLAGS then we get to try here our
2558 + # $cxxflags_list alternatives.
2560 + # Automake includes $CPPFLAGS in a C++ compile, so we do the same here.
2562 + for cxxflags_choice in $cxxflags_list; do
2563 + eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\"
2564 + GMP_PROG_CXX_WORKS($CXX $CPPFLAGS $CXXFLAGS,
2569 + # If --enable-cxx=yes but a C++ compiler can't be found, then abort.
2570 + if test $want_cxx = no && test $enable_cxx = yes; then
2571 + AC_MSG_ERROR([C++ compiler not available, see config.log for details])
2575 +AM_CONDITIONAL(WANT_CXX, test $want_cxx = yes)
2577 +# FIXME: We're not interested in CXXCPP for ourselves, but if we don't do it
2578 +# here then AC_PROG_LIBTOOL will AC_REQUIRE it (via _LT_AC_TAGCONFIG) and
2579 +# hence execute it unconditionally, and that will fail if there's no C++
2580 +# compiler (and no generic /lib/cpp).
2582 +if test $want_cxx = yes; then
2587 +# Path setups for Cray, according to IEEE or CFP. These must come after
2588 +# deciding the compiler.
2591 + [add_path="cray/ieee"],
2592 + [add_path="cray/cfp"; extra_functions="mulwwc90"],
2593 + [add_path="cray/cfp"; extra_functions="mulwwj90"])
2596 +if test -z "$MPN_PATH"; then
2597 + path="$add_path $path"
2600 +# For a nail build, also look in "nails" subdirectories.
2602 +if test $GMP_NAIL_BITS != 0 && test -z "$MPN_PATH"; then
2604 + for i in $path; do
2606 + generic) new_path="$new_path $i" ;;
2607 + *) new_path="$new_path $i/nails $i" ;;
2614 +# Put all directories into CPUVEC_list so as to get a full set of
2615 +# CPUVEC_SETUP_$tmp_suffix defines into config.h, even if some of them are
2616 +# empty because mmx and/or sse2 had to be dropped.
2618 +for i in $fat_path; do
2619 + GMP_FAT_SUFFIX(tmp_suffix, $i)
2620 + CPUVEC_list="$CPUVEC_list CPUVEC_SETUP_$tmp_suffix"
2624 +# If there's any sse2 or mmx in the path, check whether the assembler
2625 +# supports it, and remove if not.
2627 +# We only need this in ABI=32, for ABI=64 on x86_64 we can assume a new
2628 +# enough assembler.
2631 + X86_PATTERN | X86_64_PATTERN)
2632 + if test "$ABI" = 32; then
2633 + case "$path $fat_path" in
2634 + *mmx*) GMP_ASM_X86_MMX( , [GMP_STRIP_PATH(*mmx*)]) ;;
2636 + case "$path $fat_path" in
2637 + *sse2*) GMP_ASM_X86_SSE2( , [GMP_STRIP_PATH(sse2)]) ;;
2640 + case "$path $fat_path" in
2641 + *mulx*) GMP_ASM_X86_MULX( , [GMP_STRIP_PATH(mulx)]) ;;
2643 + case "$path $fat_path" in
2644 + *adx*) GMP_ASM_X86_ADX( , [GMP_STRIP_PATH(adx)]) ;;
2650 +if test "$enable_assembly" = "no"; then
2652 + CFLAGS="$CFLAGS -DNO_ASM"
2653 +# for abi in $abilist; do
2654 +# eval unset "path_\$abi"
2655 +# eval gcc_${abi}_cflags=\"\$gcc_${abi}_cflags -DNO_ASM\"
2660 +cat >&AC_FD_CC <<EOF
2666 +GMP_LDFLAGS=$GMP_LDFLAGS
2671 +echo "using ABI=\"$ABI\""
2673 +echo " CFLAGS=\"$CFLAGS\""
2674 +echo " CPPFLAGS=\"$CPPFLAGS\""
2675 +if test $want_cxx = yes; then
2676 + echo " CXX=\"$CXX\""
2677 + echo " CXXFLAGS=\"$CXXFLAGS\""
2679 +echo " MPN_PATH=\"$path\""
2688 + # FIXME: On AIX 3 and 4, $libname.a is included in libtool
2689 + # $library_names_spec, so libgmp.a becomes a symlink to libgmp.so, making
2690 + # it impossible to build shared and static libraries simultaneously.
2691 + # Disable shared libraries by default, but let the user override with
2692 + # --enable-shared --disable-static.
2694 + # FIXME: This $libname.a problem looks like it might apply to *-*-amigaos*
2695 + # and *-*-os2* too, but wait for someone to test this before worrying
2696 + # about it. If there is a problem then of course libtool is the right
2697 + # place to fix it.
2700 + if test -z "$enable_shared"; then enable_shared=no; fi ;;
2704 +# Configs for Windows DLLs.
2706 +AC_LIBTOOL_WIN32_DLL
2708 +AC_SUBST(LIBGMP_DLL,0)
2710 + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2711 + # By default, build only static.
2712 + if test -z "$enable_shared"; then
2715 + # Don't allow both static and DLL.
2716 + if test "$enable_shared" != no && test "$enable_static" != no; then
2717 + AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
2718 +Use "--disable-static --enable-shared" to build just a DLL.])
2721 + # "-no-undefined" is required when building a DLL, see documentation on
2722 + # AC_LIBTOOL_WIN32_DLL.
2724 + # "-Wl,--export-all-symbols" is a bit of a hack, it gets all libgmp and
2725 + # libgmpxx functions and variables exported. This is what libtool did
2726 + # in the past, and it's convenient for us in the test programs.
2728 + # Maybe it'd be prudent to check for --export-all-symbols before using
2729 + # it, but it seems to have been in ld since at least 2000, and there's
2730 + # not really any alternative we want to take up at the moment.
2732 + # "-Wl,output-def" is used to get a .def file for use by MS lib to make
2733 + # a .lib import library, described in the manual. libgmp-3.dll.def
2734 + # corresponds to the libmp-3.dll.def generated by libtool (as a result
2735 + # of -export-symbols on that library).
2737 + # Incidentally, libtool does generate an import library libgmp.dll.a,
2738 + # but it's "ar" format and cannot be used by the MS linker. There
2739 + # doesn't seem to be any GNU tool for generating or converting to .lib.
2741 + # FIXME: The .def files produced by -Wl,output-def include isascii,
2742 + # iscsym, iscsymf and toascii, apparently because mingw ctype.h doesn't
2743 + # inline isascii (used in gmp). It gives an extern inline for
2744 + # __isascii, but for some reason not the plain isascii.
2746 + if test "$enable_shared" = yes; then
2747 + GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols"
2748 + LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
2749 + LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"
2756 +# Ensure that $CONFIG_SHELL is available for AC_LIBTOOL_SYS_MAX_CMD_LEN.
2757 +# It's often set already by _LT_AC_PROG_ECHO_BACKSLASH or
2758 +# _AS_LINENO_PREPARE, but not always.
2760 +# The symptom of CONFIG_SHELL unset is some "expr" errors during the test,
2761 +# and an empty result. This only happens when invoked as "sh configure",
2762 +# ie. no path, and can be seen for instance on ia64-*-hpux*.
2764 +# FIXME: Newer libtool should have it's own fix for this.
2766 +if test -z "$CONFIG_SHELL"; then
2767 + CONFIG_SHELL=$SHELL
2770 +# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on
2771 +# mingw and cygwin. Under --disable-cxx this avoids some error messages
2772 +# from libtool arising from the fact we didn't actually run AC_PROG_CXX.
2773 +# Notice that any user-supplied --with-tags setting takes precedence.
2775 +# FIXME: Is this the right way to get this effect? Very possibly not, but
2776 +# the current _LT_AC_TAGCONFIG doesn't really suggest an alternative.
2778 +if test "${with_tags+set}" != set; then
2779 + if test $want_cxx = yes; then
2786 +# The dead hand of AC_REQUIRE makes AC_PROG_LIBTOOL expand and execute
2787 +# AC_PROG_F77, even when F77 is not in the selected with_tags. This is
2788 +# probably harmless, but it's unsightly and bloats our configure, so pretend
2789 +# AC_PROG_F77 has been expanded already.
2791 +# FIXME: Rumour has it libtool will one day provide a way for a configure.in
2792 +# to say what it wants from among supported languages etc.
2794 +#AC_PROVIDE([AC_PROG_F77])
2798 +# Generate an error here if attempting to build both shared and static when
2799 +# $libname.a is in $library_names_spec (as mentioned above), rather than
2800 +# wait for ar or ld to fail.
2802 +if test "$enable_shared" = yes && test "$enable_static" = yes; then
2803 + case $library_names_spec in
2805 + AC_MSG_ERROR([cannot create both shared and static libraries on this system, --disable one of the two])
2810 +AM_CONDITIONAL(ENABLE_STATIC, test "$enable_static" = yes)
2813 +# Many of these library and header checks are for the benefit of
2814 +# supplementary programs. libgmp doesn't use anything too weird.
2819 +# Reasons for testing:
2820 +# float.h - not in SunOS bundled cc
2821 +# invent.h - IRIX specific
2822 +# langinfo.h - X/Open standard only, not in djgpp for instance
2823 +# locale.h - old systems won't have this
2824 +# nl_types.h - X/Open standard only, not in djgpp for instance
2825 +# (usually langinfo.h gives nl_item etc, but not on netbsd 1.4.1)
2826 +# sys/attributes.h - IRIX specific
2827 +# sys/iograph.h - IRIX specific
2828 +# sys/mman.h - not in Cray Unicos
2829 +# sys/param.h - not in mingw
2830 +# sys/processor.h - solaris specific, though also present in macos
2831 +# sys/pstat.h - HPUX specific
2832 +# sys/resource.h - not in mingw
2833 +# sys/sysctl.h - not in mingw
2834 +# sys/sysinfo.h - OSF specific
2835 +# sys/syssgi.h - IRIX specific
2836 +# sys/systemcfg.h - AIX specific
2837 +# sys/time.h - autoconf suggests testing, don't know anywhere without it
2838 +# sys/times.h - not in mingw
2839 +# machine/hal_sysinfo.h - OSF specific
2841 +# inttypes.h, stdint.h, unistd.h and sys/types.h are already in the autoconf
2844 +AC_CHECK_HEADERS(fcntl.h float.h invent.h langinfo.h locale.h nl_types.h sys/attributes.h sys/iograph.h sys/mman.h sys/param.h sys/processor.h sys/pstat.h sys/sysinfo.h sys/syssgi.h sys/systemcfg.h sys/time.h sys/times.h)
2846 +# On SunOS, sys/resource.h needs sys/time.h (for struct timeval)
2847 +AC_CHECK_HEADERS(sys/resource.h,,,
2848 +[#if TIME_WITH_SYS_TIME
2849 +# include <sys/time.h>
2852 +# if HAVE_SYS_TIME_H
2853 +# include <sys/time.h>
2859 +# On NetBSD and OpenBSD, sys/sysctl.h needs sys/param.h for various constants
2860 +AC_CHECK_HEADERS(sys/sysctl.h,,,
2861 +[#if HAVE_SYS_PARAM_H
2862 +# include <sys/param.h>
2865 +# On OSF 4.0, <machine/hal_sysinfo.h> must have <sys/sysinfo.h> for ulong_t
2866 +AC_CHECK_HEADERS(machine/hal_sysinfo.h,,,
2867 +[#if HAVE_SYS_SYSINFO_H
2868 +# include <sys/sysinfo.h>
2871 +# Reasons for testing:
2872 +# optarg - not declared in mingw
2873 +# fgetc, fscanf, ungetc, vfprintf - not declared in SunOS 4
2874 +# sys_errlist, sys_nerr - not declared in SunOS 4
2876 +# optarg should be in unistd.h and the rest in stdio.h, both of which are
2877 +# in the autoconf default includes.
2879 +# sys_errlist and sys_nerr are supposed to be in <errno.h> on SunOS according
2880 +# to the man page (but aren't), in glibc they're in stdio.h.
2882 +AC_CHECK_DECLS([fgetc, fscanf, optarg, ungetc, vfprintf])
2883 +AC_CHECK_DECLS([sys_errlist, sys_nerr], , ,
2884 +[#include <stdio.h>
2885 +#include <errno.h>])
2889 +# Reasons for testing:
2891 +# long double - not in the HP bundled K&R cc
2892 +# long long - only in reasonably recent compilers
2893 +# ptrdiff_t - seems to be everywhere, maybe don't need to check this
2894 +# quad_t - BSD specific
2895 +# uint_least32_t - C99
2897 +# the default includes are sufficient for all these types
2899 +AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t,
2900 + uint_least32_t, intptr_t])
2904 +# FIXME: Really want #ifndef __cplusplus around the #define volatile
2905 +# replacement autoconf gives, since volatile is always available in C++.
2906 +# But we don't use it in C++ currently.
2912 +GMP_C_ATTRIBUTE_CONST
2913 +GMP_C_ATTRIBUTE_MALLOC
2914 +GMP_C_ATTRIBUTE_MODE
2915 +GMP_C_ATTRIBUTE_NORETURN
2917 +GMP_H_EXTERN_INLINE
2929 + [AC_DEFINE(HAVE_LIMB_BIG_ENDIAN, 1)
2930 + GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_LIMB_BIG_ENDIAN')", POST)],
2931 + [AC_DEFINE(HAVE_LIMB_LITTLE_ENDIAN, 1)
2932 + GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_LIMB_LITTLE_ENDIAN')", POST)
2934 +AH_VERBATIM([HAVE_LIMB],
2935 +[/* Define one of these to 1 for the endianness of `mp_limb_t'.
2936 + If the endianness is not a simple big or little, or you don't know what
2937 + it is, then leave both undefined. */
2938 +#undef HAVE_LIMB_BIG_ENDIAN
2939 +#undef HAVE_LIMB_LITTLE_ENDIAN])
2941 +GMP_C_DOUBLE_FORMAT
2944 +# Reasons for testing:
2945 +# alarm - not in mingw
2946 +# attr_get - IRIX specific
2947 +# clock_gettime - not in glibc 2.2.4, only very recent systems
2948 +# cputime - not in glibc
2949 +# getsysinfo - OSF specific
2950 +# getrusage - not in mingw
2951 +# gettimeofday - not in mingw
2952 +# mmap - not in mingw, djgpp
2953 +# nl_langinfo - X/Open standard only, not in djgpp for instance
2954 +# obstack_vprintf - glibc specific
2955 +# processor_info - solaris specific
2956 +# pstat_getprocessor - HPUX specific (10.x and up)
2957 +# raise - an ANSI-ism, though probably almost universal by now
2958 +# read_real_time - AIX specific
2959 +# sigaction - not in mingw
2960 +# sigaltstack - not in mingw, or old AIX (reputedly)
2961 +# sigstack - not in mingw
2962 +# strerror - not in SunOS
2963 +# strnlen - glibc extension (some other systems too)
2964 +# syssgi - IRIX specific
2965 +# times - not in mingw
2967 +# AC_FUNC_STRNLEN is not used because we don't want the AC_LIBOBJ
2968 +# replacement setups it gives. It detects a faulty strnlen on AIX, but
2969 +# missing out on that test is ok since our only use of strnlen is in
2970 +# __gmp_replacement_vsnprintf which is not required on AIX since it has a
2973 +AC_CHECK_FUNCS(alarm attr_get clock cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times)
2975 +# clock_gettime is in librt on *-*-osf5.1 and on glibc, so att -lrt to
2976 +# TUNE_LIBS if needed. On linux (tested on x86_32, 2.6.26),
2977 +# clock_getres reports ns accuracy, while in a quick test on osf
2978 +# clock_getres said only 1 millisecond.
2981 +AC_SEARCH_LIBS(clock_gettime, rt, [
2982 + AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
2986 +AC_SUBST(TUNE_LIBS)
2989 +GMP_FUNC_SSCANF_WRITABLE_INPUT
2991 +# Reasons for checking:
2992 +# pst_processor psp_iticksperclktick - not in hpux 9
2994 +AC_CHECK_MEMBER(struct pst_processor.psp_iticksperclktick,
2995 + [AC_DEFINE(HAVE_PSP_ITICKSPERCLKTICK, 1,
2996 +[Define to 1 if <sys/pstat.h> `struct pst_processor' exists
2997 +and contains `psp_iticksperclktick'.])],,
2998 + [#include <sys/pstat.h>])
3000 +# C++ tests, when required
3002 +if test $enable_cxx = yes; then
3005 + # Reasons for testing:
3006 + # <sstream> - not in g++ 2.95.2
3007 + # std::locale - not in g++ 2.95.4
3009 + AC_CHECK_HEADERS([sstream])
3010 + AC_CHECK_TYPES([std::locale],,,[#include <locale>])
3016 +# Pick the correct source files in $path and link them to mpn/.
3017 +# $gmp_mpn_functions lists all functions we need.
3019 +# The rule is to find a file with the function name and a .asm, .S,
3020 +# .s, or .c extension. Certain multi-function files with special names
3021 +# can provide some functions too. (mpn/Makefile.am passes
3022 +# -DOPERATION_<func> to get them to generate the right code.)
3024 +# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former
3025 +# can optionally provide the latter as an extra entrypoint. Likewise
3026 +# divrem_1 and pre_divrem_1.
3028 +gmp_mpn_functions_optional="umul udiv \
3029 + invert_limb sqr_diagonal sqr_diag_addlsh1 \
3030 + mul_2 mul_3 mul_4 mul_5 mul_6 \
3031 + addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \
3032 + addlsh1_n sublsh1_n rsblsh1_n rsh1add_n rsh1sub_n \
3033 + addlsh2_n sublsh2_n rsblsh2_n \
3034 + addlsh_n sublsh_n rsblsh_n \
3035 + add_n_sub_n addaddmul_1msb0"
3037 +gmp_mpn_functions="$extra_functions \
3038 + add add_1 add_n sub sub_1 sub_n cnd_add_n cnd_sub_n neg com \
3039 + mul_1 addmul_1 submul_1 \
3040 + add_err1_n add_err2_n add_err3_n sub_err1_n sub_err2_n sub_err3_n \
3041 + lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
3042 + fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
3043 + mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \
3044 + mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \
3045 + mulmid_basecase toom42_mulmid mulmid_n mulmid \
3046 + random random2 pow_1 \
3047 + rootrem sqrtrem sizeinbase get_str set_str \
3048 + scan0 scan1 popcount hamdist cmp \
3050 + gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \
3052 + div_q tdiv_qr jacbase jacobi_2 jacobi get_d \
3053 + matrix22_mul matrix22_mul1_inverse_vector \
3054 + hgcd_matrix hgcd2 hgcd_step hgcd_reduce hgcd hgcd_appr \
3055 + hgcd2_jacobi hgcd_jacobi \
3056 + mullo_n mullo_basecase \
3057 + toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul \
3058 + toom33_mul toom43_mul toom53_mul toom54_mul toom63_mul \
3060 + toom6h_mul toom6_sqr toom8h_mul toom8_sqr \
3061 + toom_couple_handling \
3062 + toom2_sqr toom3_sqr toom4_sqr \
3063 + toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \
3064 + toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp toom_eval_pm2rexp \
3065 + toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts \
3066 + toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts \
3067 + invertappr invert binvert mulmod_bnm1 sqrmod_bnm1 \
3068 + div_qr_1 div_qr_1n_pi1 \
3069 + div_qr_2 div_qr_2n_pi1 div_qr_2u_pi1 \
3070 + sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q \
3071 + dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q \
3072 + mu_div_qr mu_divappr_q mu_div_q \
3074 + sbpi1_bdiv_q sbpi1_bdiv_qr \
3075 + dcpi1_bdiv_q dcpi1_bdiv_qr \
3076 + mu_bdiv_q mu_bdiv_qr \
3077 + bdiv_q bdiv_qr broot brootinv bsqrt bsqrtinv \
3078 + divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo sec_powm \
3079 + sec_mul sec_sqr sec_div_qr sec_div_r sec_pi1_div_qr sec_pi1_div_r \
3080 + sec_add_1 sec_sub_1 sec_invert \
3082 + and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
3083 + copyi copyd zero sec_tabselect \
3085 + $gmp_mpn_functions_optional"
3087 +define(GMP_MULFUNC_CHOICES,
3088 +[# functions that can be provided by multi-function files
3091 + add_n|sub_n) tmp_mulfunc="aors_n" ;;
3092 + add_err1_n|sub_err1_n)
3093 + tmp_mulfunc="aors_err1_n" ;;
3094 + add_err2_n|sub_err2_n)
3095 + tmp_mulfunc="aors_err2_n" ;;
3096 + add_err3_n|sub_err3_n)
3097 + tmp_mulfunc="aors_err3_n" ;;
3098 + cnd_add_n|cnd_sub_n) tmp_mulfunc="cnd_aors_n" ;;
3099 + sec_add_1|sec_sub_1) tmp_mulfunc="sec_aors_1" ;;
3100 + addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;;
3101 + mul_2|addmul_2) tmp_mulfunc="aormul_2" ;;
3102 + mul_3|addmul_3) tmp_mulfunc="aormul_3" ;;
3103 + mul_4|addmul_4) tmp_mulfunc="aormul_4" ;;
3104 + popcount|hamdist) tmp_mulfunc="popham" ;;
3105 + and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n)
3106 + tmp_mulfunc="logops_n" ;;
3107 + lshift|rshift) tmp_mulfunc="lorrshift";;
3109 + tmp_mulfunc="aorslsh1_n aorrlsh1_n aorsorrlsh1_n";;
3111 + tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
3113 + tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
3115 + tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
3117 + tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
3119 + tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
3121 + tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
3123 + tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
3125 + tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
3126 + rsh1add_n|rsh1sub_n)
3127 + tmp_mulfunc="rsh1aors_n";;
3128 + sec_div_qr|sec_div_r)
3129 + tmp_mulfunc="sec_div";;
3130 + sec_pi1_div_qr|sec_pi1_div_r)
3131 + tmp_mulfunc="sec_pi1_div";;
3135 +# the list of all object files used by mpn/Makefile.in and the
3136 +# top-level Makefile.in, respectively
3138 +mpn_objs_in_libgmp=
3140 +# links from the sources, to be removed by "make distclean"
3144 +# mpn_relative_top_srcdir is $top_srcdir, but for use from within the mpn
3145 +# build directory. If $srcdir is relative then we use a relative path too,
3146 +# so the two trees can be moved together.
3148 + [[\\/]* | ?:[\\/]*]) # absolute, as per autoconf
3149 + mpn_relative_top_srcdir=$srcdir ;;
3151 + mpn_relative_top_srcdir=../$srcdir ;;
3155 +define(MPN_SUFFIXES,[asm S s c])
3157 +dnl Usage: GMP_FILE_TO_FUNCTION_BASE(func,file)
3159 +dnl Set $func to the function base name for $file, eg. dive_1 gives
3162 +define(GMP_FILE_TO_FUNCTION,
3164 + dive_1) $1=divexact_1 ;;
3165 + diveby3) $1=divexact_by3c ;;
3166 + pre_divrem_1) $1=preinv_divrem_1 ;;
3167 + mode1o) $1=modexact_1c_odd ;;
3168 + pre_mod_1) $1=preinv_mod_1 ;;
3169 + mod_1_1) $1=mod_1_1p ;;
3170 + mod_1_1_cps) $1=mod_1_1p_cps ;;
3171 + mod_1_2) $1=mod_1s_2p ;;
3172 + mod_1_2_cps) $1=mod_1s_2p_cps ;;
3173 + mod_1_3) $1=mod_1s_3p ;;
3174 + mod_1_3_cps) $1=mod_1s_3p_cps ;;
3175 + mod_1_4) $1=mod_1s_4p ;;
3176 + mod_1_4_cps) $1=mod_1s_4p_cps ;;
3181 +# Fat binary setups.
3183 +# We proceed through each $fat_path directory, and look for $fat_function
3184 +# routines there. Those found are incorporated in the build by generating a
3185 +# little mpn/<foo>.asm or mpn/<foo>.c file in the build directory, with
3186 +# suitable function renaming, and adding that to $mpn_objects (the same as a
3187 +# normal mpn file).
3189 +# fat.h is generated with macros to let internal calls to each $fat_function
3190 +# go directly through __gmpn_cpuvec, plus macros and declarations helping to
3191 +# setup that structure, on a per-directory basis ready for
3192 +# mpn/<cpu>/fat/fat.c.
3194 +# fat.h includes thresholds listed in $fat_thresholds, extracted from
3195 +# gmp-mparam.h in each directory. An overall maximum for each threshold is
3196 +# established, for use in making fixed size arrays of temporary space.
3197 +# (Eg. MUL_TOOM33_THRESHOLD_LIMIT used by mpn/generic/mul.c.)
3199 +# It'd be possible to do some of this manually, but when there's more than a
3200 +# few functions and a few directories it becomes very tedious, and very
3201 +# prone to having some routine accidentally omitted. On that basis it seems
3202 +# best to automate as much as possible, even if the code to do so is a bit
3206 +if test -n "$fat_path"; then
3207 + # Usually the mpn build directory is created with mpn/Makefile
3208 + # instantiation, but we want to write to it sooner.
3209 + mkdir mpn 2>/dev/null
3211 + echo "/* fat.h - setups for fat binaries." >fat.h
3212 + echo " Generated by configure - DO NOT EDIT. */" >>fat.h
3214 + AC_DEFINE(WANT_FAT_BINARY, 1, [Define to 1 when building a fat binary.])
3215 + GMP_DEFINE(WANT_FAT_BINARY, yes)
3217 + # Don't want normal copies of fat functions
3218 + for tmp_fn in $fat_functions; do
3219 + GMP_REMOVE_FROM_LIST(gmp_mpn_functions, $tmp_fn)
3220 + GMP_REMOVE_FROM_LIST(gmp_mpn_functions_optional, $tmp_fn)
3223 + for tmp_fn in $fat_functions; do
3224 + GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn)
3226 +#ifndef OPERATION_$tmp_fn
3227 +#undef mpn_$tmp_fbase
3228 +#define mpn_$tmp_fbase (*__gmpn_cpuvec.$tmp_fbase)
3230 +DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
3231 + # encourage various macros to use fat functions
3232 + AC_DEFINE_UNQUOTED(HAVE_NATIVE_mpn_$tmp_fbase)
3236 + echo "/* variable thresholds */" >>fat.h
3237 + for tmp_tn in $fat_thresholds; do
3238 + echo "#undef $tmp_tn" >>fat.h
3239 + echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr [A-Z] [a-z]`)" >>fat.h
3243 +/* Copy all fields into __gmpn_cpuvec.
3244 + memcpy is not used because it might operate byte-wise (depending on its
3245 + implementation), and we need the function pointer writes to be atomic.
3246 + "volatile" discourages the compiler from trying to optimize this. */
3247 +#define CPUVEC_INSTALL(vec) \\
3249 + volatile struct cpuvec_t *p = &__gmpn_cpuvec; \\" >>fat.h
3250 + for tmp_fn in $fat_functions; do
3251 + GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn)
3252 + echo " p->$tmp_fbase = vec.$tmp_fbase; \\" >>fat.h
3254 + for tmp_tn in $fat_thresholds; do
3255 + tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
3256 + echo " p->$tmp_field_name = vec.$tmp_field_name; \\" >>fat.h
3258 + echo " } while (0)" >>fat.h
3261 +/* A helper to check all fields are filled. */
3262 +#define ASSERT_CPUVEC(vec) \\
3264 + for tmp_fn in $fat_functions; do
3265 + GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn)
3266 + echo " ASSERT (vec.$tmp_fbase != NULL); \\" >>fat.h
3268 + for tmp_tn in $fat_thresholds; do
3269 + tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
3270 + echo " ASSERT (vec.$tmp_field_name != 0); \\" >>fat.h
3272 + echo " } while (0)" >>fat.h
3275 +/* Call ITERATE(field) for each fat threshold field. */
3276 +#define ITERATE_FAT_THRESHOLDS() \\
3278 + for tmp_tn in $fat_thresholds; do
3279 + tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
3280 + echo " ITERATE ($tmp_tn, $tmp_field_name); \\" >>fat.h
3282 + echo " } while (0)" >>fat.h
3284 + for tmp_dir in $fat_path; do
3288 + GMP_FAT_SUFFIX(tmp_suffix, $tmp_dir)
3290 + # In order to keep names unique on a DOS 8.3 filesystem, use a prefix
3291 + # (rather than a suffix) for the generated file names, and abbreviate.
3292 + case $tmp_suffix in
3293 + pentium) tmp_prefix=p ;;
3294 + pentium_mmx) tmp_prefix=pm ;;
3295 + p6_mmx) tmp_prefix=p2 ;;
3296 + p6_p3mmx) tmp_prefix=p3 ;;
3297 + pentium4) tmp_prefix=p4 ;;
3298 + pentium4_mmx) tmp_prefix=p4m ;;
3299 + pentium4_sse2) tmp_prefix=p4s ;;
3300 + k6_mmx) tmp_prefix=k6m ;;
3301 + k6_k62mmx) tmp_prefix=k62 ;;
3302 + k7_mmx) tmp_prefix=k7m ;;
3303 + *) tmp_prefix=$tmp_suffix ;;
3306 + # Extract desired thresholds from gmp-mparam.h file in this directory,
3308 + tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h
3309 + if test -f $tmp_mparam; then
3310 + for tmp_tn in $fat_thresholds; do
3311 + tmp_thresh=`sed -n "s/^#define $tmp_tn[ ]*\\([0-9][0-9]*\\).*$/\\1/p" $tmp_mparam`
3312 + if test -n "$tmp_thresh"; then
3313 + THRESH_ASM_SETUP=["${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh)
3315 + CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr [[A-Z]] [[a-z]]` = $tmp_thresh; \\
3317 + eval tmp_limit=\$${tmp_tn}_LIMIT
3318 + if test -z "$tmp_limit"; then
3321 + if test $tmp_thresh -gt $tmp_limit; then
3322 + eval ${tmp_tn}_LIMIT=$tmp_thresh
3328 + for tmp_fn in $fat_functions; do
3329 + GMP_MULFUNC_CHOICES
3331 + for tmp_base in $tmp_fn $tmp_mulfunc; do
3332 + for tmp_ext in MPN_SUFFIXES; do
3333 + tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
3334 + if test -f $tmp_file; then
3336 + # If the host uses a non-standard ABI, check if tmp_file supports it
3338 + if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
3339 + abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `]
3340 + if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
3347 + mpn_objects="$mpn_objects ${tmp_prefix}_$tmp_fn.lo"
3348 + mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_prefix}_$tmp_fn.lo"
3350 + GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn)
3352 + # carry-in variant, eg. divrem_1c or modexact_1c_odd
3353 + case $tmp_fbase in
3354 + *_1*) tmp_fbasec=`echo $tmp_fbase | sed 's/_1/_1c/'` ;;
3355 + *) tmp_fbasec=${tmp_fbase}c ;;
3358 + # Create a little file doing an include from srcdir. The
3359 + # OPERATION and renamings aren't all needed all the time, but
3360 + # they don't hurt if unused.
3362 + # FIXME: Should generate these via config.status commands.
3363 + # Would need them all in one AC_CONFIG_COMMANDS though, since
3364 + # that macro doesn't accept a set of separate commands generated
3369 + # hide the d-n-l from autoconf's error checking
3371 + echo ["$tmp_d_n_l mpn_$tmp_fbase - from $tmp_dir directory for fat binary.
3372 +$tmp_d_n_l Generated by configure - DO NOT EDIT.
3374 +define(OPERATION_$tmp_fn)
3375 +define(__gmpn_$tmp_fbase, __gmpn_${tmp_fbase}_$tmp_suffix)
3376 +define(__gmpn_$tmp_fbasec,__gmpn_${tmp_fbasec}_${tmp_suffix})
3377 +define(__gmpn_preinv_${tmp_fbase},__gmpn_preinv_${tmp_fbase}_${tmp_suffix})
3378 +define(__gmpn_${tmp_fbase}_cps,__gmpn_${tmp_fbase}_cps_${tmp_suffix})
3380 +$tmp_d_n_l For k6 and k7 gcd_1 calling their corresponding mpn_modexact_1_odd
3381 +ifdef(\`__gmpn_modexact_1_odd',,
3382 +\`define(__gmpn_modexact_1_odd,__gmpn_modexact_1_odd_${tmp_suffix})')
3385 +include][($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm)
3386 +"] >mpn/${tmp_prefix}_$tmp_fn.asm
3389 + echo ["/* mpn_$tmp_fbase - from $tmp_dir directory for fat binary.
3390 + Generated by configure - DO NOT EDIT. */
3392 +#define OPERATION_$tmp_fn 1
3393 +#define __gmpn_$tmp_fbase __gmpn_${tmp_fbase}_$tmp_suffix
3394 +#define __gmpn_$tmp_fbasec __gmpn_${tmp_fbasec}_${tmp_suffix}
3395 +#define __gmpn_preinv_${tmp_fbase} __gmpn_preinv_${tmp_fbase}_${tmp_suffix}
3396 +#define __gmpn_${tmp_fbase}_cps __gmpn_${tmp_fbase}_cps_${tmp_suffix}
3398 +#include \"$mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.c\"
3399 +"] >mpn/${tmp_prefix}_$tmp_fn.c
3403 + # Prototype, and append to CPUVEC_SETUP for this directory.
3404 + echo "DECL_$tmp_fbase (__gmpn_${tmp_fbase}_$tmp_suffix);" >>fat.h
3405 + CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.$tmp_fbase = __gmpn_${tmp_fbase}_${tmp_suffix}; \\
3407 + # Ditto for any preinv variant (preinv_divrem_1, preinv_mod_1).
3408 + if grep "^PROLOGUE(mpn_preinv_$tmp_fn)" $tmp_file >/dev/null; then
3409 + echo "DECL_preinv_$tmp_fbase (__gmpn_preinv_${tmp_fbase}_$tmp_suffix);" >>fat.h
3410 + CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.preinv_$tmp_fbase = __gmpn_preinv_${tmp_fbase}_${tmp_suffix}; \\
3414 + # Ditto for any mod_1...cps variant
3415 + if grep "^PROLOGUE(mpn_${tmp_fbase}_cps)" $tmp_file >/dev/null; then
3416 + echo "DECL_${tmp_fbase}_cps (__gmpn_${tmp_fbase}_cps_$tmp_suffix);" >>fat.h
3417 + CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.${tmp_fbase}_cps = __gmpn_${tmp_fbase}_cps_${tmp_suffix}; \\
3425 + # Emit CPUVEC_SETUP for this directory
3427 + echo "#define CPUVEC_SETUP_$tmp_suffix \\" >>fat.h
3428 + echo " do { \\" >>fat.h
3429 + echo "$CPUVEC_SETUP } while (0)" >>fat.h
3432 + # Emit threshold limits
3434 + for tmp_tn in $fat_thresholds; do
3435 + eval tmp_limit=\$${tmp_tn}_LIMIT
3436 + echo "#define ${tmp_tn}_LIMIT $tmp_limit" >>fat.h
3441 +# Normal binary setups.
3444 +for tmp_ext in MPN_SUFFIXES; do
3445 + eval found_$tmp_ext=no
3448 +for tmp_fn in $gmp_mpn_functions; do
3449 + for tmp_ext in MPN_SUFFIXES; do
3450 + test "$no_create" = yes || rm -f mpn/$tmp_fn.$tmp_ext
3453 + # mpn_preinv_divrem_1 might have been provided by divrem_1.asm, likewise
3454 + # mpn_preinv_mod_1 by mod_1.asm.
3457 + if test "$HAVE_NATIVE_mpn_preinv_divrem_1" = yes; then continue; fi ;;
3459 + if test "$HAVE_NATIVE_mpn_preinv_mod_1" = yes; then continue; fi ;;
3462 + GMP_MULFUNC_CHOICES
3465 + for tmp_dir in $path; do
3466 + for tmp_base in $tmp_fn $tmp_mulfunc; do
3467 + for tmp_ext in MPN_SUFFIXES; do
3468 + tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
3469 + if test -f $tmp_file; then
3471 + # For a nails build, check if the file supports our nail bits.
3472 + # Generic code always supports all nails.
3474 + # FIXME: When a multi-function file is selected to provide one of
3475 + # the nails-neutral routines, like logops_n for and_n, the
3476 + # PROLOGUE grepping will create HAVE_NATIVE_mpn_<foo> defines for
3477 + # all functions in that file, even if they haven't all been
3478 + # nailified. Not sure what to do about this, it's only really a
3479 + # problem for logops_n, and it's not too terrible to insist those
3480 + # get nailified always.
3482 + if test $GMP_NAIL_BITS != 0 && test $tmp_dir != generic; then
3484 + and_n | ior_n | xor_n | andn_n | \
3486 + popcount | hamdist | \
3487 + udiv | udiv_w_sdiv | umul | \
3488 + cntlz | invert_limb)
3489 + # these operations are either unaffected by nails or defined
3490 + # to operate on full limbs
3493 + nails=[`sed -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file `]
3494 + for n in $nails; do
3497 + n_start=`echo "$n" | sed -n 's/\(.*\)-.*/\1/p'`
3498 + n_end=`echo "$n" | sed -n 's/.*-\(.*\)/\1/p'`
3505 + if test $GMP_NAIL_BITS -ge $n_start && test $GMP_NAIL_BITS -le $n_end; then
3510 + if test $found != yes; then
3517 + # If the host uses a non-standard ABI, check if tmp_file supports it
3519 + if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
3520 + abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `]
3521 + if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
3529 + eval found_$tmp_ext=yes
3531 + if test $tmp_ext = c; then
3537 + mpn_objects="$mpn_objects $tmp_fn$tmp_u.lo"
3538 + mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/$tmp_fn$tmp_u.lo"
3539 + AC_CONFIG_LINKS(mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext)
3540 + gmp_srclinks="$gmp_srclinks mpn/$tmp_fn.$tmp_ext"
3542 + # Duplicate AC_DEFINEs are harmless, so it doesn't matter
3543 + # that multi-function files get grepped here repeatedly.
3544 + # The PROLOGUE pattern excludes the optional second parameter.
3546 + sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ;
3547 + sed -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file
3549 + for gmp_tmp in $gmp_ep; do
3550 + AC_DEFINE_UNQUOTED(HAVE_NATIVE_$gmp_tmp)
3551 + eval HAVE_NATIVE_$gmp_tmp=yes
3555 + sqr_basecase) sqr_basecase_source=$tmp_file ;;
3561 + if test $found = yes; then break ; fi
3563 + if test $found = yes; then break ; fi
3566 + if test $found = no; then
3567 + for tmp_optional in $gmp_mpn_functions_optional; do
3568 + if test $tmp_optional = $tmp_fn; then
3572 + if test $found = no; then
3573 + AC_MSG_ERROR([no version of $tmp_fn found in path: $path])
3578 +# All cycle counters are .asm files currently
3579 +if test -n "$SPEED_CYCLECOUNTER_OBJ"; then
3583 +dnl The following list only needs to have templates for those defines which
3584 +dnl are going to be tested by the code, there's no need to have every
3585 +dnl possible mpn routine.
3587 +AH_VERBATIM([HAVE_NATIVE],
3588 +[/* Define to 1 each of the following for which a native (ie. CPU specific)
3589 + implementation of the corresponding routine exists. */
3590 +#undef HAVE_NATIVE_mpn_add_n
3591 +#undef HAVE_NATIVE_mpn_add_n_sub_n
3592 +#undef HAVE_NATIVE_mpn_add_nc
3593 +#undef HAVE_NATIVE_mpn_addaddmul_1msb0
3594 +#undef HAVE_NATIVE_mpn_addlsh1_n
3595 +#undef HAVE_NATIVE_mpn_addlsh2_n
3596 +#undef HAVE_NATIVE_mpn_addlsh_n
3597 +#undef HAVE_NATIVE_mpn_addlsh1_nc
3598 +#undef HAVE_NATIVE_mpn_addlsh2_nc
3599 +#undef HAVE_NATIVE_mpn_addlsh_nc
3600 +#undef HAVE_NATIVE_mpn_addlsh1_n_ip1
3601 +#undef HAVE_NATIVE_mpn_addlsh2_n_ip1
3602 +#undef HAVE_NATIVE_mpn_addlsh_n_ip1
3603 +#undef HAVE_NATIVE_mpn_addlsh1_nc_ip1
3604 +#undef HAVE_NATIVE_mpn_addlsh2_nc_ip1
3605 +#undef HAVE_NATIVE_mpn_addlsh_nc_ip1
3606 +#undef HAVE_NATIVE_mpn_addlsh1_n_ip2
3607 +#undef HAVE_NATIVE_mpn_addlsh2_n_ip2
3608 +#undef HAVE_NATIVE_mpn_addlsh_n_ip2
3609 +#undef HAVE_NATIVE_mpn_addlsh1_nc_ip2
3610 +#undef HAVE_NATIVE_mpn_addlsh2_nc_ip2
3611 +#undef HAVE_NATIVE_mpn_addlsh_nc_ip2
3612 +#undef HAVE_NATIVE_mpn_addmul_1c
3613 +#undef HAVE_NATIVE_mpn_addmul_2
3614 +#undef HAVE_NATIVE_mpn_addmul_3
3615 +#undef HAVE_NATIVE_mpn_addmul_4
3616 +#undef HAVE_NATIVE_mpn_addmul_5
3617 +#undef HAVE_NATIVE_mpn_addmul_6
3618 +#undef HAVE_NATIVE_mpn_addmul_7
3619 +#undef HAVE_NATIVE_mpn_addmul_8
3620 +#undef HAVE_NATIVE_mpn_addmul_2s
3621 +#undef HAVE_NATIVE_mpn_and_n
3622 +#undef HAVE_NATIVE_mpn_andn_n
3623 +#undef HAVE_NATIVE_mpn_bdiv_dbm1c
3624 +#undef HAVE_NATIVE_mpn_bdiv_q_1
3625 +#undef HAVE_NATIVE_mpn_pi1_bdiv_q_1
3626 +#undef HAVE_NATIVE_mpn_cnd_add_n
3627 +#undef HAVE_NATIVE_mpn_cnd_sub_n
3628 +#undef HAVE_NATIVE_mpn_com
3629 +#undef HAVE_NATIVE_mpn_copyd
3630 +#undef HAVE_NATIVE_mpn_copyi
3631 +#undef HAVE_NATIVE_mpn_div_qr_1n_pi1
3632 +#undef HAVE_NATIVE_mpn_div_qr_2
3633 +#undef HAVE_NATIVE_mpn_divexact_1
3634 +#undef HAVE_NATIVE_mpn_divexact_by3c
3635 +#undef HAVE_NATIVE_mpn_divrem_1
3636 +#undef HAVE_NATIVE_mpn_divrem_1c
3637 +#undef HAVE_NATIVE_mpn_divrem_2
3638 +#undef HAVE_NATIVE_mpn_gcd_1
3639 +#undef HAVE_NATIVE_mpn_hamdist
3640 +#undef HAVE_NATIVE_mpn_invert_limb
3641 +#undef HAVE_NATIVE_mpn_ior_n
3642 +#undef HAVE_NATIVE_mpn_iorn_n
3643 +#undef HAVE_NATIVE_mpn_lshift
3644 +#undef HAVE_NATIVE_mpn_lshiftc
3645 +#undef HAVE_NATIVE_mpn_lshsub_n
3646 +#undef HAVE_NATIVE_mpn_mod_1
3647 +#undef HAVE_NATIVE_mpn_mod_1_1p
3648 +#undef HAVE_NATIVE_mpn_mod_1c
3649 +#undef HAVE_NATIVE_mpn_mod_1s_2p
3650 +#undef HAVE_NATIVE_mpn_mod_1s_4p
3651 +#undef HAVE_NATIVE_mpn_mod_34lsub1
3652 +#undef HAVE_NATIVE_mpn_modexact_1_odd
3653 +#undef HAVE_NATIVE_mpn_modexact_1c_odd
3654 +#undef HAVE_NATIVE_mpn_mul_1
3655 +#undef HAVE_NATIVE_mpn_mul_1c
3656 +#undef HAVE_NATIVE_mpn_mul_2
3657 +#undef HAVE_NATIVE_mpn_mul_3
3658 +#undef HAVE_NATIVE_mpn_mul_4
3659 +#undef HAVE_NATIVE_mpn_mul_5
3660 +#undef HAVE_NATIVE_mpn_mul_6
3661 +#undef HAVE_NATIVE_mpn_mul_basecase
3662 +#undef HAVE_NATIVE_mpn_nand_n
3663 +#undef HAVE_NATIVE_mpn_nior_n
3664 +#undef HAVE_NATIVE_mpn_popcount
3665 +#undef HAVE_NATIVE_mpn_preinv_divrem_1
3666 +#undef HAVE_NATIVE_mpn_preinv_mod_1
3667 +#undef HAVE_NATIVE_mpn_redc_1
3668 +#undef HAVE_NATIVE_mpn_redc_2
3669 +#undef HAVE_NATIVE_mpn_rsblsh1_n
3670 +#undef HAVE_NATIVE_mpn_rsblsh2_n
3671 +#undef HAVE_NATIVE_mpn_rsblsh_n
3672 +#undef HAVE_NATIVE_mpn_rsblsh1_nc
3673 +#undef HAVE_NATIVE_mpn_rsblsh2_nc
3674 +#undef HAVE_NATIVE_mpn_rsblsh_nc
3675 +#undef HAVE_NATIVE_mpn_rsh1add_n
3676 +#undef HAVE_NATIVE_mpn_rsh1add_nc
3677 +#undef HAVE_NATIVE_mpn_rsh1sub_n
3678 +#undef HAVE_NATIVE_mpn_rsh1sub_nc
3679 +#undef HAVE_NATIVE_mpn_rshift
3680 +#undef HAVE_NATIVE_mpn_sqr_basecase
3681 +#undef HAVE_NATIVE_mpn_sqr_diagonal
3682 +#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
3683 +#undef HAVE_NATIVE_mpn_sub_n
3684 +#undef HAVE_NATIVE_mpn_sub_nc
3685 +#undef HAVE_NATIVE_mpn_sublsh1_n
3686 +#undef HAVE_NATIVE_mpn_sublsh2_n
3687 +#undef HAVE_NATIVE_mpn_sublsh_n
3688 +#undef HAVE_NATIVE_mpn_sublsh1_nc
3689 +#undef HAVE_NATIVE_mpn_sublsh2_nc
3690 +#undef HAVE_NATIVE_mpn_sublsh_nc
3691 +#undef HAVE_NATIVE_mpn_sublsh1_n_ip1
3692 +#undef HAVE_NATIVE_mpn_sublsh2_n_ip1
3693 +#undef HAVE_NATIVE_mpn_sublsh_n_ip1
3694 +#undef HAVE_NATIVE_mpn_sublsh1_nc_ip1
3695 +#undef HAVE_NATIVE_mpn_sublsh2_nc_ip1
3696 +#undef HAVE_NATIVE_mpn_sublsh_nc_ip1
3697 +#undef HAVE_NATIVE_mpn_submul_1c
3698 +#undef HAVE_NATIVE_mpn_tabselect
3699 +#undef HAVE_NATIVE_mpn_udiv_qrnnd
3700 +#undef HAVE_NATIVE_mpn_udiv_qrnnd_r
3701 +#undef HAVE_NATIVE_mpn_umul_ppmm
3702 +#undef HAVE_NATIVE_mpn_umul_ppmm_r
3703 +#undef HAVE_NATIVE_mpn_xor_n
3704 +#undef HAVE_NATIVE_mpn_xnor_n])
3707 +# Don't demand an m4 unless it's actually needed.
3708 +if test $found_asm = yes; then
3710 + GMP_M4_M4WRAP_SPURIOUS
3712 +# It's unclear why this m4-not-needed stuff was ever done.
3713 +# if test -z "$M4" ; then
3718 +# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
3719 +if test $found_asm = no && test $found_S = no; then
3720 + gmp_asm_syntax_testing=no
3723 +if test "$gmp_asm_syntax_testing" != no; then
3726 + GMP_ASM_LABEL_SUFFIX
3728 + GMP_ASM_GLOBL_ATTR
3729 + GMP_ASM_UNDERSCORE
3733 + GMP_ASM_LSYM_PREFIX
3739 + # for both pa32 and pa64
3740 + GMP_INCLUDE_MPN(pa32/pa-defs.m4)
3743 + GMP_ASM_IA64_ALIGN_OK
3746 + GMP_ASM_M68K_INSTRUCTION
3747 + GMP_ASM_M68K_ADDRESSING
3748 + GMP_ASM_M68K_BRANCHES
3750 + [powerpc*-*-* | power[3-9]-*-*])
3751 + GMP_ASM_POWERPC_PIC_ALWAYS
3752 + GMP_ASM_POWERPC_R_REGISTERS
3753 + GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4)
3755 + # Check for Linux ELFv2 ABI
3757 +[#if _CALL_ELF == 2
3760 + [GMP_DEFINE_RAW(["define(<ELFv2_ABI>)"])])
3765 + mode64) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;;
3766 + *) GMP_INCLUDE_MPN(powerpc32/aix.m4) ;;
3769 + *-*-linux* | *-*-*bsd*)
3771 + mode64) GMP_INCLUDE_MPN(powerpc64/elf.m4) ;;
3772 + mode32 | 32) GMP_INCLUDE_MPN(powerpc32/elf.m4) ;;
3777 + mode64) GMP_INCLUDE_MPN(powerpc64/darwin.m4) ;;
3778 + mode32 | 32) GMP_INCLUDE_MPN(powerpc32/darwin.m4) ;;
3782 + # Assume unrecognized operating system is the powerpc eABI
3783 + GMP_INCLUDE_MPN(powerpc32/eabi.m4)
3788 + GMP_INCLUDE_MPN(powerpc32/aix.m4)
3793 + GMP_ASM_SPARC_REGISTER
3796 + GMP_ASM_SPARC_GOTDATA
3797 + GMP_ASM_SPARC_SHARED_THUNKS
3799 + X86_PATTERN | X86_64_PATTERN)
3800 + GMP_ASM_ALIGN_FILL_0x90
3803 + GMP_INCLUDE_MPN(x86/x86-defs.m4)
3804 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86)
3806 + GMP_ASM_X86_GOT_UNDERSCORE
3807 + GMP_ASM_X86_SHLDL_CL
3808 + case $enable_profiling in
3809 + prof | gprof) GMP_ASM_X86_MCOUNT ;;
3813 + GMP_INCLUDE_MPN(x86/darwin.m4) ;;
3817 + GMP_INCLUDE_MPN(x86_64/x86_64-defs.m4)
3818 + AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86_64)
3821 + GMP_INCLUDE_MPN(x86_64/darwin.m4) ;;
3822 + *-*-mingw* | *-*-cygwin)
3823 + GMP_INCLUDE_MPN(x86_64/dos64.m4) ;;
3825 + GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;;
3833 +# For --enable-minithres, prepend "minithres" to path so that its special
3834 +# gmp-mparam.h will be used.
3835 +if test $enable_minithres = yes; then
3836 + path="minithres $path"
3839 +# Create link for gmp-mparam.h.
3841 +for gmp_mparam_dir in $path; do
3842 + test "$no_create" = yes || rm -f gmp-mparam.h
3843 + tmp_file=$srcdir/mpn/$gmp_mparam_dir/gmp-mparam.h
3844 + if test -f $tmp_file; then
3845 + AC_CONFIG_LINKS(gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h)
3846 + gmp_srclinks="$gmp_srclinks gmp-mparam.h"
3847 + gmp_mparam_source=$tmp_file
3851 +if test -z "$gmp_mparam_source"; then
3852 + AC_MSG_ERROR([no version of gmp-mparam.h found in path: $path])
3855 +# For a helpful message from tune/tuneup.c
3856 +gmp_mparam_suggest=$gmp_mparam_source
3857 +if test "$gmp_mparam_dir" = generic; then
3858 + for i in $path; do break; done
3859 + if test "$i" != generic; then
3860 + gmp_mparam_suggest="new file $srcdir/mpn/$i/gmp-mparam.h"
3863 +AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source",
3864 +[The gmp-mparam.h file (a string) the tune program should suggest updating.])
3867 +# Copy relevant parameters from gmp-mparam.h to config.m4.
3868 +# We only do this for parameters that are used by some assembly files.
3869 +# Fat binaries do this on a per-file basis, so skip in that case.
3871 +if test -z "$fat_path"; then
3872 + for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do
3873 + value=`sed -n 's/^#define '$i'[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
3874 + if test -n "$value"; then
3875 + GMP_DEFINE_RAW(["define(<$i>,<$value>)"])
3881 +# Sizes of some types, needed at preprocessing time.
3883 +# FIXME: The assumption that GMP_LIMB_BITS is 8*sizeof(mp_limb_t) might
3884 +# be slightly rash, but it's true everywhere we know of and ought to be true
3885 +# of any sensible system. In a generic C build, grepping LONG_BIT out of
3886 +# <limits.h> might be an alternative, for maximum portability.
3888 +AC_CHECK_SIZEOF(void *)
3889 +AC_CHECK_SIZEOF(unsigned short)
3890 +AC_CHECK_SIZEOF(unsigned)
3891 +AC_CHECK_SIZEOF(unsigned long)
3892 +AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H)
3893 +if test "$ac_cv_sizeof_mp_limb_t" = 0; then
3894 + AC_MSG_ERROR([Oops, mp_limb_t doesn't seem to work])
3896 +AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`)
3897 +GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"])
3899 +# Check compiler limb size matches gmp-mparam.h
3901 +# FIXME: Some of the cycle counter objects in the tune directory depend on
3902 +# the size of ulong, it'd be possible to check that here, though a mismatch
3903 +# probably wouldn't want to be fatal, none of the libgmp assembler code
3904 +# depends on ulong.
3906 +mparam_bits=[`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`]
3907 +if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then
3908 + if test "$test_CFLAGS" = set; then
3909 + AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
3910 +in this configuration expects $mparam_bits bits.
3911 +You appear to have set \$CFLAGS, perhaps you also need to tell GMP the
3912 +intended ABI, see "ABI and ISA" in the manual.])
3914 + AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
3915 +in this configuration expects $mparam_bits bits.])
3919 +GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$GMP_LIMB_BITS)"])
3920 +GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"])
3921 +GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"])
3924 +AC_SUBST(mpn_objects)
3925 +AC_SUBST(mpn_objs_in_libgmp)
3926 +AC_SUBST(gmp_srclinks)
3929 +# A recompiled sqr_basecase for use in the tune program, if necessary.
3931 +test -d tune || mkdir tune
3932 +case $sqr_basecase_source in
3934 + sqr_max=[`sed -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`]
3935 + if test -n "$sqr_max"; then
3936 + TUNE_SQR_OBJ=sqr_asm.o
3937 + AC_DEFINE_UNQUOTED(TUNE_SQR_TOOM2_MAX,$sqr_max,
3938 + [Maximum size the tune program can test for SQR_TOOM2_THRESHOLD])
3940 + cat >tune/sqr_basecase.c <<EOF
3941 +/* not sure that an empty file can compile, so put in a dummy */
3942 +int sqr_basecase_dummy;
3947 + AC_DEFINE(TUNE_SQR_TOOM2_MAX,SQR_TOOM2_MAX_GENERIC)
3948 + cat >tune/sqr_basecase.c <<EOF
3949 +#define TUNE_PROGRAM_BUILD 1
3950 +#define TUNE_PROGRAM_BUILD_SQR 1
3951 +#include "mpn/sqr_basecase.c"
3955 +AC_SUBST(TUNE_SQR_OBJ)
3958 +# Configs for demos/pexpr.c.
3960 +AC_CONFIG_FILES(demos/pexpr-config.h:demos/pexpr-config-h.in)
3961 +GMP_SUBST_CHECK_FUNCS(clock, cputime, getrusage, gettimeofday, sigaction, sigaltstack, sigstack)
3962 +GMP_SUBST_CHECK_HEADERS(sys/resource.h)
3963 +AC_CHECK_TYPES([stack_t], HAVE_STACK_T_01=1, HAVE_STACK_T_01=0,
3964 + [#include <signal.h>])
3965 +AC_SUBST(HAVE_STACK_T_01)
3967 +# Configs for demos/calc directory
3969 +# AC_SUBST+AC_CONFIG_FILES is used for calc-config.h, rather than AC_DEFINE+
3970 +# AC_CONFIG_HEADERS, since with the latter automake (1.8) will then put the
3971 +# directory (ie. demos/calc) into $(DEFAULT_INCLUDES) for every Makefile.in,
3972 +# which would look very strange.
3974 +# -lcurses is required by libreadline. On a typical SVR4 style system this
3975 +# normally doesn't have to be given explicitly, since libreadline.so will
3976 +# have a NEEDED record for it. But if someone for some reason is using only
3977 +# a static libreadline.a then we must give -lcurses. Readline (as of
3978 +# version 4.3) doesn't use libtool, so we can't rely on a .la to cover
3979 +# necessary dependencies.
3981 +# On a couple of systems we've seen libreadline available, but the headers
3982 +# not in the default include path, so check for readline/readline.h. We've
3983 +# also seen readline/history.h missing, not sure if that's just a broken
3984 +# install or a very old version, but check that too.
3986 +AC_CONFIG_FILES(demos/calc/calc-config.h:demos/calc/calc-config-h.in)
3988 +if test $with_readline != no; then
3989 + AC_CHECK_LIB(ncurses, tputs, [LIBCURSES=-lncurses],
3990 + [AC_CHECK_LIB(curses, tputs, [LIBCURSES=-lcurses])])
3992 +AC_SUBST(LIBCURSES)
3993 +use_readline=$with_readline
3994 +if test $with_readline = detect; then
3996 + AC_CHECK_LIB(readline, readline,
3997 + [AC_CHECK_HEADER(readline/readline.h,
3998 + [AC_CHECK_HEADER(readline/history.h, use_readline=yes)])],
4000 + AC_MSG_CHECKING(readline detected)
4001 + AC_MSG_RESULT($use_readline)
4003 +if test $use_readline = yes; then
4004 + AC_SUBST(WITH_READLINE_01, 1)
4005 + AC_SUBST(LIBREADLINE, -lreadline)
4007 + WITH_READLINE_01=0
4012 +# Configs for demos/expr directory
4014 +# Libtool already runs an AC_CHECK_TOOL for ranlib, but we give
4015 +# AC_PROG_RANLIB anyway since automake is supposed to complain if it's not
4016 +# called. (Automake 1.8.4 doesn't, at least not when the only library is in
4017 +# an EXTRA_LIBRARIES.)
4022 +# Create config.m4.
4026 +# FIXME: Upcoming version of autoconf/automake may not like broken lines.
4027 +# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
4029 +AC_OUTPUT(Makefile \
4030 + mpf/Makefile mpn/Makefile mpq/Makefile \
4031 + mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile \
4032 + tests/Makefile tests/devel/Makefile \
4033 + tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \
4034 + tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \
4035 + tests/cxx/Makefile \
4036 + doc/Makefile tune/Makefile \
4037 + demos/Makefile demos/calc/Makefile demos/expr/Makefile \
4040 +AC_MSG_NOTICE([summary of build options:
4042 + Version: ${PACKAGE_STRING}
4043 + Host type: ${host}
4045 + Install prefix: ${prefix}
4047 + Static libraries: ${enable_static}
4048 + Shared libraries: ${enable_shared}
4051 +if test x$cross_compiling = xyes ; then
4053 + *-*-mingw* | *-*-cygwin)
4054 + if test x$ABI = x64 ; then
4055 + AC_MSG_NOTICE([If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.])
4057 + AC_MSG_NOTICE([If wine is installed, use make check TESTS_ENVIRONMENT=wine.])