1dnl Process this file with autoconf to produce a configure script. 2 3 4define(GMP_COPYRIGHT,[[ 5 6Copyright 1996-2020 Free Software Foundation, Inc. 7 8This file is part of the GNU MP Library. 9 10The GNU MP Library is free software; you can redistribute it and/or modify 11it under the terms of either: 12 13 * the GNU Lesser General Public License as published by the Free 14 Software Foundation; either version 3 of the License, or (at your 15 option) any later version. 16 17or 18 19 * the GNU General Public License as published by the Free Software 20 Foundation; either version 2 of the License, or (at your option) any 21 later version. 22 23or both in parallel, as here. 24 25The GNU MP Library is distributed in the hope that it will be useful, but 26WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 27or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28for more details. 29 30You should have received copies of the GNU General Public License and the 31GNU Lesser General Public License along with the GNU MP Library. If not, 32see https://www.gnu.org/licenses/. 33]]) 34 35AC_COPYRIGHT(GMP_COPYRIGHT) 36AH_TOP(/*GMP_COPYRIGHT*/) 37 38AC_REVISION($Revision$) 39AC_PREREQ(2.59) 40AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html], gmp) 41AC_CONFIG_SRCDIR(gmp-impl.h) 42m4_pattern_forbid([^[ \t]*GMP_]) 43m4_pattern_allow(GMP_LDFLAGS) 44m4_pattern_allow(GMP_LIMB_BITS) 45m4_pattern_allow(GMP_MPARAM_H_SUGGEST) 46m4_pattern_allow(GMP_NAIL_BITS) 47m4_pattern_allow(GMP_NUMB_BITS) 48m4_pattern_allow(GMP_NONSTD_ABI) 49m4_pattern_allow(GMP_CPU_TYPE) 50m4_pattern_allow(GMP_AVX_NOT_REALLY_AVAILABLE) 51 52# If --target is not used then $target_alias is empty, but if say 53# "./configure athlon-pc-freebsd3.5" is used, then all three of 54# $build_alias, $host_alias and $target_alias are set to 55# "athlon-pc-freebsd3.5". 56# 57if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then 58 AC_MSG_ERROR([--target is not appropriate for GMP 59Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system 60explicitly. Use --host if cross-compiling (see "Installing GMP" in the 61manual for more on this).]) 62fi 63 64GMP_INIT(config.m4) 65 66AC_CANONICAL_HOST 67 68dnl Automake "no-dependencies" is used because include file dependencies 69dnl are not useful to us. Pretty much everything depends just on gmp.h, 70dnl gmp-impl.h and longlong.h, and yet only rarely does everything need to 71dnl be rebuilt for changes to those files. 72dnl 73dnl "no-dependencies" also helps with the way we're setup to run 74dnl AC_PROG_CXX only conditionally. If dependencies are used then recent 75dnl automake (eg 1.7.2) appends an AM_CONDITIONAL to AC_PROG_CXX, and then 76dnl gets upset if it's not actually executed. 77dnl 78dnl Note that there's a copy of these options in the top-level Makefile.am, 79dnl so update there too if changing anything. 80dnl 81AM_INIT_AUTOMAKE([1.8 gnu no-dependencies subdir-objects]) 82AC_CONFIG_HEADERS(config.h:config.in) 83AM_MAINTAINER_MODE 84 85 86AC_ARG_ENABLE(assert, 87AC_HELP_STRING([--enable-assert],[enable ASSERT checking [default=no]]), 88[case $enableval in 89yes|no) ;; 90*) AC_MSG_ERROR([bad value $enableval for --enable-assert, need yes or no]) ;; 91esac], 92[enable_assert=no]) 93 94if test "$enable_assert" = "yes"; then 95 AC_DEFINE(WANT_ASSERT,1, 96 [Define to 1 to enable ASSERT checking, per --enable-assert]) 97 want_assert_01=1 98else 99 want_assert_01=0 100fi 101GMP_DEFINE_RAW(["define(<WANT_ASSERT>,$want_assert_01)"]) 102 103 104AC_ARG_ENABLE(alloca, 105AC_HELP_STRING([--enable-alloca],[how to get temp memory [default=reentrant]]), 106[case $enableval in 107alloca|malloc-reentrant|malloc-notreentrant) ;; 108yes|no|reentrant|notreentrant) ;; 109debug) ;; 110*) 111 AC_MSG_ERROR([bad value $enableval for --enable-alloca, need one of: 112yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug]) ;; 113esac], 114[enable_alloca=reentrant]) 115 116 117# IMPROVE ME: The default for C++ is disabled. The tests currently 118# performed below for a working C++ compiler are not particularly strong, 119# and in general can't be expected to get the right setup on their own. The 120# most significant problem is getting the ABI the same. Defaulting CXXFLAGS 121# to CFLAGS takes only a small step towards this. It's also probably worth 122# worrying whether the C and C++ runtimes from say gcc and a vendor C++ can 123# work together. Some rather broken C++ installations were encountered 124# during testing, and though such things clearly aren't GMP's problem, if 125# --enable-cxx=detect were to be the default then some careful checks of 126# which, if any, C++ compiler on the system is up to scratch would be 127# wanted. 128# 129AC_ARG_ENABLE(cxx, 130AC_HELP_STRING([--enable-cxx],[enable C++ support [default=no]]), 131[case $enableval in 132yes|no|detect) ;; 133*) AC_MSG_ERROR([bad value $enableval for --enable-cxx, need yes/no/detect]) ;; 134esac], 135[enable_cxx=no]) 136 137 138AC_ARG_ENABLE(assembly, 139AC_HELP_STRING([--enable-assembly],[enable the use of assembly loops [default=yes]]), 140[case $enableval in 141yes|no) ;; 142*) AC_MSG_ERROR([bad value $enableval for --enable-assembly, need yes or no]) ;; 143esac], 144[enable_assembly=yes]) 145 146 147AC_ARG_ENABLE(fft, 148AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [default=yes]]), 149[case $enableval in 150yes|no) ;; 151*) AC_MSG_ERROR([bad value $enableval for --enable-fft, need yes or no]) ;; 152esac], 153[enable_fft=yes]) 154 155if test "$enable_fft" = "yes"; then 156 AC_DEFINE(WANT_FFT,1, 157 [Define to 1 to enable FFTs for multiplication, per --enable-fft]) 158fi 159 160 161AC_ARG_ENABLE(old-fft-full, 162AC_HELP_STRING([--enable-old-fft-full],[enable old mpn_mul_fft_full for multiplication [default=no]]), 163[case $enableval in 164yes|no) ;; 165*) AC_MSG_ERROR([bad value $enableval for --enable-old-fft-full, need yes or no]) ;; 166esac], 167[enable_old_fft_full=no]) 168 169if test "$enable_old_fft_full" = "yes"; then 170 AC_DEFINE(WANT_OLD_FFT_FULL,1, 171 [Define to 1 to enable old mpn_mul_fft_full for multiplication, per --enable-old-fft-full]) 172fi 173 174 175AC_ARG_ENABLE(nails, 176AC_HELP_STRING([--enable-nails],[use nails on limbs [default=no]]), 177[case $enableval in 178[yes|no|[02468]|[0-9][02468]]) ;; 179[*[13579]]) 180 AC_MSG_ERROR([bad value $enableval for --enable-nails, only even nail sizes supported]) ;; 181*) 182 AC_MSG_ERROR([bad value $enableval for --enable-nails, need yes/no/number]) ;; 183esac], 184[enable_nails=no]) 185 186case $enable_nails in 187yes) GMP_NAIL_BITS=2 ;; 188no) GMP_NAIL_BITS=0 ;; 189*) GMP_NAIL_BITS=$enable_nails ;; 190esac 191AC_SUBST(GMP_NAIL_BITS) 192 193 194AC_ARG_ENABLE(profiling, 195AC_HELP_STRING([--enable-profiling], 196 [build with profiler support [default=no]]), 197[case $enableval in 198no|prof|gprof|instrument) ;; 199*) AC_MSG_ERROR([bad value $enableval for --enable-profiling, need no/prof/gprof/instrument]) ;; 200esac], 201[enable_profiling=no]) 202 203case $enable_profiling in 204 prof) 205 AC_DEFINE(WANT_PROFILING_PROF, 1, 206 [Define to 1 if --enable-profiling=prof]) 207 ;; 208 gprof) 209 AC_DEFINE(WANT_PROFILING_GPROF, 1, 210 [Define to 1 if --enable-profiling=gprof]) 211 ;; 212 instrument) 213 AC_DEFINE(WANT_PROFILING_INSTRUMENT, 1, 214 [Define to 1 if --enable-profiling=instrument]) 215 ;; 216esac 217 218GMP_DEFINE_RAW(["define(<WANT_PROFILING>,<\`$enable_profiling'>)"]) 219 220# -fomit-frame-pointer is incompatible with -pg on some chips 221if test "$enable_profiling" = gprof; then 222 fomit_frame_pointer= 223else 224 fomit_frame_pointer="-fomit-frame-pointer" 225fi 226 227 228AC_ARG_WITH(readline, 229AC_HELP_STRING([--with-readline], 230 [readline support in demo programs [default=detect]]), 231[case $withval in 232yes|no|detect) ;; 233*) AC_MSG_ERROR([bad value $withval for --with-readline, need yes/no/detect]) ;; 234esac], 235[with_readline=detect]) 236 237 238AC_ARG_ENABLE(fat, 239AC_HELP_STRING([--enable-fat], 240 [build fat libraries on systems that support it [default=no]]), 241[case $enableval in 242yes|no) ;; 243*) AC_MSG_ERROR([bad value $enableval for --enable-fat, need yes or no]) ;; 244esac], 245[enable_fat=no]) 246 247 248AC_ARG_ENABLE(minithres, 249AC_HELP_STRING([--enable-minithres], 250 [choose minimal thresholds for testing [default=no]]), 251[case $enableval in 252yes|no) ;; 253*) AC_MSG_ERROR([bad value $enableval for --enable-minithres, need yes or no]) ;; 254esac], 255[enable_minithres=no]) 256 257 258AC_ARG_ENABLE(fake-cpuid, 259AC_HELP_STRING([--enable-fake-cpuid],[enable GMP_CPU_TYPE faking cpuid [default=no]]), 260[case $enableval in 261yes|no) ;; 262*) AC_MSG_ERROR([bad value $enableval for --enable-fake-cpuid, need yes or no]) ;; 263esac], 264[enable_fake_cpuid=no]) 265 266if test "$enable_fake_cpuid" = "yes"; then 267 AC_DEFINE(WANT_FAKE_CPUID,1, 268 [Define to 1 to enable GMP_CPU_TYPE faking cpuid, per --enable-fake-cpuid]) 269fi 270 271 272if test $enable_fat = yes && test $enable_assembly = no ; then 273 AC_MSG_ERROR([when doing a fat build, disabling assembly will not work]) 274fi 275 276if test $enable_fake_cpuid = yes && test $enable_fat = no ; then 277 AC_MSG_ERROR([--enable-fake-cpuid requires --enable-fat]) 278fi 279 280 281tmp_host=`echo $host_cpu | sed 's/\./_/'` 282AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host) 283GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST) 284 285dnl The HAVE_HOST_CPU_ list here only needs to have entries for those which 286dnl are going to be tested, not everything that can possibly be selected. 287dnl 288dnl The HAVE_HOST_CPU_FAMILY_ list similarly, and note that the AC_DEFINEs 289dnl for these are under the cpu specific setups below. 290 291AH_VERBATIM([HAVE_HOST_CPU_1], 292[/* Define one of these to 1 for the host CPU family. 293 If your CPU is not in any of these families, leave all undefined. 294 For an AMD64 chip, define "x86" in ABI=32, but not in ABI=64. */ 295#undef HAVE_HOST_CPU_FAMILY_alpha 296#undef HAVE_HOST_CPU_FAMILY_m68k 297#undef HAVE_HOST_CPU_FAMILY_power 298#undef HAVE_HOST_CPU_FAMILY_powerpc 299#undef HAVE_HOST_CPU_FAMILY_x86 300#undef HAVE_HOST_CPU_FAMILY_x86_64 301 302/* Define one of the following to 1 for the host CPU, as per the output of 303 ./config.guess. If your CPU is not listed here, leave all undefined. */ 304#undef HAVE_HOST_CPU_alphaev67 305#undef HAVE_HOST_CPU_alphaev68 306#undef HAVE_HOST_CPU_alphaev7 307#undef HAVE_HOST_CPU_m68020 308#undef HAVE_HOST_CPU_m68030 309#undef HAVE_HOST_CPU_m68040 310#undef HAVE_HOST_CPU_m68060 311#undef HAVE_HOST_CPU_m68360 312#undef HAVE_HOST_CPU_powerpc604 313#undef HAVE_HOST_CPU_powerpc604e 314#undef HAVE_HOST_CPU_powerpc750 315#undef HAVE_HOST_CPU_powerpc7400 316#undef HAVE_HOST_CPU_supersparc 317#undef HAVE_HOST_CPU_i386 318#undef HAVE_HOST_CPU_i586 319#undef HAVE_HOST_CPU_i686 320#undef HAVE_HOST_CPU_pentium 321#undef HAVE_HOST_CPU_pentiummmx 322#undef HAVE_HOST_CPU_pentiumpro 323#undef HAVE_HOST_CPU_pentium2 324#undef HAVE_HOST_CPU_pentium3 325#undef HAVE_HOST_CPU_pentium4 326#undef HAVE_HOST_CPU_core2 327#undef HAVE_HOST_CPU_nehalem 328#undef HAVE_HOST_CPU_westmere 329#undef HAVE_HOST_CPU_sandybridge 330#undef HAVE_HOST_CPU_ivybridge 331#undef HAVE_HOST_CPU_haswell 332#undef HAVE_HOST_CPU_broadwell 333#undef HAVE_HOST_CPU_skylake 334#undef HAVE_HOST_CPU_silvermont 335#undef HAVE_HOST_CPU_goldmont 336#undef HAVE_HOST_CPU_k8 337#undef HAVE_HOST_CPU_k10 338#undef HAVE_HOST_CPU_bulldozer 339#undef HAVE_HOST_CPU_piledriver 340#undef HAVE_HOST_CPU_steamroller 341#undef HAVE_HOST_CPU_excavator 342#undef HAVE_HOST_CPU_zen 343#undef HAVE_HOST_CPU_bobcat 344#undef HAVE_HOST_CPU_jaguar 345#undef HAVE_HOST_CPU_s390_z900 346#undef HAVE_HOST_CPU_s390_z990 347#undef HAVE_HOST_CPU_s390_z9 348#undef HAVE_HOST_CPU_s390_z10 349#undef HAVE_HOST_CPU_s390_z196 350 351/* Define to 1 iff we have a s390 with 64-bit registers. */ 352#undef HAVE_HOST_CPU_s390_zarch]) 353 354 355# Table of compilers, options, and mpn paths. This code has various related 356# purposes 357# 358# - better default CC/CFLAGS selections than autoconf otherwise gives 359# - default CC/CFLAGS selections for extra CPU types specific to GMP 360# - a few tests for known bad compilers 361# - choice of ABIs on suitable systems 362# - selection of corresponding mpn search path 363# 364# After GMP specific searches and tests, the standard autoconf AC_PROG_CC is 365# called. User selections of CC etc are respected. 366# 367# Care is taken not to use macros like AC_TRY_COMPILE during the GMP 368# pre-testing, since they of course depend on AC_PROG_CC, and also some of 369# them cache their results, which is not wanted. 370# 371# The ABI selection mechanism is unique to GMP. All that reaches autoconf 372# is a different selection of CC/CFLAGS according to the best ABI the system 373# supports, and/or what the user selects. Naturally the mpn assembler code 374# selected is very dependent on the ABI. 375# 376# The closest the standard tools come to a notion of ABI is something like 377# "sparc64" which encodes a CPU and an ABI together. This doesn't seem to 378# scale well for GMP, where exact CPU types like "ultrasparc2" are wanted, 379# separate from the ABI used on them. 380# 381# 382# The variables set here are 383# 384# cclist the compiler choices 385# xx_cflags flags for compiler xx 386# xx_cflags_maybe flags for compiler xx, if they work 387# xx_cppflags cpp flags for compiler xx 388# xx_cflags_optlist list of sets of optional flags 389# xx_cflags_yyy set yyy of optional flags for compiler xx 390# xx_ldflags -Wc,-foo flags for libtool linking with compiler xx 391# ar_flags extra flags for $AR 392# nm_flags extra flags for $NM 393# limb limb size, can be "longlong" 394# path mpn search path 395# extra_functions extra mpn functions 396# fat_path fat binary mpn search path [if fat binary desired] 397# fat_functions fat functions 398# fat_thresholds fat thresholds 399# 400# Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are 401# tried, and the first flag that works will be used. An optlist like "arch 402# cpu optimize" can be used to get multiple independent sets of flags tried. 403# The first that works from each will be used. If no flag in a set works 404# then nothing from that set is added. 405# 406# For multiple ABIs, the scheme extends as follows. 407# 408# abilist set of ABI choices 409# cclist_aa compiler choices in ABI aa 410# xx_aa_cflags flags for xx in ABI aa 411# xx_aa_cflags_maybe flags for xx in ABI aa, if they work 412# xx_aa_cppflags cpp flags for xx in ABI aa 413# xx_aa_cflags_optlist list of sets of optional flags in ABI aa 414# xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa 415# xx_aa_ldflags -Wc,-foo flags for libtool linking 416# ar_aa_flags extra flags for $AR in ABI aa 417# nm_aa_flags extra flags for $NM in ABI aa 418# limb_aa limb size in ABI aa, can be "longlong" 419# path_aa mpn search path in ABI aa 420# extra_functions_aa extra mpn functions in ABI aa 421# 422# As a convenience, the unadorned xx_cflags (etc) are used for the last ABI 423# in ablist, if an xx_aa_cflags for that ABI isn't given. For example if 424# abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but 425# for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is 426# defined. This makes it easy to add some 64-bit compilers and flags to an 427# unadorned 32-bit set. 428# 429# limb=longlong (or limb_aa=longlong) applies to all compilers within that 430# ABI. It won't work to have some needing long long and some not, since a 431# single instantiated gmp.h will be used by both. 432# 433# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are 434# also set here, with an ABI suffix. 435# 436# 437# 438# A table-driven approach like this to mapping cpu type to good compiler 439# options is a bit of a maintenance burden, but there's not much uniformity 440# between options specifications on different compilers. Some sort of 441# separately updatable tool might be cute. 442# 443# The use of lots of variables like this, direct and indirect, tends to 444# obscure when and how various things are done, but unfortunately it's 445# pretty much the only way. If shell subroutines were portable then actual 446# code like "if this .. do that" could be written, but attempting the same 447# with full copies of GMP_PROG_CC_WORKS etc expanded at every point would 448# hugely bloat the output. 449 450 451AC_ARG_VAR(ABI, [desired ABI (for processors supporting more than one ABI)]) 452 453# abilist needs to be non-empty, "standard" is just a generic name here 454abilist="standard" 455 456# FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring 457# c89 over cc here. But note that on HP-UX c89 provides a castrated 458# environment, and would want to be excluded somehow. Maybe 459# AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and 460# we don't need to worry. 461# 462cclist="gcc cc" 463 464gcc_cflags="-O2 -pedantic" 465gcc_64_cflags="-O2 -pedantic" 466cc_cflags="-O" 467cc_64_cflags="-O" 468 469SPEED_CYCLECOUNTER_OBJ= 470cyclecounter_size=2 471 472AC_SUBST(HAVE_HOST_CPU_FAMILY_power, 0) 473AC_SUBST(HAVE_HOST_CPU_FAMILY_powerpc,0) 474 475case $host in 476 477 alpha*-*-*) 478 AC_DEFINE(HAVE_HOST_CPU_FAMILY_alpha) 479 case $host_cpu in 480 alphaev5* | alphapca5*) 481 path="alpha/ev5 alpha" ;; 482 alphaev67 | alphaev68 | alphaev7*) 483 path="alpha/ev67 alpha/ev6 alpha" ;; 484 alphaev6) 485 path="alpha/ev6 alpha" ;; 486 *) 487 path="alpha" ;; 488 esac 489 if test "$enable_assembly" = "yes" ; then 490 extra_functions="cntlz" 491 fi 492 gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below 493 gcc_cflags_maybe="-mieee" 494 gcc_cflags_oldas="-Wa,-oldas" # see GMP_GCC_WA_OLDAS. 495 496 # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently. 497 # gcc 2.95 knows -mcpu= ev4, ev5, ev56, pca56, ev6. 498 # gcc 3.0 adds nothing. 499 # gcc 3.1 adds ev45, ev67 (but ev45 is the same as ev4). 500 # gcc 3.2 adds nothing. 501 # 502 # gcc version "2.9-gnupro-99r1" under "-O2 -mcpu=ev6" strikes internal 503 # compiler errors too easily and is rejected by GMP_PROG_CC_WORKS. Each 504 # -mcpu=ev6 below has a fallback to -mcpu=ev56 for this reason. 505 # 506 case $host_cpu in 507 alpha) gcc_cflags_cpu="-mcpu=ev4" ;; 508 alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;; 509 alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;; 510 alphapca56 | alphapca57) 511 gcc_cflags_cpu="-mcpu=pca56" ;; 512 alphaev6) gcc_cflags_cpu="-mcpu=ev6 -mcpu=ev56" ;; 513 alphaev67 | alphaev68 | alphaev7*) 514 gcc_cflags_cpu="-mcpu=ev67 -mcpu=ev6 -mcpu=ev56" ;; 515 esac 516 517 # gcc version "2.9-gnupro-99r1" on alphaev68-dec-osf5.1 has been seen 518 # accepting -mcpu=ev6, but not putting the assembler in the right mode 519 # for what it produces. We need to do this for it, and need to do it 520 # before testing the -mcpu options. 521 # 522 # On old versions of gcc, which don't know -mcpu=, we believe an 523 # explicit -Wa,-mev5 etc will be necessary to put the assembler in 524 # the right mode for our .asm files and longlong.h asm blocks. 525 # 526 # On newer versions of gcc, when -mcpu= is known, we must give a -Wa 527 # which is at least as high as the code gcc will generate. gcc 528 # establishes what it needs with a ".arch" directive, our command line 529 # option seems to override that. 530 # 531 # gas prior to 2.14 doesn't accept -mev67, but -mev6 seems enough for 532 # ctlz and cttz (in 2.10.0 at least). 533 # 534 # OSF `as' accepts ev68 but stupidly treats it as ev4. -arch only seems 535 # to affect insns like ldbu which are expanded as macros when necessary. 536 # Insns like ctlz which were never available as macros are always 537 # accepted and always generate their plain code. 538 # 539 case $host_cpu in 540 alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;; 541 alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;; 542 alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;; 543 alphapca56 | alphapca57) 544 gcc_cflags_asm="-Wa,-arch,pca56 -Wa,-mpca56" ;; 545 alphaev6) gcc_cflags_asm="-Wa,-arch,ev6 -Wa,-mev6" ;; 546 alphaev67 | alphaev68 | alphaev7*) 547 gcc_cflags_asm="-Wa,-arch,ev67 -Wa,-mev67 -Wa,-arch,ev6 -Wa,-mev6" ;; 548 esac 549 550 # It might be better to ask "cc" whether it's Cray C or DEC C, 551 # instead of relying on the OS part of $host. But it's hard to 552 # imagine either of those compilers anywhere except their native 553 # systems. 554 # 555 GMP_INCLUDE_MPN(alpha/alpha-defs.m4) 556 case $host in 557 *-cray-unicos*) 558 cc_cflags="-O" # no -g, it silently disables all optimizations 559 GMP_INCLUDE_MPN(alpha/unicos.m4) 560 # Don't perform any assembly syntax tests on this beast. 561 gmp_asm_syntax_testing=no 562 ;; 563 *-*-osf*) 564 GMP_INCLUDE_MPN(alpha/default.m4) 565 cc_cflags="" 566 cc_cflags_optlist="opt cpu" 567 568 # not sure if -fast works on old versions, so make it optional 569 cc_cflags_opt="-fast -O2" 570 571 # DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6. 572 # Compaq C V6.3-029 adds ev67. 573 # 574 case $host_cpu in 575 alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;; 576 alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;; 577 alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;; 578 alphapca56 | alphapca57) 579 cc_cflags_cpu="-arch~pca56~-tune~pca56" ;; 580 alphaev6) cc_cflags_cpu="-arch~ev6~-tune~ev6" ;; 581 alphaev67 | alphaev68 | alphaev7*) 582 cc_cflags_cpu="-arch~ev67~-tune~ev67 -arch~ev6~-tune~ev6" ;; 583 esac 584 ;; 585 *) 586 GMP_INCLUDE_MPN(alpha/default.m4) 587 ;; 588 esac 589 590 case $host in 591 *-*-unicos*) 592 # tune/alpha.asm assumes int==4bytes but unicos uses int==8bytes 593 ;; 594 *) 595 SPEED_CYCLECOUNTER_OBJ=alpha.lo 596 cyclecounter_size=1 ;; 597 esac 598 ;; 599 600 601 # Cray vector machines. 602 # This must come after alpha* so that we can recognize present and future 603 # vector processors with a wildcard. 604 *-cray-unicos*) 605 gmp_asm_syntax_testing=no 606 cclist="cc" 607 # We used to have -hscalar0 here as a workaround for miscompilation of 608 # mpz/import.c, but let's hope Cray fixes their bugs instead, since 609 # -hscalar0 causes disastrously poor code to be generated. 610 cc_cflags="-O3 -hnofastmd -htask0 -Wa,-B" 611 path="cray" 612 ;; 613 614 615 arm*-*-* | aarch64*-*-*) 616 abilist="32" 617 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 618 gcc_cflags_optlist="arch fpmode neon tune" 619 gcc_64_cflags_optlist="arch tune" 620 gcc_testlist="gcc-arm-umodsi" 621 gcc_64_testlist="" 622 CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo' 623 CALLING_CONVENTIONS_OBJS_64="" 624 cclist_64="gcc cc" 625 any_32_testlist="sizeof-void*-4" 626 any_64_testlist="sizeof-void*-8" 627 628 # This is needed for clang, which is not content with flags like -mfpu=neon 629 # alone. 630 case $host in 631 *-*-*eabi) 632 gcc_cflags_fpmode="-mfloat-abi=softfp" ;; 633 *-*-*eabihf) 634 gcc_cflags_fpmode="-mfloat-abi=hard" ;; 635 *-*-mingw*) 636 limb_64=longlong ;; 637 esac 638 639 # FIXME: We make mandatory compiler options optional here. We should 640 # either enforce them, or organise to strip paths as the corresponding 641 # options fail. 642 case $host_cpu in 643 armxscale | arm7ej | arm9te | arm9e* | arm10* | armv5*) 644 path="arm/v5 arm" 645 gcc_cflags_arch="-march=armv5" 646 ;; 647 armsa1 | arm7t* | arm9t* | armv4t*) 648 path="arm" 649 gcc_cflags_arch="-march=armv4" 650 ;; 651 arm1156 | armv6t2*) 652 path="arm/v6t2 arm/v6 arm/v5 arm" 653 gcc_cflags_arch="-march=armv6t2" 654 ;; 655 arm11* | armv6*) 656 path="arm/v6 arm/v5 arm" 657 gcc_cflags_arch="-march=armv6" 658 ;; 659 armcortexa5 | armv7*) 660 path="arm/v7a/cora5 arm/v6t2 arm/v6 arm/v5 arm" 661 gcc_cflags_arch="-march=armv7-a" 662 gcc_cflags_tune="-mtune=cortex-a5" 663 ;; 664 armcortexa5neon) 665 path="arm/neon arm/v7a/cora5 arm/v6t2 arm/v6 arm/v5 arm" 666 gcc_cflags_neon="-mfpu=neon" 667 gcc_cflags_arch="-march=armv7-a" 668 gcc_cflags_tune="-mtune=cortex-a5" 669 ;; 670 armcortexa7) 671 path="arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm" 672 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 673 gcc_cflags_tune="-mtune=cortex-a7" 674 ;; 675 armcortexa7neon) 676 path="arm/neon arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm" 677 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 678 gcc_cflags_neon="-mfpu=neon" 679 gcc_cflags_tune="-mtune=cortex-a7" 680 ;; 681 armcortexa8) 682 path="arm/v7a/cora8 arm/v6t2 arm/v6 arm/v5 arm" 683 gcc_cflags_arch="-march=armv7-a" 684 gcc_cflags_tune="-mtune=cortex-a8" 685 ;; 686 armcortexa8neon) 687 path="arm/neon arm/v7a/cora8 arm/v6t2 arm/v6 arm/v5 arm" 688 gcc_cflags_arch="-march=armv7-a" 689 gcc_cflags_neon="-mfpu=neon" 690 gcc_cflags_tune="-mtune=cortex-a8" 691 ;; 692 armcortexa9) 693 path="arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm" 694 gcc_cflags_arch="-march=armv7-a" 695 gcc_cflags_tune="-mtune=cortex-a9" 696 ;; 697 armcortexa9neon) 698 path="arm/neon arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm" 699 gcc_cflags_arch="-march=armv7-a" 700 gcc_cflags_neon="-mfpu=neon" 701 gcc_cflags_tune="-mtune=cortex-a9" 702 ;; 703 armcortexa15) 704 path="arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 705 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 706 gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9" 707 ;; 708 armcortexa15neon) 709 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 710 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 711 gcc_cflags_neon="-mfpu=neon" 712 gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9" 713 ;; 714 armcortexa12 | armcortexa17) 715 path="arm/v7a/cora17 arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 716 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 717 gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9" 718 ;; 719 armcortexa12neon | armcortexa17neon) 720 path="arm/v7a/cora17/neon arm/v7a/cora15/neon arm/neon arm/v7a/cora17 arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 721 gcc_cflags_arch="-march=armv7ve -march=armv7-a" 722 gcc_cflags_neon="-mfpu=neon" 723 gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9" 724 ;; 725 armcortexa53 | armcortexa53neon | armcortexa55 | armcortexa55neon) 726 abilist="64 32" 727 path="arm/neon arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm" 728 path_64="arm64/cora53 arm64" 729 gcc_cflags_arch="-march=armv8-a" 730 gcc_cflags_neon="-mfpu=neon" 731 gcc_cflags_tune="-mtune=cortex-a53" 732 ;; 733 armcortexa57 | armcortexa57neon) 734 abilist="64 32" 735 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 736 path_64="arm64/cora57 arm64" 737 gcc_cflags_arch="-march=armv8-a" 738 gcc_cflags_neon="-mfpu=neon" 739 gcc_cflags_tune="-mtune=cortex-a57" 740 ;; 741 [armcortexa7[2-9] | armcortexa7[2-9]neon]) 742 abilist="64 32" 743 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 744 path_64="arm64/cora57 arm64" 745 gcc_cflags_arch="-march=armv8-a" 746 gcc_cflags_neon="-mfpu=neon" 747 gcc_cflags_tune="-mtune=cortex-a72 -mtune=cortex-a57" 748 ;; 749 armexynosm1) 750 abilist="64 32" 751 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 752 path_64="arm64" 753 gcc_cflags_arch="-march=armv8-a" 754 gcc_cflags_neon="-mfpu=neon" 755 gcc_cflags_tune="-mtune=exynosm1" 756 ;; 757 armthunderx) 758 abilist="64 32" 759 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 760 path_64="arm64" 761 gcc_cflags_arch="-march=armv8-a" 762 gcc_cflags_neon="-mfpu=neon" 763 gcc_cflags_tune="-mtune=thunderx" 764 ;; 765 armxgene1) 766 abilist="64 32" 767 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 768 path_64="arm64/xgene1 arm64" 769 gcc_cflags_arch="-march=armv8-a" 770 gcc_cflags_neon="-mfpu=neon" 771 gcc_cflags_tune="-mtune=xgene1" 772 ;; 773 aarch64*) 774 abilist="64 32" 775 path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" 776 path_64="arm64" 777 gcc_cflags_arch="-march=armv8-a" 778 gcc_cflags_neon="-mfpu=neon" 779 gcc_cflags_tune="" 780 ;; 781 *) 782 path="arm" 783 gcc_cflags_arch="-march=armv4" 784 GMP_DEFINE_RAW(["define(<NOTHUMB>,1)"]) 785 ;; 786 esac 787 ;; 788 789 790 # Fujitsu 791 [f30[01]-fujitsu-sysv*]) 792 cclist="gcc vcc" 793 # FIXME: flags for vcc? 794 vcc_cflags="-g" 795 path="fujitsu" 796 ;; 797 798 799 hppa*-*-*) 800 # HP cc (the one sold separately) is K&R by default, but AM_C_PROTOTYPES 801 # will add "-Ae", or "-Aa -D_HPUX_SOURCE", to put it into ansi mode, if 802 # possible. 803 # 804 # gcc for hppa 2.0 can be built either for 2.0n (32-bit) or 2.0w 805 # (64-bit), but not both, so there's no option to choose the desired 806 # mode, we must instead detect which of the two it is. This is done by 807 # checking sizeof(long), either 4 or 8 bytes respectively. Do this in 808 # ABI=1.0 too, in case someone tries to build that with a 2.0w gcc. 809 # 810 gcc_cflags_optlist="arch" 811 gcc_testlist="sizeof-long-4" 812 SPEED_CYCLECOUNTER_OBJ=hppa.lo 813 cyclecounter_size=1 814 815 # FIXME: For hppa2.0*, path should be "pa32/hppa2_0 pa32/hppa1_1 pa32". 816 # (Can't remember why this isn't done already, have to check what .asm 817 # files are available in each and how they run on a typical 2.0 cpu.) 818 # 819 case $host_cpu in 820 hppa1.0*) path="pa32" ;; 821 hppa7000*) path="pa32/hppa1_1 pa32" ;; 822 hppa2.0* | hppa64) 823 path="pa32/hppa2_0 pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;; 824 *) # default to 7100 825 path="pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;; 826 esac 827 828 # gcc 2.7.2.3 knows -mpa-risc-1-0 and -mpa-risc-1-1 829 # gcc 2.95 adds -mpa-risc-2-0, plus synonyms -march=1.0, 1.1 and 2.0 830 # 831 # We don't use -mpa-risc-2-0 in ABI=1.0 because 64-bit registers may not 832 # be saved by the kernel on an old system. Actually gcc (as of 3.2) 833 # only adds a few float instructions with -mpa-risc-2-0, so it would 834 # probably be safe, but let's not take the chance. In any case, a 835 # configuration like --host=hppa2.0 ABI=1.0 is far from optimal. 836 # 837 case $host_cpu in 838 hppa1.0*) gcc_cflags_arch="-mpa-risc-1-0" ;; 839 *) # default to 7100 840 gcc_cflags_arch="-mpa-risc-1-1" ;; 841 esac 842 843 case $host_cpu in 844 hppa1.0*) cc_cflags="+O2" ;; 845 *) # default to 7100 846 cc_cflags="+DA1.1 +O2" ;; 847 esac 848 849 case $host in 850 hppa2.0*-*-* | hppa64-*-*) 851 cclist_20n="gcc cc" 852 abilist="2.0n 1.0" 853 path_20n="pa64" 854 limb_20n=longlong 855 any_20n_testlist="sizeof-long-4" 856 SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo 857 cyclecounter_size_20n=2 858 859 # -mpa-risc-2-0 is only an optional flag, in case an old gcc is 860 # used. Assembler support for 2.0 is essential though, for our asm 861 # files. 862 gcc_20n_cflags="$gcc_cflags" 863 gcc_20n_cflags_optlist="arch" 864 gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1" 865 gcc_20n_testlist="sizeof-long-4 hppa-level-2.0" 866 867 cc_20n_cflags="+DA2.0 +e +O2 -Wl,+vnocompatwarnings" 868 cc_20n_testlist="hpc-hppa-2-0" 869 870 # ABI=2.0w is available for hppa2.0w and hppa2.0, but not for 871 # hppa2.0n, on the assumption that that the latter indicates a 872 # desire for ABI=2.0n. 873 case $host in 874 hppa2.0n-*-*) ;; 875 *) 876 # HPUX 10 and earlier cannot run 2.0w. Not sure about other 877 # systems (GNU/Linux for instance), but lets assume they're ok. 878 case $host in 879 [*-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*]) ;; 880 *) abilist="2.0w $abilist" ;; 881 esac 882 883 cclist_20w="gcc cc" 884 gcc_20w_cflags="$gcc_cflags -mpa-risc-2-0" 885 cc_20w_cflags="+DD64 +O2" 886 cc_20w_testlist="hpc-hppa-2-0" 887 path_20w="pa64" 888 any_20w_testlist="sizeof-long-8" 889 SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo 890 cyclecounter_size_20w=2 891 ;; 892 esac 893 ;; 894 esac 895 ;; 896 897 898 IA64_PATTERN) 899 abilist="64" 900 GMP_INCLUDE_MPN(ia64/ia64-defs.m4) 901 SPEED_CYCLECOUNTER_OBJ=ia64.lo 902 any_32_testlist="sizeof-long-4" 903 904 case $host_cpu in 905 itanium) path="ia64/itanium ia64" ;; 906 itanium2) path="ia64/itanium2 ia64" ;; 907 *) path="ia64" ;; 908 esac 909 910 gcc_64_cflags_optlist="tune" 911 gcc_32_cflags_optlist=$gcc_64_cflags_optlist 912 913 # gcc pre-release 3.4 adds -mtune itanium and itanium2 914 case $host_cpu in 915 itanium) gcc_cflags_tune="-mtune=itanium" ;; 916 itanium2) gcc_cflags_tune="-mtune=itanium2" ;; 917 esac 918 919 case $host in 920 *-*-linux*) 921 cclist="gcc icc" 922 icc_cflags="-no-gcc" 923 icc_cflags_optlist="opt" 924 # Don't use -O3, it is for "large data sets" and also miscompiles GMP. 925 # But icc miscompiles GMP at any optimization level, at higher levels 926 # it miscompiles more files... 927 icc_cflags_opt="-O2 -O1" 928 icc_cflags_opt_maybe="-fp-model~precise" 929 ;; 930 931 *-*-hpux*) 932 # HP cc sometimes gets internal errors if the optimization level is 933 # too high. GMP_PROG_CC_WORKS detects this, the "_opt" fallbacks 934 # let us use whatever seems to work. 935 # 936 abilist="32 64" 937 any_64_testlist="sizeof-long-8" 938 939 cclist_32="gcc cc" 940 path_32="ia64" 941 cc_32_cflags="" 942 cc_32_cflags_optlist="opt" 943 cc_32_cflags_opt="+O2 +O1" 944 gcc_32_cflags="$gcc_cflags -milp32" 945 limb_32=longlong 946 SPEED_CYCLECOUNTER_OBJ_32=ia64.lo 947 cyclecounter_size_32=2 948 949 # Must have +DD64 in CPPFLAGS to get the right __LP64__ for headers, 950 # but also need it in CFLAGS for linking programs, since automake 951 # only uses CFLAGS when linking, not CPPFLAGS. 952 # FIXME: Maybe should use cc_64_ldflags for this, but that would 953 # need GMP_LDFLAGS used consistently by all the programs. 954 # 955 cc_64_cflags="+DD64" 956 cc_64_cppflags="+DD64" 957 cc_64_cflags_optlist="opt" 958 cc_64_cflags_opt="+O2 +O1" 959 gcc_64_cflags="$gcc_cflags -mlp64" 960 ;; 961 esac 962 ;; 963 964 965 # Motorola 68k 966 # 967 M68K_PATTERN) 968 AC_DEFINE(HAVE_HOST_CPU_FAMILY_m68k) 969 GMP_INCLUDE_MPN(m68k/m68k-defs.m4) 970 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 971 gcc_cflags_optlist="arch" 972 973 # gcc 2.7.2 knows -m68000, -m68020, -m68030, -m68040. 974 # gcc 2.95 adds -mcpu32, -m68060. 975 # FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2. 976 # 977 case $host_cpu in 978 m68020) gcc_cflags_arch="-m68020" ;; 979 m68030) gcc_cflags_arch="-m68030" ;; 980 m68040) gcc_cflags_arch="-m68040" ;; 981 m68060) gcc_cflags_arch="-m68060 -m68000" ;; 982 m68360) gcc_cflags_arch="-mcpu32 -m68000" ;; 983 *) gcc_cflags_arch="-m68000" ;; 984 esac 985 986 # FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be 987 # tested. Will need to introduce an m68k/cpu32 if m68k/mc68020 ever uses 988 # the bitfield instructions. 989 case $host_cpu in 990 [m680[234]0 | m68360]) path="m68k/mc68020 m68k" ;; 991 *) path="m68k" ;; 992 esac 993 ;; 994 995 996 # Motorola 88k 997 m88k*-*-*) 998 path="m88k" 999 ;; 1000 m88110*-*-*) 1001 gcc_cflags="$gcc_cflags -m88110" 1002 path="m88k/mc88110 m88k" 1003 ;; 1004 1005 1006 # IRIX 5 and earlier can only run 32-bit o32. 1007 # 1008 # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64. n32 is 1009 # preferred over 64, but only because that's been the default in past 1010 # versions of GMP. The two are equally efficient. 1011 # 1012 # Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not 1013 # supporting n32 or 64. 1014 # 1015 # For reference, libtool (eg. 1.5.6) recognises the n32 ABI and knows the 1016 # right options to use when linking (both cc and gcc), so no need for 1017 # anything special from us. 1018 # 1019 mips*-*-*) 1020 abilist="o32" 1021 gcc_cflags_optlist="abi" 1022 gcc_cflags_abi="-mabi=32 -m32" 1023 gcc_testlist="gcc-mips-o32" 1024 path="mips32" 1025 cc_cflags="-O2 -o32" # no -g, it disables all optimizations 1026 # this suits both mips32 and mips64 1027 GMP_INCLUDE_MPN(mips32/mips-defs.m4) 1028 1029 case $host in 1030 [mips64*-*-* | mipsisa64*-*-* | mips*-*-irix[6789]*]) 1031 abilist="n32 64 o32" 1032 1033 cclist_n32="gcc cc" 1034 gcc_n32_cflags_optlist="abi" 1035 gcc_n32_cflags="$gcc_cflags" 1036 gcc_n32_cflags_abi="-mabi=n32 -mn32" 1037 cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations 1038 limb_n32=longlong 1039 1040 cclist_64="gcc cc" 1041 gcc_64_cflags_optlist="abi" 1042 gcc_64_cflags="$gcc_cflags" 1043 gcc_64_cflags_abi="-mabi=64 -m64" 1044 gcc_64_ldflags="-Wc,-mabi=64" 1045 cc_64_cflags="-O2 -64" # no -g, it disables all optimizations 1046 cc_64_ldflags="-Wc,-64" 1047 1048 case $host_cpu in 1049 [mips64r[6789]* | mipsisa64r[6789]*]) 1050 path_n32="mips64/r6 mips64" 1051 path_64="mips64/r6 mips64" 1052 ;; 1053 *) 1054 path_n32="mips64/hilo mips64" 1055 path_64="mips64/hilo mips64" 1056 ;; 1057 esac 1058 1059 ;; 1060 esac 1061 ;; 1062 1063 1064 # Darwin (powerpc-apple-darwin1.3) has it's hacked gcc installed as cc. 1065 # Our usual "gcc in disguise" detection means gcc_cflags etc here gets 1066 # used. 1067 # 1068 # The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp 1069 # since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h, 1070 # and so always ends up running the plain preprocessor anyway. This could 1071 # be done in CPPFLAGS rather than CFLAGS, but there's not many places 1072 # preprocessing is done separately, and this is only a speedup, the normal 1073 # preprocessor gets run if there's any problems. 1074 # 1075 # We used to use -Wa,-mppc with gcc, but can't remember exactly why. 1076 # Presumably it was for old versions of gcc where -mpowerpc doesn't put 1077 # the assembler in the right mode. In any case -Wa,-mppc is not good, for 1078 # instance -mcpu=604 makes recent gcc use -m604 to get access to the 1079 # "fsel" instruction, but a -Wa,-mppc overrides that, making code that 1080 # comes out with fsel fail. 1081 # 1082 # (Note also that the darwin assembler doesn't accept "-mppc", so any 1083 # -Wa,-mppc was used only if it worked. The right flag on darwin would be 1084 # "-arch ppc" or some such, but that's already the default.) 1085 # 1086 [powerpc*-*-* | power[3-9]-*-*]) 1087 AC_DEFINE(HAVE_HOST_CPU_FAMILY_powerpc) 1088 HAVE_HOST_CPU_FAMILY_powerpc=1 1089 abilist="32" 1090 cclist="gcc cc" 1091 cc_cflags="-O2" 1092 gcc_32_cflags_maybe="-m32" 1093 gcc_cflags_optlist="precomp subtype asm cpu" 1094 gcc_cflags_precomp="-no-cpp-precomp" 1095 gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin 1096 gcc_cflags_asm="" 1097 gcc_cflags_cpu="" 1098 vmx_path="" 1099 1100 # grab this object, though it's not a true cycle counter routine 1101 SPEED_CYCLECOUNTER_OBJ=powerpc.lo 1102 cyclecounter_size=0 1103 1104 case $host_cpu in 1105 powerpc740 | powerpc750) 1106 path="powerpc32/750 powerpc32" ;; 1107 powerpc7400 | powerpc7410) 1108 path="powerpc32/vmx powerpc32/750 powerpc32" ;; 1109 [powerpc74[45]?]) 1110 path="powerpc32/vmx powerpc32" ;; 1111 *) 1112 path="powerpc32" ;; 1113 esac 1114 1115 case $host_cpu in 1116 powerpc401) gcc_cflags_cpu="-mcpu=401" ;; 1117 powerpc403) gcc_cflags_cpu="-mcpu=403" 1118 xlc_cflags_arch="-qarch=403 -qarch=ppc" ;; 1119 powerpc405) gcc_cflags_cpu="-mcpu=405" ;; 1120 powerpc505) gcc_cflags_cpu="-mcpu=505" ;; 1121 powerpc601) gcc_cflags_cpu="-mcpu=601" 1122 xlc_cflags_arch="-qarch=601 -qarch=ppc" ;; 1123 powerpc602) gcc_cflags_cpu="-mcpu=602" 1124 xlc_cflags_arch="-qarch=602 -qarch=ppc" ;; 1125 powerpc603) gcc_cflags_cpu="-mcpu=603" 1126 xlc_cflags_arch="-qarch=603 -qarch=ppc" ;; 1127 powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" 1128 xlc_cflags_arch="-qarch=603 -qarch=ppc" ;; 1129 powerpc604) gcc_cflags_cpu="-mcpu=604" 1130 xlc_cflags_arch="-qarch=604 -qarch=ppc" ;; 1131 powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" 1132 xlc_cflags_arch="-qarch=604 -qarch=ppc" ;; 1133 powerpc620) gcc_cflags_cpu="-mcpu=620" ;; 1134 powerpc630) gcc_cflags_cpu="-mcpu=630" 1135 xlc_cflags_arch="-qarch=pwr3" 1136 cpu_path="p3 p3-p7" ;; 1137 powerpc740) gcc_cflags_cpu="-mcpu=740" ;; 1138 powerpc7400 | powerpc7410) 1139 gcc_cflags_asm="-Wa,-maltivec" 1140 gcc_cflags_cpu="-mcpu=7400 -mcpu=750" ;; 1141 [powerpc74[45]?]) 1142 gcc_cflags_asm="-Wa,-maltivec" 1143 gcc_cflags_cpu="-mcpu=7450" ;; 1144 powerpc750) gcc_cflags_cpu="-mcpu=750" ;; 1145 powerpc801) gcc_cflags_cpu="-mcpu=801" ;; 1146 powerpc821) gcc_cflags_cpu="-mcpu=821" ;; 1147 powerpc823) gcc_cflags_cpu="-mcpu=823" ;; 1148 powerpc860) gcc_cflags_cpu="-mcpu=860" ;; 1149 powerpc970) gcc_cflags_cpu="-mtune=970" 1150 xlc_cflags_arch="-qarch=970 -qarch=pwr3" 1151 vmx_path="powerpc64/vmx" 1152 cpu_path="p4 p3-p7" ;; 1153 power4) gcc_cflags_cpu="-mtune=power4" 1154 xlc_cflags_arch="-qarch=pwr4" 1155 cpu_path="p4 p3-p7" ;; 1156 power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4" 1157 xlc_cflags_arch="-qarch=pwr5" 1158 cpu_path="p5 p4 p3-p7" ;; 1159 power6) gcc_cflags_cpu="-mtune=power6" 1160 xlc_cflags_arch="-qarch=pwr6" 1161 cpu_path="p6 p3-p7" ;; 1162 power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5" 1163 xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5" 1164 cpu_path="p7 p5 p4 p3-p7" ;; 1165 power8) gcc_cflags_cpu="-mtune=power8 -mtune=power7 -mtune=power5" 1166 xlc_cflags_arch="-qarch=pwr8 -qarch=pwr7 -qarch=pwr5" 1167 cpu_path="p8 p7 p5 p4 p3-p7" ;; 1168 power9) gcc_cflags_cpu="-mtune=power9 -mtune=power8 -mtune=power7 -mtune=power5" 1169 xlc_cflags_arch="-qarch=pwr9 -qarch=pwr8 -qarch=pwr7 -qarch=pwr5" 1170 cpu_path="p9 p8 p7 p5 p4 p3-p7" ;; 1171 esac 1172 1173 case $host in 1174 *-*-aix*) 1175 cclist="gcc xlc cc" 1176 gcc_32_cflags_maybe="-maix32" 1177 xlc_cflags="-O2 -qmaxmem=20000" 1178 xlc_cflags_optlist="arch" 1179 xlc_32_cflags_maybe="-q32" 1180 ar_32_flags="-X32" 1181 nm_32_flags="-X32" 1182 esac 1183 1184 case $host in 1185 POWERPC64_PATTERN) 1186 case $host in 1187 *-*-aix*) 1188 # On AIX a true 64-bit ABI is available. 1189 # Need -Wc to pass object type flags through to the linker. 1190 abilist="mode64 $abilist" 1191 cclist_mode64="gcc xlc" 1192 gcc_mode64_cflags="$gcc_cflags -maix64 -mpowerpc64" 1193 gcc_mode64_cflags_optlist="cpu" 1194 gcc_mode64_ldflags="-Wc,-maix64" 1195 xlc_mode64_cflags="-O2 -q64 -qmaxmem=20000" 1196 xlc_mode64_cflags_optlist="arch" 1197 xlc_mode64_ldflags="-Wc,-q64" 1198 # Must indicate object type to ar and nm 1199 ar_mode64_flags="-X64" 1200 nm_mode64_flags="-X64" 1201 path_mode64="" 1202 p="" 1203 for i in $cpu_path 1204 do path_mode64="${path_mode64}powerpc64/mode64/$i " 1205 path_mode64="${path_mode64}powerpc64/$i " 1206 p="${p} powerpc32/$i " 1207 done 1208 path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64" 1209 path="$p $path" 1210 # grab this object, though it's not a true cycle counter routine 1211 SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo 1212 cyclecounter_size_mode64=0 1213 ;; 1214 *-*-darwin*) 1215 # On Darwin we can use 64-bit instructions with a longlong limb, 1216 # but the chip still in 32-bit mode. 1217 # In theory this can be used on any OS which knows how to save 1218 # 64-bit registers in a context switch. 1219 # 1220 # Note that we must use -mpowerpc64 with gcc, since the 1221 # longlong.h macros expect limb operands in a single 64-bit 1222 # register, not two 32-bit registers as would be given for a 1223 # long long without -mpowerpc64. In theory we could detect and 1224 # accommodate both styles, but the proper 64-bit registers will 1225 # be fastest and are what we really want to use. 1226 # 1227 # One would think -mpowerpc64 would set the assembler in the right 1228 # mode to handle 64-bit instructions. But for that, also 1229 # -force_cpusubtype_ALL is needed. 1230 # 1231 # Do not use -fast for Darwin, it actually adds options 1232 # incompatible with a shared library. 1233 # 1234 abilist="mode64 mode32 $abilist" 1235 gcc_cflags_opt="-O2 -O1" # will this become used? 1236 cclist_mode32="gcc" 1237 gcc_mode32_cflags_maybe="-m32" 1238 gcc_mode32_cflags="-mpowerpc64" 1239 gcc_mode32_cflags_optlist="subtype cpu opt" 1240 gcc_mode32_cflags_subtype="-force_cpusubtype_ALL" 1241 gcc_mode32_cflags_opt="-O2 -O1" 1242 limb_mode32=longlong 1243 cclist_mode64="gcc" 1244 gcc_mode64_cflags="-m64" 1245 gcc_mode64_cflags_optlist="cpu opt" 1246 gcc_mode64_cflags_opt="-O2 -O1" 1247 path_mode64="" 1248 path_mode32="" 1249 p="" 1250 for i in $cpu_path 1251 do path_mode64="${path_mode64}powerpc64/mode64/$i " 1252 path_mode64="${path_mode64}powerpc64/$i " 1253 path_mode32="${path_mode32}powerpc64/mode32/$i " 1254 path_mode32="${path_mode32}powerpc64/$i " 1255 p="${p} powerpc32/$i " 1256 done 1257 path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64" 1258 path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64" 1259 path="$p $path" 1260 SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo 1261 cyclecounter_size_mode64=0 1262 any_mode64_testlist="sizeof-long-8" 1263 ;; 1264 *-*-linux* | *-*-*bsd*) 1265 # On GNU/Linux, assume the processor is in 64-bit mode. Some 1266 # environments have a gcc that is always in 64-bit mode, while 1267 # others require -m64, hence the use of cflags_maybe. The 1268 # sizeof-long-8 test checks the mode is right (for the no option 1269 # case). 1270 # 1271 # -mpowerpc64 is not used, since it should be the default in 1272 # 64-bit mode. (We need its effect for the various longlong.h 1273 # asm macros to be right of course.) 1274 # 1275 # gcc64 was an early port of gcc to 64-bit mode, but should be 1276 # obsolete before too long. We prefer plain gcc when it knows 1277 # 64-bits. 1278 # 1279 abilist="mode64 mode32 $abilist" 1280 cclist_mode32="gcc" 1281 gcc_mode32_cflags_maybe="-m32" 1282 gcc_mode32_cflags="-mpowerpc64" 1283 gcc_mode32_cflags_optlist="cpu opt" 1284 gcc_mode32_cflags_opt="-O2 -O1" 1285 limb_mode32=longlong 1286 cclist_mode64="gcc gcc64" 1287 gcc_mode64_cflags_maybe="-m64" 1288 gcc_mode64_cflags_optlist="cpu opt" 1289 gcc_mode64_cflags_opt="-O2 -O1" 1290 path_mode64="" 1291 path_mode32="" 1292 p="" 1293 for i in $cpu_path 1294 do path_mode64="${path_mode64}powerpc64/mode64/$i " 1295 path_mode64="${path_mode64}powerpc64/$i " 1296 path_mode32="${path_mode32}powerpc64/mode32/$i " 1297 path_mode32="${path_mode32}powerpc64/$i " 1298 p="${p} powerpc32/$i " 1299 done 1300 path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64" 1301 path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64" 1302 path="$p $path" 1303 SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo 1304 cyclecounter_size_mode64=0 1305 any_mode64_testlist="sizeof-long-8" 1306 ;; 1307 esac 1308 ;; 1309 esac 1310 ;; 1311 1312 1313 # POWER 32-bit 1314 [power-*-* | power[12]-*-* | power2sc-*-*]) 1315 AC_DEFINE(HAVE_HOST_CPU_FAMILY_power) 1316 HAVE_HOST_CPU_FAMILY_power=1 1317 cclist="gcc" 1318 if test "$enable_assembly" = "yes" ; then 1319 extra_functions="udiv_w_sdiv" 1320 fi 1321 path="power" 1322 1323 # gcc 2.7.2 knows rios1, rios2, rsc 1324 # 1325 # -mcpu=rios2 can tickle an AIX assembler bug (see GMP_PROG_CC_WORKS) so 1326 # there needs to be a fallback to just -mpower. 1327 # 1328 gcc_cflags_optlist="cpu" 1329 case $host in 1330 power-*-*) gcc_cflags_cpu="-mcpu=power -mpower" ;; 1331 power1-*-*) gcc_cflags_cpu="-mcpu=rios1 -mpower" ;; 1332 power2-*-*) gcc_cflags_cpu="-mcpu=rios2 -mpower" ;; 1333 power2sc-*-*) gcc_cflags_cpu="-mcpu=rsc -mpower" ;; 1334 esac 1335 case $host in 1336 *-*-aix*) 1337 cclist="gcc xlc" 1338 xlc_cflags="-O2 -qarch=pwr -qmaxmem=20000" 1339 ;; 1340 esac 1341 ;; 1342 1343 1344 # RISC-V 1345 [riscv64-*-*]) 1346 cclist="gcc" 1347 path="riscv/64" 1348 ;; 1349 1350 1351 # IBM System/390 and z/Architecture 1352 S390_PATTERN | S390X_PATTERN) 1353 abilist="32" 1354 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 1355 gcc_cflags_optlist="arch" 1356 path="s390_32" 1357 if test "$enable_assembly" = "yes" ; then 1358 extra_functions="udiv_w_sdiv" 1359 fi 1360 gcc_32_cflags_maybe="-m31" 1361 1362 case $host_cpu in 1363 s390) 1364 ;; 1365 z900 | z900esa) 1366 cpu="z900" 1367 gccarch="$cpu" 1368 path="s390_32/esame/$cpu s390_32/esame s390_32" 1369 gcc_cflags_arch="-march=$gccarch" 1370 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu) 1371 AC_DEFINE(HAVE_HOST_CPU_s390_zarch) 1372 extra_functions="" 1373 ;; 1374 z990 | z990esa) 1375 cpu="z990" 1376 gccarch="$cpu" 1377 path="s390_32/esame/$cpu s390_32/esame s390_32" 1378 gcc_cflags_arch="-march=$gccarch" 1379 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu) 1380 AC_DEFINE(HAVE_HOST_CPU_s390_zarch) 1381 extra_functions="" 1382 ;; 1383 z9 | z9esa) 1384 cpu="z9" 1385 gccarch="z9-109" 1386 path="s390_32/esame/$cpu s390_32/esame s390_32" 1387 gcc_cflags_arch="-march=$gccarch" 1388 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu) 1389 AC_DEFINE(HAVE_HOST_CPU_s390_zarch) 1390 extra_functions="" 1391 ;; 1392 z10 | z10esa) 1393 cpu="z10" 1394 gccarch="z10" 1395 path="s390_32/esame/$cpu s390_32/esame s390_32" 1396 gcc_cflags_arch="-march=$gccarch" 1397 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu) 1398 AC_DEFINE(HAVE_HOST_CPU_s390_zarch) 1399 extra_functions="" 1400 ;; 1401 z196 | z196esa) 1402 cpu="z196" 1403 gccarch="z196" 1404 path="s390_32/esame/$cpu s390_32/esame s390_32" 1405 gcc_cflags_arch="-march=$gccarch" 1406 AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu) 1407 AC_DEFINE(HAVE_HOST_CPU_s390_zarch) 1408 extra_functions="" 1409 ;; 1410 esac 1411 1412 case $host in 1413 S390X_PATTERN) 1414 abilist="64 32" 1415 cclist_64="gcc" 1416 gcc_64_cflags_optlist="arch" 1417 gcc_64_cflags="$gcc_cflags -m64" 1418 path_64="s390_64/$host_cpu s390_64" 1419 extra_functions="" 1420 ;; 1421 esac 1422 ;; 1423 1424 1425 sh-*-*) path="sh" ;; 1426 [sh[2-4]-*-*]) path="sh/sh2 sh" ;; 1427 1428 1429 *sparc*-*-*) 1430 # sizeof(long)==4 or 8 is tested, to ensure we get the right ABI. We've 1431 # had various bug reports where users have set CFLAGS for their desired 1432 # mode, but not set our ABI. For some reason it's sparc where this 1433 # keeps coming up, presumably users there are accustomed to driving the 1434 # compiler mode that way. The effect of our testlist setting is to 1435 # reject ABI=64 in favour of ABI=32 if the user has forced the flags to 1436 # 32-bit mode. 1437 # 1438 abilist="32" 1439 cclist="gcc acc cc" 1440 any_testlist="sizeof-long-4" 1441 GMP_INCLUDE_MPN(sparc32/sparc-defs.m4) 1442 1443 case $host_cpu in 1444 sparcv8 | microsparc | turbosparc) 1445 path="sparc32/v8 sparc32" ;; 1446 supersparc) 1447 path="sparc32/v8/supersparc sparc32/v8 sparc32" ;; 1448 [sparc64 | sparcv9* | ultrasparc | ultrasparc[234]*]) 1449 path="sparc32/v9 sparc32/v8 sparc32" ;; 1450 [ultrasparct[12345]]) 1451 path="sparc32/ultrasparct1 sparc32/v8 sparc32" ;; 1452 *) 1453 path="sparc32" ;; 1454 esac 1455 1456 # gcc 2.7.2 doesn't know about v9 and doesn't pass -xarch=v8plus to the 1457 # assembler. Add it explicitly since the solaris assembler won't accept 1458 # our sparc32/v9 asm code without it. gas accepts -xarch=v8plus too, so 1459 # it can be in the cflags unconditionally (though gas doesn't need it). 1460 # 1461 # gcc -m32 is needed to force 32-bit mode on a dual-ABI system, but past 1462 # gcc doesn't know that flag, hence cflags_maybe. Note that -m32 cannot 1463 # be done through the optlist since the plain cflags would be run first 1464 # and we don't want to require the default mode (whatever it is) works. 1465 # 1466 # Note it's gcc_32_cflags_maybe and not gcc_cflags_maybe because the 1467 # latter would be used in the 64-bit ABI on systems like "*bsd" where 1468 # abilist="64" only. 1469 # 1470 gcc_32_cflags_maybe="-m32" 1471 gcc_cflags_optlist="cpu asm" 1472 1473 # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite. 1474 # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934, 1475 # sparclet, tsc701, v9, ultrasparc. A warning is given that the 1476 # plain -m forms will disappear. 1477 # gcc 3.3 adds ultrasparc3. 1478 # 1479 case $host_cpu in 1480 supersparc*) 1481 gcc_cflags_cpu="-mcpu=supersparc -msupersparc" 1482 gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";; 1483 sparcv8 | microsparc* | turbosparc | hypersparc*) 1484 gcc_cflags_cpu="-mcpu=v8 -mv8" 1485 gcc_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8";; 1486 sparc64 | sparcv9*) 1487 gcc_cflags_cpu="-mcpu=v9" 1488 gcc_32_cflags_asm="-Wa,-Av8 -Wa,-xarch=v8plus" 1489 gcc_64_cflags_asm="-Wa,-Av9 -Wa,-xarch=v9";; 1490 ultrasparc1 | ultrasparc2*) 1491 gcc_cflags_cpu="-mcpu=ultrasparc -mcpu=v9" 1492 gcc_32_cflags_asm="-Wa,-Av8plusa -Wa,-xarch=v8plusa" 1493 gcc_64_cflags_asm="-Wa,-Av9a -Wa,-xarch=v9a";; 1494 [ultrasparc[34]]) 1495 gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mcpu=v9" 1496 gcc_32_cflags_asm="-Wa,-Av8plusb -Wa,-xarch=v8plusb" 1497 gcc_64_cflags_asm="-Wa,-Av9b -Wa,-xarch=v9b";; 1498 [ultrasparct[12]]) 1499 gcc_cflags_cpu="-mcpu=niagara -mcpu=v9" 1500 gcc_32_cflags_asm="-Wa,-Av8plusc -Wa,-xarch=v8plusc" 1501 gcc_64_cflags_asm="-Wa,-Av9c -Wa,-xarch=v9c";; 1502 ultrasparct3) 1503 gcc_cflags_cpu="-mcpu=niagara3 -mcpu=niagara -mcpu=v9" 1504 gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd" 1505 gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";; 1506 [ultrasparct[45]]) 1507 gcc_cflags_cpu="-mcpu=niagara4 -mcpu=niagara3 -mcpu=niagara -mcpu=v9" 1508 gcc_32_cflags_asm="-Wa,-Av8plusd -Wa,-xarch=v8plusd" 1509 gcc_64_cflags_asm="-Wa,-Av9d -Wa,-xarch=v9d";; 1510 *) 1511 gcc_cflags_cpu="-mcpu=v7 -mcypress" 1512 gcc_cflags_asm="";; 1513 esac 1514 1515 # SunPRO cc and acc, and SunOS bundled cc 1516 case $host in 1517 *-*-solaris* | *-*-sunos*) 1518 # Note no -g, it disables all optimizations. 1519 cc_cflags= 1520 cc_cflags_optlist="opt arch cpu" 1521 1522 # SunOS <= 4 cc doesn't know -xO3, fallback to -O2. 1523 cc_cflags_opt="-xO3 -O2" 1524 1525 # SunOS cc doesn't know -xarch, apparently always generating v7 1526 # code, so make this optional 1527 case $host_cpu in 1528 sparcv8 | microsparc* | supersparc* | turbosparc | hypersparc*) 1529 cc_cflags_arch="-xarch=v8";; 1530 [ultrasparct[345]]) 1531 cc_cflags_arch="-xarch=v8plusd" ;; 1532 sparc64 | sparcv9* | ultrasparc*) 1533 cc_cflags_arch="-xarch=v8plus" ;; 1534 *) 1535 cc_cflags_arch="-xarch=v7" ;; 1536 esac 1537 1538 # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent. 1539 # SunPRO cc 5 recognises -xchip=generic, old, super, super2, micro, 1540 # micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i. 1541 # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu. 1542 # 1543 case $host_cpu in 1544 supersparc*) cc_cflags_cpu="-xchip=super" ;; 1545 microsparc*) cc_cflags_cpu="-xchip=micro" ;; 1546 turbosparc) cc_cflags_cpu="-xchip=micro2" ;; 1547 hypersparc*) cc_cflags_cpu="-xchip=hyper" ;; 1548 ultrasparc) cc_cflags_cpu="-xchip=ultra" ;; 1549 ultrasparc2) cc_cflags_cpu="-xchip=ultra2 -xchip=ultra" ;; 1550 ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;; 1551 ultrasparc3) cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;; 1552 ultrasparc4) cc_cflags_cpu="-xchip=ultra4 -xchip=ultra3 -xchip=ultra" ;; 1553 ultrasparct1) cc_cflags_cpu="-xchip=ultraT1" ;; 1554 ultrasparct2) cc_cflags_cpu="-xchip=ultraT2 -xchip=ultraT1" ;; 1555 ultrasparct3) cc_cflags_cpu="-xchip=ultraT3 -xchip=ultraT2" ;; 1556 ultrasparct4) cc_cflags_cpu="-xchip=T4" ;; 1557 ultrasparct5) cc_cflags_cpu="-xchip=T5 -xchip=T4" ;; 1558 *) cc_cflags_cpu="-xchip=generic" ;; 1559 esac 1560 esac 1561 1562 case $host_cpu in 1563 sparc64 | sparcv9* | ultrasparc*) 1564 case $host in 1565 # Solaris 6 and earlier cannot run ABI=64 since it doesn't save 1566 # registers properly, so ABI=32 is left as the only choice. 1567 # 1568 [*-*-solaris2.[0-6] | *-*-solaris2.[0-6].*]) ;; 1569 1570 # BSD sparc64 ports are 64-bit-only systems, so ABI=64 is the only 1571 # choice. In fact they need no special compiler flags, gcc -m64 1572 # is the default, but it doesn't hurt to add it. v9 CPUs always 1573 # use the sparc64 port, since the plain 32-bit sparc ports don't 1574 # run on a v9. 1575 # 1576 *-*-*bsd*) abilist="64" ;; 1577 1578 # For all other systems, we try both 64 and 32. 1579 # 1580 # GNU/Linux sparc64 has only recently gained a 64-bit user mode. 1581 # In the past sparc64 meant a v9 cpu, but there were no 64-bit 1582 # operations in user mode. We assume that if "gcc -m64" works 1583 # then the system is suitable. Hopefully even if someone attempts 1584 # to put a new gcc and/or glibc on an old system it won't run. 1585 # 1586 *) abilist="64 32" ;; 1587 esac 1588 1589 case $host_cpu in 1590 ultrasparc | ultrasparc2 | ultrasparc2i) 1591 path_64="sparc64/ultrasparc1234 sparc64" ;; 1592 [ultrasparc[34]]) 1593 path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;; 1594 [ultrasparct[12]]) 1595 path_64="sparc64/ultrasparct1 sparc64" ;; 1596 [ultrasparct3]) 1597 path_64="sparc64/ultrasparct3 sparc64" ;; 1598 [ultrasparct[45]]) 1599 path_64="sparc64/ultrasparct45 sparc64/ultrasparct3 sparc64" ;; 1600 *) 1601 path_64="sparc64" 1602 esac 1603 1604 cclist_64="gcc" 1605 any_64_testlist="sizeof-long-8" 1606 1607 # gcc -mptr64 is probably implied by -m64, but we're not sure if 1608 # this was always so. On Solaris in the past we always used both 1609 # "-m64 -mptr64". 1610 # 1611 # gcc -Wa,-xarch=v9 is thought to be necessary in some cases on 1612 # solaris, but it would seem likely that if gcc is going to generate 1613 # 64-bit code it will have to add that option itself where needed. 1614 # An extra copy of this option should be harmless though, but leave 1615 # it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the 1616 # higher cpu types instead.) 1617 # 1618 gcc_64_cflags="$gcc_cflags -m64 -mptr64" 1619 gcc_64_ldflags="-Wc,-m64" 1620 gcc_64_cflags_optlist="cpu asm" 1621 1622 case $host in 1623 *-*-solaris*) 1624 # Sun cc. 1625 # 1626 # We used to have -fast and some fixup options here, but it 1627 # recurrently caused problems with miscompilation. Of course, 1628 # -fast is documented as miscompiling things for the sake of speed. 1629 # 1630 cclist_64="$cclist_64 cc" 1631 cc_64_cflags_optlist="cpu" 1632 case $host_cpu in 1633 [ultrasparct[345]]) 1634 cc_64_cflags="$cc_64_cflags -xO3 -xarch=v9d" ;; 1635 *) 1636 cc_64_cflags="-xO3 -xarch=v9" ;; 1637 esac 1638 ;; 1639 esac 1640 1641 # using the v9 %tick register 1642 SPEED_CYCLECOUNTER_OBJ_32=sparcv9.lo 1643 SPEED_CYCLECOUNTER_OBJ_64=sparcv9.lo 1644 cyclecounter_size_32=2 1645 cyclecounter_size_64=2 1646 ;; 1647 esac 1648 ;; 1649 1650 1651 # VAX 1652 vax*-*-*elf*) 1653 # Use elf conventions (i.e., '%' register prefix, no global prefix) 1654 # 1655 GMP_INCLUDE_MPN(vax/elf.m4) 1656 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 1657 path="vax" 1658 if test "$enable_assembly" = "yes" ; then 1659 extra_functions="udiv_w_sdiv" 1660 fi 1661 ;; 1662 vax*-*-*) 1663 # Default to aout conventions (i.e., no register prefix, '_' global prefix) 1664 # 1665 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 1666 path="vax" 1667 if test "$enable_assembly" = "yes" ; then 1668 extra_functions="udiv_w_sdiv" 1669 fi 1670 ;; 1671 1672 1673 # AMD and Intel x86 configurations, including AMD64 1674 # 1675 # Rumour has it gcc -O2 used to give worse register allocation than just 1676 # -O, but lets assume that's no longer true. 1677 # 1678 # -m32 forces 32-bit mode on a bi-arch 32/64 amd64 build of gcc. -m64 is 1679 # the default in such a build (we think), so -m32 is essential for ABI=32. 1680 # This is, of course, done for any $host_cpu, not just x86_64, so we can 1681 # get such a gcc into the right mode to cross-compile to say i486-*-*. 1682 # 1683 # -m32 is not available in gcc 2.95 and earlier, hence cflags_maybe to use 1684 # it when it works. We check sizeof(long)==4 to ensure we get the right 1685 # mode, in case -m32 has failed not because it's an old gcc, but because 1686 # it's a dual 32/64-bit gcc without a 32-bit libc, or whatever. 1687 # 1688 X86_PATTERN | X86_64_PATTERN) 1689 abilist="32" 1690 cclist="gcc icc cc" 1691 gcc_cflags="$gcc_cflags $fomit_frame_pointer" 1692 gcc_32_cflags_maybe="-m32" 1693 icc_cflags="-no-gcc" 1694 icc_cflags_optlist="opt" 1695 icc_cflags_opt="-O3 -O2 -O1" 1696 icc_cflags_opt_maybe="-fp-model~precise" 1697 any_32_testlist="sizeof-long-4" 1698 gcc_cflags_optlist="cpu arch noavx" 1699 CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo' 1700 1701 # Availability of rdtsc is checked at run-time. 1702 SPEED_CYCLECOUNTER_OBJ=pentium.lo 1703 1704 # Set to "yes" below on a per-cpu basis. We do that in order to allow for 1705 # a relevant warning to be output when using a CPU with mulx on a system 1706 # which cannot assemble it. 1707 x86_have_mulx=no 1708 1709 # gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These 1710 # represent -mcpu= since -m486 doesn't generate 486 specific insns. 1711 # gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=. 1712 # gcc 3.0 adds athlon. 1713 # gcc 3.1 adds k6-2, k6-3, pentium-mmx, pentium2, pentium3, pentium4, 1714 # athlon-tbird, athlon-4, athlon-xp, athlon-mp. 1715 # gcc 3.2 adds winchip2. 1716 # gcc 3.3 adds winchip-c6. 1717 # gcc 3.3.1 from mandrake adds k8 and knows -mtune. 1718 # gcc 3.4 adds c3, c3-2, k8, and deprecates -mcpu in favour of -mtune. 1719 # 1720 # In gcc 2.95.[0123], -march=pentiumpro provoked a stack slot bug in an 1721 # old version of mpz/powm.c. Seems to be fine with the current code, so 1722 # no need for any restrictions on that option. 1723 # 1724 # -march=pentiumpro can fail if the assembler doesn't know "cmov" 1725 # (eg. solaris 2.8 native "as"), so always have -march=pentium after 1726 # that as a fallback. 1727 # 1728 # -march=pentium4 and -march=k8 enable SSE2 instructions, which may or 1729 # may not be supported by the assembler and/or the OS, and is bad in gcc 1730 # prior to 3.3. The tests will reject these if no good, so fallbacks 1731 # like "-march=pentium4 -mno-sse2" are given to try also without SSE2. 1732 # Note the relevant -march types are listed in the optflags handling 1733 # below, be sure to update there if adding new types emitting SSE2. 1734 # 1735 # -mtune is used at the start of each cpu option list to give something 1736 # gcc 3.4 will use, thereby avoiding warnings from -mcpu. -mcpu forms 1737 # are retained for use by prior gcc. For example pentium has 1738 # "-mtune=pentium -mcpu=pentium ...", the -mtune is for 3.4 and the 1739 # -mcpu for prior. If there's a brand new choice in 3.4 for a chip, 1740 # like k8 for x86_64, then it can be the -mtune at the start, no need to 1741 # duplicate anything. 1742 # 1743 case $host_cpu in 1744 i386*) 1745 gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386" 1746 gcc_cflags_arch="-march=i386" 1747 path="x86" 1748 ;; 1749 i486*) 1750 gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486" 1751 gcc_cflags_arch="-march=i486" 1752 path="x86/i486 x86" 1753 ;; 1754 i586 | pentium) 1755 gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486" 1756 gcc_cflags_arch="-march=pentium" 1757 path="x86/pentium x86" 1758 ;; 1759 pentiummmx) 1760 gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486" 1761 gcc_cflags_arch="-march=pentium-mmx -march=pentium" 1762 path="x86/pentium/mmx x86/pentium x86/mmx x86" 1763 ;; 1764 i686 | pentiumpro) 1765 gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486" 1766 gcc_cflags_arch="-march=pentiumpro -march=pentium" 1767 path="x86/p6 x86" 1768 ;; 1769 pentium2) 1770 gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486" 1771 gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium" 1772 path="x86/p6/mmx x86/p6 x86/mmx x86" 1773 ;; 1774 pentium3) 1775 gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486" 1776 gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium" 1777 path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1778 ;; 1779 pentiumm) 1780 gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486" 1781 gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium" 1782 path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1783 ;; 1784 k6) 1785 gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486" 1786 gcc_cflags_arch="-march=k6" 1787 path="x86/k6/mmx x86/k6 x86/mmx x86" 1788 ;; 1789 k62) 1790 gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486" 1791 gcc_cflags_arch="-march=k6-2 -march=k6" 1792 path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86" 1793 ;; 1794 k63) 1795 gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486" 1796 gcc_cflags_arch="-march=k6-3 -march=k6" 1797 path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86" 1798 ;; 1799 geode) 1800 gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486" 1801 gcc_cflags_arch="-march=k6-3 -march=k6" 1802 path="x86/geode x86/k6/k62mmx x86/k6/mmx x86/k6 x86/mmx x86" 1803 ;; 1804 athlon) 1805 # Athlon instruction costs are close to P6 (3 cycle load latency, 1806 # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't 1807 # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro. 1808 gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486" 1809 gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium" 1810 path="x86/k7/mmx x86/k7 x86/mmx x86" 1811 ;; 1812 i786 | pentium4) 1813 # pentiumpro is the primary fallback when gcc doesn't know pentium4. 1814 # This gets us cmov to eliminate branches. Maybe "athlon" would be 1815 # a possibility on gcc 3.0. 1816 # 1817 gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486" 1818 gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium" 1819 gcc_64_cflags_cpu="-mtune=nocona" 1820 path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86/mmx x86" 1821 path_64="x86_64/pentium4 x86_64" 1822 ;; 1823 viac32) 1824 # Not sure of the best fallbacks here for -mcpu. 1825 # c3-2 has sse and mmx, so pentium3 is good for -march. 1826 gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486" 1827 gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium" 1828 path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1829 ;; 1830 viac3*) 1831 # Not sure of the best fallbacks here. 1832 gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486" 1833 gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium" 1834 path="x86/pentium/mmx x86/pentium x86/mmx x86" 1835 ;; 1836 athlon64 | k8 | x86_64) 1837 gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486" 1838 gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium" 1839 path="x86/k8 x86/k7/mmx x86/k7 x86/mmx x86" 1840 path_64="x86_64/k8 x86_64" 1841 ;; 1842 k10) 1843 gcc_cflags_cpu="-mtune=amdfam10 -mtune=k8" 1844 gcc_cflags_arch="-march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1845 path="x86/k10 x86/k8 x86/k7/mmx x86/k7 x86/mmx x86" 1846 path_64="x86_64/k10 x86_64/k8 x86_64" 1847 ;; 1848 bobcat) 1849 gcc_cflags_cpu="-mtune=btver1 -mtune=amdfam10 -mtune=k8" 1850 gcc_cflags_arch="-march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1851 path="x86/bt1 x86/k7/mmx x86/k7 x86/mmx x86" 1852 path_64="x86_64/bt1 x86_64/k10 x86_64/k8 x86_64" 1853 ;; 1854 jaguar | jaguarnoavx) 1855 gcc_cflags_cpu="-mtune=btver2 -mtune=btver1 -mtune=amdfam10 -mtune=k8" 1856 gcc_cflags_arch="-march=btver2 -march=btver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1857 path="x86/bt2 x86/bt1 x86/k7/mmx x86/k7 x86/mmx x86" 1858 path_64="x86_64/bt2 x86_64/bt1 x86_64/k10 x86_64/k8 x86_64" 1859 ;; 1860 bulldozer | bd1 | bulldozernoavx | bd1noavx) 1861 gcc_cflags_cpu="-mtune=bdver1 -mtune=amdfam10 -mtune=k8" 1862 gcc_cflags_arch="-march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1863 path="x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86" 1864 path_64="x86_64/bd1 x86_64/k10 x86_64/k8 x86_64" 1865 ;; 1866 piledriver | bd2 | piledrivernoavx | bd2noavx) 1867 gcc_cflags_cpu="-mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8" 1868 gcc_cflags_arch="-march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1869 path="x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86" 1870 path_64="x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64" 1871 ;; 1872 steamroller | bd3 | steamrollernoavx | bd3noavx) 1873 gcc_cflags_cpu="-mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8" 1874 gcc_cflags_arch="-march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1875 path="x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86" 1876 path_64="x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64" 1877 ;; 1878 excavator | bd4 | excavatornoavx | bd4noavx) 1879 gcc_cflags_cpu="-mtune=bdver4 -mtune=bdver3 -mtune=bdver2 -mtune=bdver1 -mtune=amdfam10 -mtune=k8" 1880 gcc_cflags_arch="-march=bdver4 -march=bdver3 -march=bdver2 -march=bdver1 -march=amdfam10 -march=k8 -march=k8~-mno-sse2" 1881 path="x86/bd4 x86/bd3 x86/bd2 x86/bd1 x86/k7/mmx x86/k7 x86/mmx x86" 1882 path_64="x86_64/bd4 x86_64/bd3 x86_64/bd2 x86_64/bd1 x86_64/k10 x86_64/k8 x86_64" 1883 x86_have_mulx=yes 1884 ;; 1885 zen | zennoavx) 1886 gcc_cflags_cpu="-mtune=znver1 -mtune=amdfam10 -mtune=k8" 1887 gcc_cflags_arch="-march=znver1 -march=amdfam10 -march=k8" 1888 path="x86/k7/mmx x86/k7 x86/mmx x86" 1889 x86_have_mulx=yes 1890 path_64="x86_64/zen x86_64" 1891 ;; 1892 zen2 | zen2noavx | zen3 | zen3noavx) 1893 gcc_cflags_cpu="-mtune=znver2 -mtune=znver1 -mtune=amdfam10 -mtune=k8" 1894 gcc_cflags_arch="-march=znver2 -march=znver1 -march=amdfam10 -march=k8" 1895 path="x86/k7/mmx x86/k7 x86/mmx x86" 1896 x86_have_mulx=yes 1897 path_64="x86_64/zen2 x86_64/zen x86_64" 1898 ;; 1899 core2) 1900 gcc_cflags_cpu="-mtune=core2 -mtune=k8" 1901 gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1902 path="x86/core2 x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1903 path_64="x86_64/core2 x86_64" 1904 ;; 1905 corei | coreinhm | coreiwsm | nehalem | westmere) 1906 gcc_cflags_cpu="-mtune=nehalem -mtune=corei7 -mtune=core2 -mtune=k8" 1907 gcc_cflags_arch="-march=nehalem -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1908 path="x86/coreinhm x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1909 path_64="x86_64/coreinhm x86_64/core2 x86_64" 1910 ;; 1911 coreisbr | coreisbrnoavx | coreiibr | coreiibrnoavx | \ 1912 sandybridge | sandybridgenoavx | ivybridge | ivybridgenoavx) 1913 gcc_cflags_cpu="-mtune=sandybridge -mtune=corei7 -mtune=core2 -mtune=k8" 1914 gcc_cflags_arch="-march=sandybridge -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1915 path="x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1916 path_64="x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64" 1917 ;; 1918 coreihwl | coreihwlnoavx | haswell | haswellnoavx) 1919 gcc_cflags_cpu="-mtune=haswell -mtune=corei7 -mtune=core2 -mtune=k8" 1920 gcc_cflags_arch="-march=haswell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1921 path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1922 path_64="x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64" 1923 x86_have_mulx=yes 1924 ;; 1925 coreibwl | coreibwlnoavx | broadwell | broadwellnoavx) 1926 gcc_cflags_cpu="-mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8" 1927 gcc_cflags_arch="-march=broadwell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1928 path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1929 path_64="x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64" 1930 # extra_functions_64="missing" # enable for bmi2/adx simulation 1931 x86_have_mulx=yes 1932 ;; 1933 skylake | skylakenoavx | kabylake | kabylakenoavx) 1934 gcc_cflags_cpu="-mtune=skylake -mtune=broadwell -mtune=corei7 -mtune=core2 -mtune=k8" 1935 # Don't pass -march=skylake for now as then some compilers emit AVX512. 1936 gcc_cflags_arch="-march=broadwell -march=corei7 -march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2" 1937 path="x86/coreihwl x86/coreisbr x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86/mmx x86" 1938 path_64="x86_64/skylake x86_64/coreibwl x86_64/coreihwl x86_64/coreisbr x86_64/coreinhm x86_64/core2 x86_64" 1939 # extra_functions_64="missing" # enable for bmi2/adx simulation 1940 x86_have_mulx=yes 1941 ;; 1942 atom) # in-order pipeline atom 1943 gcc_cflags_cpu="-mtune=atom -mtune=pentium3" 1944 gcc_cflags_arch="-march=atom -march=pentium3" 1945 path="x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86" 1946 path_64="x86_64/atom x86_64" 1947 ;; 1948 silvermont) # out-of-order pipeline atom 1949 gcc_cflags_cpu="-mtune=slm -mtune=atom -mtune=pentium3" 1950 gcc_cflags_arch="-march=slm -march=atom -march=pentium3" 1951 path="x86/silvermont x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86" 1952 path_64="x86_64/silvermont x86_64/atom x86_64" 1953 ;; 1954 goldmont) # out-of-order pipeline atom 1955 gcc_cflags_cpu="-mtune=slm -mtune=atom -mtune=pentium3" 1956 gcc_cflags_arch="-march=slm -march=atom -march=pentium3" 1957 path="x86/goldmont x86/atom/sse2 x86/atom/mmx x86/atom x86/mmx x86" 1958 path_64="x86_64/goldmont x86_64/silvermont x86_64/atom x86_64" 1959 ;; 1960 nano) 1961 gcc_cflags_cpu="-mtune=nano" 1962 gcc_cflags_arch="-march=nano" 1963 path="x86/nano x86/mmx x86" 1964 path_64="x86_64/nano x86_64" 1965 ;; 1966 *) 1967 gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486" 1968 gcc_cflags_arch="-march=i486" 1969 path="x86" 1970 path_64="x86_64" 1971 ;; 1972 esac 1973 1974 case $host in 1975 # Disable AVX if the CPU part tells us AVX is unavailable, but also 1976 # unconditionally for NetBSD where they don't work but OSXSAVE is set 1977 # to claim the contrary. 1978 *noavx-*-* | *-*-netbsd*) 1979 gcc_cflags_noavx="-mno-avx" 1980 GMP_DEFINE_RAW(["define(<GMP_AVX_NOT_REALLY_AVAILABLE>,1)"]) 1981 ;; 1982 esac 1983 1984 case $host in 1985 X86_64_PATTERN) 1986 cclist_64="gcc cc" 1987 gcc_64_cflags="$gcc_cflags -m64" 1988 gcc_64_cflags_optlist="cpu arch noavx" 1989 CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo' 1990 SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo 1991 cyclecounter_size_64=2 1992 1993 cclist_x32="gcc cc" 1994 gcc_x32_cflags="$gcc_cflags -mx32" 1995 gcc_x32_cflags_optlist="$gcc_64_cflags_optlist" 1996 CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64" 1997 SPEED_CYCLECOUNTER_OBJ_x32="$SPEED_CYCLECOUNTER_OBJ_64" 1998 cyclecounter_size_x32="$cyclecounter_size_64" 1999 path_x32="$path_64" 2000 limb_x32=longlong 2001 any_x32_testlist="sizeof-long-4" 2002 2003 abilist="64 x32 32" 2004 if test "$enable_assembly" = "yes" ; then 2005 extra_functions_64="$extra_functions_64 invert_limb_table" 2006 extra_functions_x32=$extra_functions_64 2007 fi 2008 2009 case $host in 2010 *-*-solaris*) 2011 # Sun cc. 2012 cc_64_cflags="-xO3 -m64" 2013 ;; 2014 *-*-mingw* | *-*-msys | *-*-cygwin) 2015 limb_64=longlong 2016 CALLING_CONVENTIONS_OBJS_64="" 2017 AC_DEFINE(HOST_DOS64,1,[Define to 1 for Windos/64]) 2018 GMP_NONSTD_ABI_64=DOS64 2019 ;; 2020 esac 2021 ;; 2022 esac 2023 ;; 2024 2025 2026 # Special CPU "none" used to select generic C, now this is obsolete. 2027 none-*-*) 2028 enable_assembly=no 2029 AC_MSG_WARN([the \"none\" host is obsolete, use --disable-assembly]) 2030 ;; 2031 2032esac 2033 2034# mingw can be built by the cygwin gcc if -mno-cygwin is added. For 2035# convenience add this automatically if it works. Actual mingw gcc accepts 2036# -mno-cygwin too, but of course is the default. mingw only runs on the 2037# x86s, but allow any CPU here so as to catch "none" too. 2038# 2039case $host in 2040 *-*-mingw* | *-*-msys) 2041 gcc_cflags_optlist="$gcc_cflags_optlist nocygwin" 2042 gcc_cflags_nocygwin="-mno-cygwin" 2043 ;; 2044esac 2045 2046 2047CFLAGS_or_unset=${CFLAGS-'(unset)'} 2048CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'} 2049 2050cat >&AC_FD_CC <<EOF 2051User: 2052ABI=$ABI 2053CC=$CC 2054CFLAGS=$CFLAGS_or_unset 2055CPPFLAGS=$CPPFLAGS_or_unset 2056MPN_PATH=$MPN_PATH 2057GMP: 2058abilist=$abilist 2059cclist=$cclist 2060EOF 2061 2062 2063test_CFLAGS=${CFLAGS+set} 2064test_CPPFLAGS=${CPPFLAGS+set} 2065 2066for abi in $abilist; do 2067 abi_last="$abi" 2068done 2069 2070# If the user specifies an ABI then it must be in $abilist, after that 2071# $abilist is restricted to just that choice. 2072# 2073if test -n "$ABI"; then 2074 found=no 2075 for abi in $abilist; do 2076 if test $abi = "$ABI"; then found=yes; break; fi 2077 done 2078 if test $found = no; then 2079 AC_MSG_ERROR([ABI=$ABI is not among the following valid choices: $abilist]) 2080 fi 2081 abilist="$ABI" 2082fi 2083 2084found_compiler=no 2085 2086for abi in $abilist; do 2087 2088 echo "checking ABI=$abi" 2089 2090 # Suppose abilist="64 32", then for abi=64, will have abi1="_64" and 2091 # abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how 2092 # $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the 2093 # abilist), but there's no fallback for $gcc_64_cflags. 2094 # 2095 abi1=[`echo _$abi | sed 's/[.]//g'`] 2096 if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi 2097 2098 # Compiler choices under this ABI 2099 eval cclist_chosen=\"\$cclist$abi1\" 2100 test -n "$cclist_chosen" || eval cclist_chosen=\"\$cclist$abi2\" 2101 2102 # If there's a user specified $CC then don't use a list for 2103 # $cclist_chosen, just a single value for $ccbase. 2104 # 2105 if test -n "$CC"; then 2106 2107 # The first word of $CC, stripped of any directory. For instance 2108 # CC="/usr/local/bin/gcc -pipe" will give "gcc". 2109 # 2110 for ccbase in $CC; do break; done 2111 ccbase=`echo $ccbase | sed 's:.*/::'` 2112 2113 # If this $ccbase is in $cclist_chosen then it's a compiler we know and 2114 # we can do flags defaulting with it. If not, then $cclist_chosen is 2115 # set to "unrecognised" so no default flags are used. 2116 # 2117 # "unrecognised" is used to avoid bad effects with eval if $ccbase has 2118 # non-symbol characters. For instance ccbase=my+cc would end up with 2119 # something like cflags="$my+cc_cflags" which would give 2120 # cflags="+cc_cflags" rather than the intended empty string for an 2121 # unknown compiler. 2122 # 2123 found=unrecognised 2124 for i in $cclist_chosen; do 2125 if test "$ccbase" = $i; then 2126 found=$ccbase 2127 break 2128 fi 2129 done 2130 cclist_chosen=$found 2131 fi 2132 2133 for ccbase in $cclist_chosen; do 2134 2135 # When cross compiling, look for a compiler with the $host_alias as a 2136 # prefix, the same way that AC_CHECK_TOOL does. But don't do this to a 2137 # user-selected $CC. 2138 # 2139 # $cross_compiling will be yes/no/maybe at this point. Do the host 2140 # prefixing for "maybe" as well as "yes". 2141 # 2142 if test "$cross_compiling" != no && test -z "$CC"; then 2143 cross_compiling_prefix="${host_alias}-" 2144 fi 2145 2146 for ccprefix in $cross_compiling_prefix ""; do 2147 2148 cc="$CC" 2149 test -n "$cc" || cc="$ccprefix$ccbase" 2150 2151 # If the compiler is gcc but installed under another name, then change 2152 # $ccbase so as to use the flags we know for gcc. This helps for 2153 # instance when specifying CC=gcc272 on Debian GNU/Linux, or the 2154 # native cc which is really gcc on NeXT or MacOS-X. 2155 # 2156 # FIXME: There's a slight misfeature here. If cc is actually gcc but 2157 # gcc is not a known compiler under this $abi then we'll end up 2158 # testing it with no flags and it'll work, but chances are it won't be 2159 # in the right mode for the ABI we desire. Let's quietly hope this 2160 # doesn't happen. 2161 # 2162 if test $ccbase != gcc; then 2163 GMP_PROG_CC_IS_GNU($cc,ccbase=gcc) 2164 fi 2165 2166 # Similarly if the compiler is IBM xlc but invoked as cc or whatever 2167 # then change $ccbase and make the default xlc flags available. 2168 if test $ccbase != xlc; then 2169 GMP_PROG_CC_IS_XLC($cc,ccbase=xlc) 2170 fi 2171 2172 # acc was Sun's first unbundled compiler back in the SunOS days, or 2173 # something like that, but today its man page says it's not meant to 2174 # be used directly (instead via /usr/ucb/cc). The options are pretty 2175 # much the same as the main SunPRO cc, so share those configs. 2176 # 2177 case $host in 2178 *sparc*-*-solaris* | *sparc*-*-sunos*) 2179 if test "$ccbase" = acc; then ccbase=cc; fi ;; 2180 esac 2181 2182 for tmp_cflags_maybe in yes no; do 2183 eval cflags=\"\$${ccbase}${abi1}_cflags\" 2184 test -n "$cflags" || eval cflags=\"\$${ccbase}${abi2}_cflags\" 2185 2186 if test "$tmp_cflags_maybe" = yes; then 2187 # don't try cflags_maybe when the user set CFLAGS 2188 if test "$test_CFLAGS" = set; then continue; fi 2189 eval cflags_maybe=\"\$${ccbase}${abi1}_cflags_maybe\" 2190 test -n "$cflags_maybe" || eval cflags_maybe=\"\$${ccbase}${abi2}_cflags_maybe\" 2191 # don't try cflags_maybe if there's nothing set 2192 if test -z "$cflags_maybe"; then continue; fi 2193 cflags="$cflags_maybe $cflags" 2194 fi 2195 2196 # Any user CFLAGS, even an empty string, takes precedence 2197 if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi 2198 2199 # Any user CPPFLAGS, even an empty string, takes precedence 2200 eval cppflags=\"\$${ccbase}${abi1}_cppflags\" 2201 test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\" 2202 if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi 2203 2204 # --enable-profiling adds -p/-pg even to user-specified CFLAGS. 2205 # This is convenient, but it's perhaps a bit naughty to modify user 2206 # CFLAGS. 2207 case "$enable_profiling" in 2208 prof) cflags="$cflags -p" ;; 2209 gprof) cflags="$cflags -pg" ;; 2210 instrument) cflags="$cflags -finstrument-functions" ;; 2211 esac 2212 2213 GMP_PROG_CC_WORKS($cc $cflags $cppflags,,continue) 2214 2215 # If we're supposed to be using a "long long" for a limb, check that 2216 # it works. 2217 eval limb_chosen=\"\$limb$abi1\" 2218 test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\" 2219 if test "$limb_chosen" = longlong; then 2220 GMP_PROG_CC_WORKS_LONGLONG($cc $cflags $cppflags,,continue) 2221 fi 2222 2223 # The tests to perform on this $cc, if any 2224 eval testlist=\"\$${ccbase}${abi1}_testlist\" 2225 test -n "$testlist" || eval testlist=\"\$${ccbase}${abi2}_testlist\" 2226 test -n "$testlist" || eval testlist=\"\$any${abi1}_testlist\" 2227 test -n "$testlist" || eval testlist=\"\$any${abi2}_testlist\" 2228 2229 testlist_pass=yes 2230 for tst in $testlist; do 2231 case $tst in 2232 hpc-hppa-2-0) GMP_HPC_HPPA_2_0($cc,,testlist_pass=no) ;; 2233 gcc-arm-umodsi) GMP_GCC_ARM_UMODSI($cc,,testlist_pass=no) ;; 2234 gcc-mips-o32) GMP_GCC_MIPS_O32($cc,,testlist_pass=no) ;; 2235 hppa-level-2.0) GMP_HPPA_LEVEL_20($cc $cflags,,testlist_pass=no) ;; 2236 sizeof*) GMP_C_TEST_SIZEOF($cc $cflags,$tst,,testlist_pass=no) ;; 2237 esac 2238 if test $testlist_pass = no; then break; fi 2239 done 2240 2241 if test $testlist_pass = yes; then 2242 found_compiler=yes 2243 break 2244 fi 2245 done 2246 2247 if test $found_compiler = yes; then break; fi 2248 done 2249 2250 if test $found_compiler = yes; then break; fi 2251 done 2252 2253 if test $found_compiler = yes; then break; fi 2254done 2255 2256 2257# If we recognised the CPU, as indicated by $path being set, then insist 2258# that we have a working compiler, either from our $cclist choices or from 2259# $CC. We can't let AC_PROG_CC look around for a compiler because it might 2260# find one that we've rejected (for not supporting the modes our asm code 2261# demands, etc). 2262# 2263# If we didn't recognise the CPU (and this includes host_cpu=none), then 2264# fall through and let AC_PROG_CC look around for a compiler too. This is 2265# mostly in the interests of following a standard autoconf setup, after all 2266# we've already tested cc and gcc adequately (hopefully). As of autoconf 2267# 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft 2268# C on MS-DOS systems). 2269# 2270if test $found_compiler = no && test -n "$path"; then 2271 AC_MSG_ERROR([could not find a working compiler, see config.log for details]) 2272fi 2273 2274case $host in 2275 X86_PATTERN | X86_64_PATTERN) 2276 # If the user asked for a fat build, override the path and flags set above 2277 if test $enable_fat = yes; then 2278 gcc_cflags_cpu="" 2279 gcc_cflags_arch="" 2280 2281 fat_functions="add_n addmul_1 bdiv_dbm1c com cnd_add_n cnd_sub_n 2282 copyd copyi dive_1 divrem_1 2283 gcd_11 lshift lshiftc mod_1 mod_1_1 mod_1_1_cps mod_1_2 2284 mod_1_2_cps mod_1_4 mod_1_4_cps mod_34lsub1 mode1o mul_1 2285 mul_basecase mullo_basecase pre_divrem_1 pre_mod_1 redc_1 2286 redc_2 rshift sqr_basecase sub_n submul_1" 2287 2288 if test "$abi" = 32; then 2289 extra_functions="$extra_functions fat fat_entry" 2290 path="x86/fat x86" 2291 fat_path="x86 x86/fat x86/i486 2292 x86/k6 x86/k6/mmx x86/k6/k62mmx 2293 x86/k7 x86/k7/mmx 2294 x86/k8 x86/k10 x86/bt1 x86/bd1 2295 x86/pentium x86/pentium/mmx 2296 x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2 2297 x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2 2298 x86/core2 x86/coreinhm x86/coreisbr 2299 x86/goldmont x86/silvermont 2300 x86/atom x86/atom/mmx x86/atom/sse2 x86/nano" 2301 fi 2302 2303 if test "$abi" = 64; then 2304 gcc_64_cflags="" 2305 extra_functions_64="$extra_functions_64 fat fat_entry" 2306 path_64="x86_64/fat x86_64" 2307 fat_path="x86_64 x86_64/fat 2308 x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bt1 x86_64/bt2 x86_64/zen 2309 x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr 2310 x86_64/coreihwl x86_64/coreibwl x86_64/skylake x86_64/atom 2311 x86_64/silvermont x86_64/goldmont x86_64/nano" 2312 fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n" 2313 fi 2314 2315 fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD 2316 SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD 2317 BMOD_1_TO_MOD_1_THRESHOLD" 2318 fi 2319 ;; 2320esac 2321 2322 2323if test $found_compiler = yes; then 2324 2325 # If we're creating CFLAGS, then look for optional additions. If the user 2326 # set CFLAGS then leave it alone. 2327 # 2328 if test "$test_CFLAGS" != set; then 2329 eval optlist=\"\$${ccbase}${abi1}_cflags_optlist\" 2330 test -n "$optlist" || eval optlist=\"\$${ccbase}${abi2}_cflags_optlist\" 2331 2332 for opt in $optlist; do 2333 eval optflags=\"\$${ccbase}${abi1}_cflags_${opt}\" 2334 test -n "$optflags" || eval optflags=\"\$${ccbase}${abi2}_cflags_${opt}\" 2335 test -n "$optflags" || eval optflags=\"\$${ccbase}_cflags_${opt}\" 2336 2337 for flag in $optflags; do 2338 2339 # ~ represents a space in an option spec 2340 flag=`echo "$flag" | tr '~' ' '` 2341 2342 case $flag in 2343 -march=pentium4 | -march=k8) 2344 # For -march settings which enable SSE2 we exclude certain bad 2345 # gcc versions and we need an OS knowing how to save xmm regs. 2346 # 2347 # This is only for ABI=32, any 64-bit gcc is good and any OS 2348 # knowing x86_64 will know xmm. 2349 # 2350 # -march=k8 was only introduced in gcc 3.3, so we shouldn't need 2351 # the GMP_GCC_PENTIUM4_SSE2 check (for gcc 3.2 and prior). But 2352 # it doesn't hurt to run it anyway, sharing code with the 2353 # pentium4 case. 2354 # 2355 if test "$abi" = 32; then 2356 GMP_GCC_PENTIUM4_SSE2($cc $cflags $cppflags,, continue) 2357 GMP_OS_X86_XMM($cc $cflags $cppflags,, continue) 2358 fi 2359 ;; 2360 -no-cpp-precomp) 2361 # special check, avoiding a warning 2362 GMP_GCC_NO_CPP_PRECOMP($ccbase,$cc,$cflags, 2363 [cflags="$cflags $flag" 2364 break], 2365 [continue]) 2366 ;; 2367 -Wa,-m*) 2368 case $host in 2369 alpha*-*-*) 2370 GMP_GCC_WA_MCPU($cc $cflags, $flag, , [continue]) 2371 ;; 2372 esac 2373 ;; 2374 -Wa,-oldas) 2375 GMP_GCC_WA_OLDAS($cc $cflags $cppflags, 2376 [cflags="$cflags $flag" 2377 break], 2378 [continue]) 2379 ;; 2380 esac 2381 2382 GMP_PROG_CC_WORKS($cc $cflags $cppflags $flag, 2383 [cflags="$cflags $flag" 2384 break]) 2385 done 2386 done 2387 fi 2388 2389 ABI="$abi" 2390 CC="$cc" 2391 CFLAGS="$cflags" 2392 CPPFLAGS="$cppflags" 2393 2394 # Could easily have this in config.h too, if desired. 2395 ABI_nodots=`echo $ABI | sed 's/\./_/'` 2396 GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST) 2397 2398 eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI_nodots\" 2399 2400 # GMP_LDFLAGS substitution, selected according to ABI. 2401 # These are needed on libgmp.la and libmp.la, but currently not on 2402 # convenience libraries like tune/libspeed.la or mpz/libmpz.la. 2403 # 2404 eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\" 2405 test -n "$GMP_LDFLAGS" || eval GMP_LDFLAGS=\"\$${ccbase}${abi1}_ldflags\" 2406 AC_SUBST(GMP_LDFLAGS) 2407 AC_SUBST(LIBGMP_LDFLAGS) 2408 AC_SUBST(LIBGMPXX_LDFLAGS) 2409 2410 # extra_functions, selected according to ABI 2411 eval tmp=\"\$extra_functions$abi1\" 2412 test -n "$tmp" || eval tmp=\"\$extra_functions$abi2\" 2413 extra_functions="$tmp" 2414 2415 2416 # Cycle counter, selected according to ABI. 2417 # 2418 eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi1\" 2419 test -n "$tmp" || eval tmp=\"\$SPEED_CYCLECOUNTER_OBJ$abi2\" 2420 SPEED_CYCLECOUNTER_OBJ="$tmp" 2421 eval tmp=\"\$cyclecounter_size$abi1\" 2422 test -n "$tmp" || eval tmp=\"\$cyclecounter_size$abi2\" 2423 cyclecounter_size="$tmp" 2424 2425 if test -n "$SPEED_CYCLECOUNTER_OBJ"; then 2426 AC_DEFINE_UNQUOTED(HAVE_SPEED_CYCLECOUNTER, $cyclecounter_size, 2427 [Tune directory speed_cyclecounter, undef=none, 1=32bits, 2=64bits)]) 2428 fi 2429 AC_SUBST(SPEED_CYCLECOUNTER_OBJ) 2430 2431 2432 # Calling conventions checking, selected according to ABI. 2433 # 2434 eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\" 2435 test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\" 2436 if test "$enable_assembly" = "yes"; then 2437 CALLING_CONVENTIONS_OBJS="$tmp" 2438 else 2439 CALLING_CONVENTIONS_OBJS="" 2440 fi 2441 2442 if test -n "$CALLING_CONVENTIONS_OBJS"; then 2443 AC_DEFINE(HAVE_CALLING_CONVENTIONS,1, 2444 [Define to 1 if tests/libtests has calling conventions checking for the CPU]) 2445 fi 2446 AC_SUBST(CALLING_CONVENTIONS_OBJS) 2447 2448fi 2449 2450 2451# If the user gave an MPN_PATH, use that verbatim, otherwise choose 2452# according to the ABI and add "generic". 2453# 2454if test -n "$MPN_PATH"; then 2455 path="$MPN_PATH" 2456else 2457 eval tmp=\"\$path$abi1\" 2458 test -n "$tmp" || eval tmp=\"\$path$abi2\" 2459 path="$tmp generic" 2460fi 2461 2462 2463# Long long limb setup for gmp.h. 2464case $limb_chosen in 2465longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;; 2466*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;; 2467esac 2468AC_SUBST(DEFN_LONG_LONG_LIMB) 2469 2470 2471# The C compiler and preprocessor, put into ANSI mode if possible. 2472AC_PROG_CC 2473AC_PROG_CC_C99 2474AC_PROG_CPP 2475 2476#if test "$ac_cv_prog_cc_c99" = no; then 2477# AC_MSG_ERROR([Cannot find a C99 capable compiler]) 2478#fi 2479 2480# The C compiler on the build system, and associated tests. 2481GMP_PROG_CC_FOR_BUILD 2482GMP_PROG_CPP_FOR_BUILD 2483GMP_PROG_EXEEXT_FOR_BUILD 2484GMP_C_FOR_BUILD_ANSI 2485GMP_CHECK_LIBM_FOR_BUILD 2486 2487 2488# How to assemble, used with CFLAGS etc, see mpn/Makeasm.am. 2489# Using the compiler is a lot easier than figuring out how to invoke the 2490# assembler directly. 2491# 2492test -n "$CCAS" || CCAS="$CC -c" 2493AC_SUBST(CCAS) 2494 2495 2496# The C++ compiler, if desired. 2497want_cxx=no 2498if test $enable_cxx != no; then 2499 test_CXXFLAGS=${CXXFLAGS+set} 2500 AC_PROG_CXX 2501 2502 echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC 2503 cxxflags_ac_prog_cxx=$CXXFLAGS 2504 cxxflags_list=ac_prog_cxx 2505 2506 # If the user didn't specify $CXXFLAGS, then try $CFLAGS, with -g removed 2507 # if AC_PROG_CXX thinks that doesn't work. $CFLAGS stands a good chance 2508 # of working, eg. on a GNU system where CC=gcc and CXX=g++. 2509 # 2510 if test "$test_CXXFLAGS" != set; then 2511 cxxflags_cflags=$CFLAGS 2512 cxxflags_list="cflags $cxxflags_list" 2513 if test "$ac_prog_cxx_g" = no; then 2514 cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'` 2515 fi 2516 fi 2517 2518 # See if the C++ compiler works. If the user specified CXXFLAGS then all 2519 # we're doing is checking whether AC_PROG_CXX succeeded, since it doesn't 2520 # give a fatal error, just leaves CXX set to a default g++. If on the 2521 # other hand the user didn't specify CXXFLAGS then we get to try here our 2522 # $cxxflags_list alternatives. 2523 # 2524 # Automake includes $CPPFLAGS in a C++ compile, so we do the same here. 2525 # 2526 for cxxflags_choice in $cxxflags_list; do 2527 eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\" 2528 GMP_PROG_CXX_WORKS($CXX $CPPFLAGS $CXXFLAGS, 2529 [want_cxx=yes 2530 break]) 2531 done 2532 2533 # If --enable-cxx=yes but a C++ compiler can't be found, then abort. 2534 if test $want_cxx = no && test $enable_cxx = yes; then 2535 AC_MSG_ERROR([C++ compiler not available, see config.log for details]) 2536 fi 2537fi 2538 2539AM_CONDITIONAL(WANT_CXX, test $want_cxx = yes) 2540 2541# FIXME: We're not interested in CXXCPP for ourselves, but if we don't do it 2542# here then AC_PROG_LIBTOOL will AC_REQUIRE it (via _LT_AC_TAGCONFIG) and 2543# hence execute it unconditionally, and that will fail if there's no C++ 2544# compiler (and no generic /lib/cpp). 2545# 2546if test $want_cxx = yes; then 2547 AC_PROG_CXXCPP 2548fi 2549 2550 2551# Path setups for Cray, according to IEEE or CFP. These must come after 2552# deciding the compiler. 2553# 2554GMP_CRAY_OPTIONS( 2555 [add_path="cray/ieee"], 2556 [add_path="cray/cfp"; extra_functions="mulwwc90"], 2557 [add_path="cray/cfp"; extra_functions="mulwwj90"]) 2558 2559 2560if test -z "$MPN_PATH"; then 2561 path="$add_path $path" 2562fi 2563 2564# For a nail build, also look in "nails" subdirectories. 2565# 2566if test $GMP_NAIL_BITS != 0 && test -z "$MPN_PATH"; then 2567 new_path= 2568 for i in $path; do 2569 case $i in 2570 generic) new_path="$new_path $i" ;; 2571 *) new_path="$new_path $i/nails $i" ;; 2572 esac 2573 done 2574 path=$new_path 2575fi 2576 2577 2578# Put all directories into CPUVEC_list so as to get a full set of 2579# CPUVEC_SETUP_$tmp_suffix defines into config.h, even if some of them are 2580# empty because mmx and/or sse2 had to be dropped. 2581# 2582for i in $fat_path; do 2583 GMP_FAT_SUFFIX(tmp_suffix, $i) 2584 CPUVEC_list="$CPUVEC_list CPUVEC_SETUP_$tmp_suffix" 2585done 2586 2587 2588# If there's any sse2 or mmx in the path, check whether the assembler 2589# supports it, and remove if not. 2590# 2591# We only need this in ABI=32, for ABI=64 on x86_64 we can assume a new 2592# enough assembler. 2593# 2594case $host in 2595 X86_PATTERN | X86_64_PATTERN) 2596 if test "$ABI" = 32; then 2597 case "$path $fat_path" in 2598 *mmx*) GMP_ASM_X86_MMX( , [GMP_STRIP_PATH(*mmx*)]) ;; 2599 esac 2600 case "$path $fat_path" in 2601 *sse2*) GMP_ASM_X86_SSE2( , [GMP_STRIP_PATH(sse2)]) ;; 2602 esac 2603 fi 2604 ;; 2605esac 2606 2607 2608if test "$enable_assembly" = "no"; then 2609 path="generic" 2610 AC_DEFINE([NO_ASM],1,[Define to 1 to disable the use of inline assembly]) 2611# for abi in $abilist; do 2612# eval unset "path_\$abi" 2613# eval gcc_${abi}_cflags=\"\$gcc_${abi}_cflags -DNO_ASM\" 2614# done 2615fi 2616 2617 2618cat >&AC_FD_CC <<EOF 2619Decided: 2620ABI=$ABI 2621CC=$CC 2622CFLAGS=$CFLAGS 2623CPPFLAGS=$CPPFLAGS 2624GMP_LDFLAGS=$GMP_LDFLAGS 2625CXX=$CXX 2626CXXFLAGS=$CXXFLAGS 2627path=$path 2628EOF 2629echo "using ABI=\"$ABI\"" 2630echo " CC=\"$CC\"" 2631echo " CFLAGS=\"$CFLAGS\"" 2632echo " CPPFLAGS=\"$CPPFLAGS\"" 2633if test $want_cxx = yes; then 2634 echo " CXX=\"$CXX\"" 2635 echo " CXXFLAGS=\"$CXXFLAGS\"" 2636fi 2637echo " MPN_PATH=\"$path\"" 2638 2639 2640CL_AS_NOEXECSTACK 2641 2642GMP_PROG_AR 2643GMP_PROG_NM 2644 2645case $host in 2646 # FIXME: On AIX 3 and 4, $libname.a is included in libtool 2647 # $library_names_spec, so libgmp.a becomes a symlink to libgmp.so, making 2648 # it impossible to build shared and static libraries simultaneously. 2649 # Disable shared libraries by default, but let the user override with 2650 # --enable-shared --disable-static. 2651 # 2652 # FIXME: This $libname.a problem looks like it might apply to *-*-amigaos* 2653 # and *-*-os2* too, but wait for someone to test this before worrying 2654 # about it. If there is a problem then of course libtool is the right 2655 # place to fix it. 2656 # 2657 [*-*-aix[34]*]) 2658 if test -z "$enable_shared"; then enable_shared=no; fi ;; 2659esac 2660 2661 2662# Configs for Windows DLLs. 2663 2664AC_LIBTOOL_WIN32_DLL 2665 2666AC_SUBST(LIBGMP_DLL,0) 2667case $host in 2668 *-*-cygwin* | *-*-mingw* | *-*-msys | *-*-pw32* | *-*-os2*) 2669 # By default, build only static. 2670 if test -z "$enable_shared"; then 2671 enable_shared=no 2672 fi 2673 # Don't allow both static and DLL. 2674 if test "$enable_shared" != no && test "$enable_static" != no; then 2675 AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each. 2676Use "--disable-static --enable-shared" to build just a DLL.]) 2677 fi 2678 2679 # "-no-undefined" is required when building a DLL, see documentation on 2680 # AC_LIBTOOL_WIN32_DLL. 2681 # 2682 # "-Wl,--export-all-symbols" is a bit of a hack, it gets all libgmp and 2683 # libgmpxx functions and variables exported. This is what libtool did 2684 # in the past, and it's convenient for us in the test programs. 2685 # 2686 # Maybe it'd be prudent to check for --export-all-symbols before using 2687 # it, but it seems to have been in ld since at least 2000, and there's 2688 # not really any alternative we want to take up at the moment. 2689 # 2690 # "-Wl,output-def" is used to get a .def file for use by MS lib to make 2691 # a .lib import library, described in the manual. libgmp-3.dll.def 2692 # corresponds to the libmp-3.dll.def generated by libtool (as a result 2693 # of -export-symbols on that library). 2694 # 2695 # Incidentally, libtool does generate an import library libgmp.dll.a, 2696 # but it's "ar" format and cannot be used by the MS linker. There 2697 # doesn't seem to be any GNU tool for generating or converting to .lib. 2698 # 2699 # FIXME: The .def files produced by -Wl,output-def include isascii, 2700 # iscsym, iscsymf and toascii, apparently because mingw ctype.h doesn't 2701 # inline isascii (used in gmp). It gives an extern inline for 2702 # __isascii, but for some reason not the plain isascii. 2703 # 2704 if test "$enable_shared" = yes; then 2705 GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols" 2706 LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def" 2707 LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def" 2708 LIBGMP_DLL=1 2709 fi 2710 ;; 2711esac 2712 2713 2714# Ensure that $CONFIG_SHELL is available for AC_LIBTOOL_SYS_MAX_CMD_LEN. 2715# It's often set already by _LT_AC_PROG_ECHO_BACKSLASH or 2716# _AS_LINENO_PREPARE, but not always. 2717# 2718# The symptom of CONFIG_SHELL unset is some "expr" errors during the test, 2719# and an empty result. This only happens when invoked as "sh configure", 2720# ie. no path, and can be seen for instance on ia64-*-hpux*. 2721# 2722# FIXME: Newer libtool should have it's own fix for this. 2723# 2724if test -z "$CONFIG_SHELL"; then 2725 CONFIG_SHELL=$SHELL 2726fi 2727 2728# Enable CXX in libtool only if we want it, and never enable GCJ, nor RC on 2729# mingw and cygwin. Under --disable-cxx this avoids some error messages 2730# from libtool arising from the fact we didn't actually run AC_PROG_CXX. 2731# Notice that any user-supplied --with-tags setting takes precedence. 2732# 2733# FIXME: Is this the right way to get this effect? Very possibly not, but 2734# the current _LT_AC_TAGCONFIG doesn't really suggest an alternative. 2735# 2736if test "${with_tags+set}" != set; then 2737 if test $want_cxx = yes; then 2738 with_tags=CXX 2739 else 2740 with_tags= 2741 fi 2742fi 2743 2744# The dead hand of AC_REQUIRE makes AC_PROG_LIBTOOL expand and execute 2745# AC_PROG_F77, even when F77 is not in the selected with_tags. This is 2746# probably harmless, but it's unsightly and bloats our configure, so pretend 2747# AC_PROG_F77 has been expanded already. 2748# 2749# FIXME: Rumour has it libtool will one day provide a way for a configure.in 2750# to say what it wants from among supported languages etc. 2751# 2752#AC_PROVIDE([AC_PROG_F77]) 2753 2754AC_PROG_LIBTOOL 2755 2756# Generate an error here if attempting to build both shared and static when 2757# $libname.a is in $library_names_spec (as mentioned above), rather than 2758# wait for ar or ld to fail. 2759# 2760if test "$enable_shared" = yes && test "$enable_static" = yes; then 2761 case $library_names_spec in 2762 *libname.a*) 2763 AC_MSG_ERROR([cannot create both shared and static libraries on this system, --disable one of the two]) 2764 ;; 2765 esac 2766fi 2767 2768AM_CONDITIONAL(ENABLE_STATIC, test "$enable_static" = yes) 2769 2770 2771# Many of these library and header checks are for the benefit of 2772# supplementary programs. libgmp doesn't use anything too weird. 2773 2774AC_HEADER_STDC 2775AC_HEADER_TIME 2776 2777# Reasons for testing: 2778# float.h - not in SunOS bundled cc 2779# invent.h - IRIX specific 2780# langinfo.h - X/Open standard only, not in djgpp for instance 2781# locale.h - old systems won't have this 2782# nl_types.h - X/Open standard only, not in djgpp for instance 2783# (usually langinfo.h gives nl_item etc, but not on netbsd 1.4.1) 2784# sys/attributes.h - IRIX specific 2785# sys/iograph.h - IRIX specific 2786# sys/mman.h - not in Cray Unicos 2787# sys/param.h - not in mingw 2788# sys/processor.h - solaris specific, though also present in macos 2789# sys/pstat.h - HPUX specific 2790# sys/resource.h - not in mingw 2791# sys/sysctl.h - not in mingw 2792# sys/sysinfo.h - OSF specific 2793# sys/syssgi.h - IRIX specific 2794# sys/systemcfg.h - AIX specific 2795# sys/time.h - autoconf suggests testing, don't know anywhere without it 2796# sys/times.h - not in mingw 2797# machine/hal_sysinfo.h - OSF specific 2798# 2799# inttypes.h, stdint.h, unistd.h and sys/types.h are already in the autoconf 2800# default tests 2801# 2802AC_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) 2803 2804# On SunOS, sys/resource.h needs sys/time.h (for struct timeval) 2805AC_CHECK_HEADERS(sys/resource.h,,, 2806[#if TIME_WITH_SYS_TIME 2807# include <sys/time.h> 2808# include <time.h> 2809#else 2810# if HAVE_SYS_TIME_H 2811# include <sys/time.h> 2812# else 2813# include <time.h> 2814# endif 2815#endif]) 2816 2817# On NetBSD and OpenBSD, sys/sysctl.h needs sys/param.h for various constants 2818AC_CHECK_HEADERS(sys/sysctl.h,,, 2819[#if HAVE_SYS_PARAM_H 2820# include <sys/param.h> 2821#endif]) 2822 2823# On OSF 4.0, <machine/hal_sysinfo.h> must have <sys/sysinfo.h> for ulong_t 2824AC_CHECK_HEADERS(machine/hal_sysinfo.h,,, 2825[#if HAVE_SYS_SYSINFO_H 2826# include <sys/sysinfo.h> 2827#endif]) 2828 2829# Reasons for testing: 2830# optarg - not declared in mingw 2831# fgetc, fscanf, ungetc, vfprintf - not declared in SunOS 4 2832# sys_errlist, sys_nerr - not declared in SunOS 4 2833# 2834# optarg should be in unistd.h and the rest in stdio.h, both of which are 2835# in the autoconf default includes. 2836# 2837# sys_errlist and sys_nerr are supposed to be in <errno.h> on SunOS according 2838# to the man page (but aren't), in glibc they're in stdio.h. 2839# 2840AC_CHECK_DECLS([fgetc, fscanf, optarg, ungetc, vfprintf]) 2841AC_CHECK_DECLS([sys_errlist, sys_nerr], , , 2842[#include <stdio.h> 2843#include <errno.h>]) 2844 2845AC_TYPE_SIGNAL 2846 2847# Reasons for testing: 2848# intmax_t - C99 2849# long double - not in the HP bundled K&R cc 2850# long long - only in reasonably recent compilers 2851# ptrdiff_t - seems to be everywhere, maybe don't need to check this 2852# quad_t - BSD specific 2853# uint_least32_t - C99 2854# 2855# the default includes are sufficient for all these types 2856# 2857AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t, 2858 uint_least32_t, intptr_t]) 2859 2860# FIXME: Really want #ifndef __cplusplus around the #define volatile 2861# replacement autoconf gives, since volatile is always available in C++. 2862# But we don't use it in C++ currently. 2863AC_C_VOLATILE 2864 2865AC_C_RESTRICT 2866 2867# GMP_C_STDARG 2868GMP_C_ATTRIBUTE_CONST 2869GMP_C_ATTRIBUTE_MALLOC 2870GMP_C_ATTRIBUTE_MODE 2871GMP_C_ATTRIBUTE_NORETURN 2872GMP_C_HIDDEN_ALIAS 2873 2874GMP_H_EXTERN_INLINE 2875 2876# from libtool 2877AC_CHECK_LIBM 2878AC_SUBST(LIBM) 2879 2880GMP_FUNC_ALLOCA 2881GMP_OPTION_ALLOCA 2882 2883GMP_H_HAVE_FILE 2884 2885AC_C_BIGENDIAN( 2886 [AC_DEFINE(HAVE_LIMB_BIG_ENDIAN, 1) 2887 GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_LIMB_BIG_ENDIAN')", POST)], 2888 [AC_DEFINE(HAVE_LIMB_LITTLE_ENDIAN, 1) 2889 GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_LIMB_LITTLE_ENDIAN')", POST) 2890 ], [:]) 2891AH_VERBATIM([HAVE_LIMB], 2892[/* Define one of these to 1 for the endianness of `mp_limb_t'. 2893 If the endianness is not a simple big or little, or you don't know what 2894 it is, then leave both undefined. */ 2895#undef HAVE_LIMB_BIG_ENDIAN 2896#undef HAVE_LIMB_LITTLE_ENDIAN]) 2897 2898GMP_C_DOUBLE_FORMAT 2899 2900 2901# Reasons for testing: 2902# alarm - not in mingw 2903# attr_get - IRIX specific 2904# clock_gettime - not in glibc 2.2.4, only very recent systems 2905# cputime - not in glibc 2906# getsysinfo - OSF specific 2907# getrusage - not in mingw 2908# gettimeofday - not in mingw 2909# mmap - not in mingw, djgpp 2910# nl_langinfo - X/Open standard only, not in djgpp for instance 2911# obstack_vprintf - glibc specific 2912# processor_info - solaris specific 2913# pstat_getprocessor - HPUX specific (10.x and up) 2914# raise - an ANSI-ism, though probably almost universal by now 2915# read_real_time - AIX specific 2916# sigaction - not in mingw 2917# sigaltstack - not in mingw, or old AIX (reputedly) 2918# sigstack - not in mingw 2919# strerror - not in SunOS 2920# strnlen - glibc extension (some other systems too) 2921# syssgi - IRIX specific 2922# times - not in mingw 2923# 2924# AC_FUNC_STRNLEN is not used because we don't want the AC_LIBOBJ 2925# replacement setups it gives. It detects a faulty strnlen on AIX, but 2926# missing out on that test is ok since our only use of strnlen is in 2927# __gmp_replacement_vsnprintf which is not required on AIX since it has a 2928# vsnprintf. 2929# 2930AC_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) 2931 2932# clock_gettime is in librt on *-*-osf5.1 and on glibc, so att -lrt to 2933# TUNE_LIBS if needed. On linux (tested on x86_32, 2.6.26), 2934# clock_getres reports ns accuracy, while in a quick test on osf 2935# clock_getres said only 1 millisecond. 2936 2937old_LIBS="$LIBS" 2938AC_SEARCH_LIBS(clock_gettime, rt, [ 2939 AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])]) 2940TUNE_LIBS="$LIBS" 2941LIBS="$old_LIBS" 2942 2943AC_SUBST(TUNE_LIBS) 2944 2945GMP_FUNC_VSNPRINTF 2946GMP_FUNC_SSCANF_WRITABLE_INPUT 2947 2948# Reasons for checking: 2949# pst_processor psp_iticksperclktick - not in hpux 9 2950# 2951AC_CHECK_MEMBER(struct pst_processor.psp_iticksperclktick, 2952 [AC_DEFINE(HAVE_PSP_ITICKSPERCLKTICK, 1, 2953[Define to 1 if <sys/pstat.h> `struct pst_processor' exists 2954and contains `psp_iticksperclktick'.])],, 2955 [#include <sys/pstat.h>]) 2956 2957# C++ tests, when required 2958# 2959if test $enable_cxx = yes; then 2960 AC_LANG_PUSH(C++) 2961 2962 # Reasons for testing: 2963 # <sstream> - not in g++ 2.95.2 2964 # std::locale - not in g++ 2.95.4 2965 # 2966 AC_CHECK_HEADERS([sstream]) 2967 AC_CHECK_TYPES([std::locale],,,[#include <locale>]) 2968 2969 AC_LANG_POP(C++) 2970fi 2971 2972 2973# Pick the correct source files in $path and link them to mpn/. 2974# $gmp_mpn_functions lists all functions we need. 2975# 2976# The rule is to find a file with the function name and a .asm, .S, 2977# .s, or .c extension. Certain multi-function files with special names 2978# can provide some functions too. (mpn/Makefile.am passes 2979# -DOPERATION_<func> to get them to generate the right code.) 2980 2981# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former 2982# can optionally provide the latter as an extra entrypoint. Likewise 2983# divrem_1 and pre_divrem_1. 2984 2985gmp_mpn_functions_optional="umul udiv \ 2986 invert_limb sqr_diagonal sqr_diag_addlsh1 \ 2987 mul_2 mul_3 mul_4 mul_5 mul_6 \ 2988 addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \ 2989 addlsh1_n sublsh1_n rsblsh1_n rsh1add_n rsh1sub_n \ 2990 addlsh2_n sublsh2_n rsblsh2_n \ 2991 addlsh_n sublsh_n rsblsh_n \ 2992 add_n_sub_n addaddmul_1msb0" 2993 2994gmp_mpn_functions="$extra_functions \ 2995 add add_1 add_n sub sub_1 sub_n cnd_add_n cnd_sub_n cnd_swap neg com \ 2996 mul_1 addmul_1 submul_1 \ 2997 add_err1_n add_err2_n add_err3_n sub_err1_n sub_err2_n sub_err3_n \ 2998 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \ 2999 fib2_ui fib2m mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \ 3000 mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \ 3001 mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \ 3002 mulmid_basecase toom42_mulmid mulmid_n mulmid \ 3003 random random2 pow_1 \ 3004 rootrem sqrtrem sizeinbase get_str set_str compute_powtab \ 3005 scan0 scan1 popcount hamdist cmp zero_p \ 3006 perfsqr perfpow strongfibo \ 3007 gcd_11 gcd_22 gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \ 3008 gcdext_lehmer \ 3009 div_q tdiv_qr jacbase jacobi_2 jacobi get_d \ 3010 matrix22_mul matrix22_mul1_inverse_vector \ 3011 hgcd_matrix hgcd2 hgcd_step hgcd_reduce hgcd hgcd_appr \ 3012 hgcd2_jacobi hgcd_jacobi \ 3013 mullo_n mullo_basecase sqrlo sqrlo_basecase \ 3014 toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul \ 3015 toom33_mul toom43_mul toom53_mul toom54_mul toom63_mul \ 3016 toom44_mul \ 3017 toom6h_mul toom6_sqr toom8h_mul toom8_sqr \ 3018 toom_couple_handling \ 3019 toom2_sqr toom3_sqr toom4_sqr \ 3020 toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \ 3021 toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp toom_eval_pm2rexp \ 3022 toom_interpolate_5pts toom_interpolate_6pts toom_interpolate_7pts \ 3023 toom_interpolate_8pts toom_interpolate_12pts toom_interpolate_16pts \ 3024 invertappr invert binvert mulmod_bnm1 sqrmod_bnm1 \ 3025 div_qr_1 div_qr_1n_pi1 \ 3026 div_qr_2 div_qr_2n_pi1 div_qr_2u_pi1 \ 3027 sbpi1_div_q sbpi1_div_qr sbpi1_divappr_q \ 3028 dcpi1_div_q dcpi1_div_qr dcpi1_divappr_q \ 3029 mu_div_qr mu_divappr_q mu_div_q \ 3030 bdiv_q_1 \ 3031 sbpi1_bdiv_q sbpi1_bdiv_qr sbpi1_bdiv_r \ 3032 dcpi1_bdiv_q dcpi1_bdiv_qr \ 3033 mu_bdiv_q mu_bdiv_qr \ 3034 bdiv_q bdiv_qr broot brootinv bsqrt bsqrtinv \ 3035 divexact bdiv_dbm1c redc_1 redc_2 redc_n powm powlo sec_powm \ 3036 sec_mul sec_sqr sec_div_qr sec_div_r sec_pi1_div_qr sec_pi1_div_r \ 3037 sec_add_1 sec_sub_1 sec_invert \ 3038 trialdiv remove \ 3039 and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \ 3040 copyi copyd zero sec_tabselect \ 3041 comb_tables \ 3042 $gmp_mpn_functions_optional" 3043 3044define(GMP_MULFUNC_CHOICES, 3045[# functions that can be provided by multi-function files 3046tmp_mulfunc= 3047case $tmp_fn in 3048 add_n|sub_n) tmp_mulfunc="aors_n" ;; 3049 add_err1_n|sub_err1_n) 3050 tmp_mulfunc="aors_err1_n" ;; 3051 add_err2_n|sub_err2_n) 3052 tmp_mulfunc="aors_err2_n" ;; 3053 add_err3_n|sub_err3_n) 3054 tmp_mulfunc="aors_err3_n" ;; 3055 cnd_add_n|cnd_sub_n) tmp_mulfunc="cnd_aors_n" ;; 3056 sec_add_1|sec_sub_1) tmp_mulfunc="sec_aors_1" ;; 3057 addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;; 3058 mul_2|addmul_2) tmp_mulfunc="aormul_2" ;; 3059 mul_3|addmul_3) tmp_mulfunc="aormul_3" ;; 3060 mul_4|addmul_4) tmp_mulfunc="aormul_4" ;; 3061 popcount|hamdist) tmp_mulfunc="popham" ;; 3062 and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n) 3063 tmp_mulfunc="logops_n" ;; 3064 lshift|rshift) tmp_mulfunc="lorrshift";; 3065 addlsh1_n) 3066 tmp_mulfunc="aorslsh1_n aorrlsh1_n aorsorrlsh1_n";; 3067 sublsh1_n) 3068 tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";; 3069 rsblsh1_n) 3070 tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";; 3071 addlsh2_n) 3072 tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";; 3073 sublsh2_n) 3074 tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";; 3075 rsblsh2_n) 3076 tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";; 3077 addlsh_n) 3078 tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";; 3079 sublsh_n) 3080 tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";; 3081 rsblsh_n) 3082 tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";; 3083 rsh1add_n|rsh1sub_n) 3084 tmp_mulfunc="rsh1aors_n";; 3085 sec_div_qr|sec_div_r) 3086 tmp_mulfunc="sec_div";; 3087 sec_pi1_div_qr|sec_pi1_div_r) 3088 tmp_mulfunc="sec_pi1_div";; 3089esac 3090]) 3091 3092# the list of all object files used by mpn/Makefile.in and the 3093# top-level Makefile.in, respectively 3094mpn_objects= 3095mpn_objs_in_libgmp= 3096 3097# links from the sources, to be removed by "make distclean" 3098gmp_srclinks= 3099 3100 3101# mpn_relative_top_srcdir is $top_srcdir, but for use from within the mpn 3102# build directory. If $srcdir is relative then we use a relative path too, 3103# so the two trees can be moved together. 3104case $srcdir in 3105 [[\\/]* | ?:[\\/]*]) # absolute, as per autoconf 3106 mpn_relative_top_srcdir=$srcdir ;; 3107 *) # relative 3108 mpn_relative_top_srcdir=../$srcdir ;; 3109esac 3110 3111 3112define(MPN_SUFFIXES,[asm S s c]) 3113 3114dnl Usage: GMP_FILE_TO_FUNCTION_BASE(func,file) 3115dnl 3116dnl Set $func to the function base name for $file, eg. dive_1 gives 3117dnl divexact_1. 3118dnl 3119define(GMP_FILE_TO_FUNCTION, 3120[case $$2 in 3121 dive_1) $1=divexact_1 ;; 3122 diveby3) $1=divexact_by3c ;; 3123 pre_divrem_1) $1=preinv_divrem_1 ;; 3124 mode1o) $1=modexact_1c_odd ;; 3125 pre_mod_1) $1=preinv_mod_1 ;; 3126 mod_1_1) $1=mod_1_1p ;; 3127 mod_1_1_cps) $1=mod_1_1p_cps ;; 3128 mod_1_2) $1=mod_1s_2p ;; 3129 mod_1_2_cps) $1=mod_1s_2p_cps ;; 3130 mod_1_3) $1=mod_1s_3p ;; 3131 mod_1_3_cps) $1=mod_1s_3p_cps ;; 3132 mod_1_4) $1=mod_1s_4p ;; 3133 mod_1_4_cps) $1=mod_1s_4p_cps ;; 3134 *) $1=$$2 ;; 3135esac 3136]) 3137 3138# Fat binary setups. 3139# 3140# We proceed through each $fat_path directory, and look for $fat_function 3141# routines there. Those found are incorporated in the build by generating a 3142# little mpn/<foo>.asm or mpn/<foo>.c file in the build directory, with 3143# suitable function renaming, and adding that to $mpn_objects (the same as a 3144# normal mpn file). 3145# 3146# fat.h is generated with macros to let internal calls to each $fat_function 3147# go directly through __gmpn_cpuvec, plus macros and declarations helping to 3148# setup that structure, on a per-directory basis ready for 3149# mpn/<cpu>/fat/fat.c. 3150# 3151# fat.h includes thresholds listed in $fat_thresholds, extracted from 3152# gmp-mparam.h in each directory. An overall maximum for each threshold is 3153# established, for use in making fixed size arrays of temporary space. 3154# (Eg. MUL_TOOM33_THRESHOLD_LIMIT used by mpn/generic/mul.c.) 3155# 3156# It'd be possible to do some of this manually, but when there's more than a 3157# few functions and a few directories it becomes very tedious, and very 3158# prone to having some routine accidentally omitted. On that basis it seems 3159# best to automate as much as possible, even if the code to do so is a bit 3160# ugly. 3161# 3162 3163if test -n "$fat_path"; then 3164 # Usually the mpn build directory is created with mpn/Makefile 3165 # instantiation, but we want to write to it sooner. 3166 mkdir mpn 2>/dev/null 3167 3168 echo "/* fat.h - setups for fat binaries." >fat.h 3169 echo " Generated by configure - DO NOT EDIT. */" >>fat.h 3170 3171 AC_DEFINE(WANT_FAT_BINARY, 1, [Define to 1 when building a fat binary.]) 3172 GMP_DEFINE(WANT_FAT_BINARY, yes) 3173 3174 # Don't want normal copies of fat functions 3175 for tmp_fn in $fat_functions; do 3176 GMP_REMOVE_FROM_LIST(gmp_mpn_functions, $tmp_fn) 3177 GMP_REMOVE_FROM_LIST(gmp_mpn_functions_optional, $tmp_fn) 3178 done 3179 3180 for tmp_fn in $fat_functions; do 3181 GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn) 3182 echo " 3183#ifndef OPERATION_$tmp_fn 3184#undef mpn_$tmp_fbase 3185#define mpn_$tmp_fbase (*__gmpn_cpuvec.$tmp_fbase) 3186#endif 3187DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h 3188 # encourage various macros to use fat functions 3189 AC_DEFINE_UNQUOTED(HAVE_NATIVE_mpn_$tmp_fbase) 3190 done 3191 3192 echo "" >>fat.h 3193 echo "/* variable thresholds */" >>fat.h 3194 for tmp_tn in $fat_thresholds; do 3195 echo "#undef $tmp_tn" >>fat.h 3196 echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr [A-Z] [a-z]`)" >>fat.h 3197 done 3198 3199 echo " 3200/* Copy all fields into __gmpn_cpuvec. 3201 memcpy is not used because it might operate byte-wise (depending on its 3202 implementation), and we need the function pointer writes to be atomic. 3203 "volatile" discourages the compiler from trying to optimize this. */ 3204#define CPUVEC_INSTALL(vec) \\ 3205 do { \\ 3206 volatile struct cpuvec_t *p = &__gmpn_cpuvec; \\" >>fat.h 3207 for tmp_fn in $fat_functions; do 3208 GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn) 3209 echo " p->$tmp_fbase = vec.$tmp_fbase; \\" >>fat.h 3210 done 3211 for tmp_tn in $fat_thresholds; do 3212 tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]` 3213 echo " p->$tmp_field_name = vec.$tmp_field_name; \\" >>fat.h 3214 done 3215 echo " } while (0)" >>fat.h 3216 3217 echo " 3218/* A helper to check all fields are filled. */ 3219#define ASSERT_CPUVEC(vec) \\ 3220 do { \\" >>fat.h 3221 for tmp_fn in $fat_functions; do 3222 GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn) 3223 echo " ASSERT (vec.$tmp_fbase != NULL); \\" >>fat.h 3224 done 3225 for tmp_tn in $fat_thresholds; do 3226 tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]` 3227 echo " ASSERT (vec.$tmp_field_name != 0); \\" >>fat.h 3228 done 3229 echo " } while (0)" >>fat.h 3230 3231 echo " 3232/* Call ITERATE(field) for each fat threshold field. */ 3233#define ITERATE_FAT_THRESHOLDS() \\ 3234 do { \\" >>fat.h 3235 for tmp_tn in $fat_thresholds; do 3236 tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]` 3237 echo " ITERATE ($tmp_tn, $tmp_field_name); \\" >>fat.h 3238 done 3239 echo " } while (0)" >>fat.h 3240 3241 for tmp_dir in $fat_path; do 3242 CPUVEC_SETUP= 3243 THRESH_ASM_SETUP= 3244 echo "" >>fat.h 3245 GMP_FAT_SUFFIX(tmp_suffix, $tmp_dir) 3246 3247 # In order to keep names unique on a DOS 8.3 filesystem, use a prefix 3248 # (rather than a suffix) for the generated file names, and abbreviate. 3249 case $tmp_suffix in 3250 pentium) tmp_prefix=p ;; 3251 pentium_mmx) tmp_prefix=pm ;; 3252 p6_mmx) tmp_prefix=p2 ;; 3253 p6_p3mmx) tmp_prefix=p3 ;; 3254 pentium4) tmp_prefix=p4 ;; 3255 pentium4_mmx) tmp_prefix=p4m ;; 3256 pentium4_sse2) tmp_prefix=p4s ;; 3257 k6_mmx) tmp_prefix=k6m ;; 3258 k6_k62mmx) tmp_prefix=k62 ;; 3259 k7_mmx) tmp_prefix=k7m ;; 3260 *) tmp_prefix=$tmp_suffix ;; 3261 esac 3262 3263 # Extract desired thresholds from gmp-mparam.h file in this directory, 3264 # if present. 3265 tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h 3266 if test -f $tmp_mparam; then 3267 for tmp_tn in $fat_thresholds; do 3268 tmp_thresh=`sed -n "s/^#define $tmp_tn[ ]*\\([0-9][0-9]*\\).*$/\\1/p" $tmp_mparam` 3269 if test -n "$tmp_thresh"; then 3270 THRESH_ASM_SETUP=["${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh) 3271"] 3272 CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr [[A-Z]] [[a-z]]` = $tmp_thresh; \\ 3273" 3274 eval tmp_limit=\$${tmp_tn}_LIMIT 3275 if test -z "$tmp_limit"; then 3276 tmp_limit=0 3277 fi 3278 if test $tmp_thresh -gt $tmp_limit; then 3279 eval ${tmp_tn}_LIMIT=$tmp_thresh 3280 fi 3281 fi 3282 done 3283 fi 3284 3285 for tmp_fn in $fat_functions; do 3286 GMP_MULFUNC_CHOICES 3287 3288 for tmp_base in $tmp_fn $tmp_mulfunc; do 3289 for tmp_ext in MPN_SUFFIXES; do 3290 tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext 3291 if test -f $tmp_file; then 3292 3293 # If the host uses a non-standard ABI, check if tmp_file supports it 3294 # 3295 if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then 3296 abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] 3297 if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then 3298 true 3299 else 3300 continue 3301 fi 3302 fi 3303 3304 mpn_objects="$mpn_objects ${tmp_prefix}_$tmp_fn.lo" 3305 mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_prefix}_$tmp_fn.lo" 3306 3307 GMP_FILE_TO_FUNCTION(tmp_fbase,tmp_fn) 3308 3309 # carry-in variant, eg. divrem_1c or modexact_1c_odd 3310 case $tmp_fbase in 3311 *_1*) tmp_fbasec=`echo $tmp_fbase | sed 's/_1/_1c/'` ;; 3312 *) tmp_fbasec=${tmp_fbase}c ;; 3313 esac 3314 3315 # Create a little file doing an include from srcdir. The 3316 # OPERATION and renamings aren't all needed all the time, but 3317 # they don't hurt if unused. 3318 # 3319 # FIXME: Should generate these via config.status commands. 3320 # Would need them all in one AC_CONFIG_COMMANDS though, since 3321 # that macro doesn't accept a set of separate commands generated 3322 # by shell code. 3323 # 3324 case $tmp_ext in 3325 asm) 3326 # hide the d-n-l from autoconf's error checking 3327 tmp_d_n_l=d""nl 3328 echo ["$tmp_d_n_l mpn_$tmp_fbase - from $tmp_dir directory for fat binary. 3329$tmp_d_n_l Generated by configure - DO NOT EDIT. 3330 3331define(OPERATION_$tmp_fn) 3332define(__gmpn_$tmp_fbase, __gmpn_${tmp_fbase}_$tmp_suffix) 3333define(__gmpn_$tmp_fbasec,__gmpn_${tmp_fbasec}_${tmp_suffix}) 3334define(__gmpn_preinv_${tmp_fbase},__gmpn_preinv_${tmp_fbase}_${tmp_suffix}) 3335define(__gmpn_${tmp_fbase}_cps,__gmpn_${tmp_fbase}_cps_${tmp_suffix}) 3336 3337$tmp_d_n_l For k6 and k7 gcd_1 calling their corresponding mpn_modexact_1_odd 3338ifdef(\`__gmpn_modexact_1_odd',, 3339\`define(__gmpn_modexact_1_odd,__gmpn_modexact_1_odd_${tmp_suffix})') 3340 3341$THRESH_ASM_SETUP 3342include][($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm) 3343"] >mpn/${tmp_prefix}_$tmp_fn.asm 3344 ;; 3345 c) 3346 echo ["/* mpn_$tmp_fbase - from $tmp_dir directory for fat binary. 3347 Generated by configure - DO NOT EDIT. */ 3348 3349#define OPERATION_$tmp_fn 1 3350#define __gmpn_$tmp_fbase __gmpn_${tmp_fbase}_$tmp_suffix 3351#define __gmpn_$tmp_fbasec __gmpn_${tmp_fbasec}_${tmp_suffix} 3352#define __gmpn_preinv_${tmp_fbase} __gmpn_preinv_${tmp_fbase}_${tmp_suffix} 3353#define __gmpn_${tmp_fbase}_cps __gmpn_${tmp_fbase}_cps_${tmp_suffix} 3354 3355#include \"$mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.c\" 3356"] >mpn/${tmp_prefix}_$tmp_fn.c 3357 ;; 3358 esac 3359 3360 # Prototype, and append to CPUVEC_SETUP for this directory. 3361 echo "DECL_$tmp_fbase (__gmpn_${tmp_fbase}_$tmp_suffix);" >>fat.h 3362 CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.$tmp_fbase = __gmpn_${tmp_fbase}_${tmp_suffix}; \\ 3363" 3364 # Ditto for any preinv variant (preinv_divrem_1, preinv_mod_1). 3365 if grep "^PROLOGUE(mpn_preinv_$tmp_fn)" $tmp_file >/dev/null; then 3366 echo "DECL_preinv_$tmp_fbase (__gmpn_preinv_${tmp_fbase}_$tmp_suffix);" >>fat.h 3367 CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.preinv_$tmp_fbase = __gmpn_preinv_${tmp_fbase}_${tmp_suffix}; \\ 3368" 3369 fi 3370 3371 # Ditto for any mod_1...cps variant 3372 if grep "^PROLOGUE(mpn_${tmp_fbase}_cps)" $tmp_file >/dev/null; then 3373 echo "DECL_${tmp_fbase}_cps (__gmpn_${tmp_fbase}_cps_$tmp_suffix);" >>fat.h 3374 CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.${tmp_fbase}_cps = __gmpn_${tmp_fbase}_cps_${tmp_suffix}; \\ 3375" 3376 fi 3377 fi 3378 done 3379 done 3380 done 3381 3382 # Emit CPUVEC_SETUP for this directory 3383 echo "" >>fat.h 3384 echo "#define CPUVEC_SETUP_$tmp_suffix \\" >>fat.h 3385 echo " do { \\" >>fat.h 3386 echo "$CPUVEC_SETUP } while (0)" >>fat.h 3387 done 3388 3389 # Emit threshold limits 3390 echo "" >>fat.h 3391 for tmp_tn in $fat_thresholds; do 3392 eval tmp_limit=\$${tmp_tn}_LIMIT 3393 echo "#define ${tmp_tn}_LIMIT $tmp_limit" >>fat.h 3394 done 3395fi 3396 3397 3398# Normal binary setups. 3399# 3400 3401for tmp_ext in MPN_SUFFIXES; do 3402 eval found_$tmp_ext=no 3403done 3404 3405for tmp_fn in $gmp_mpn_functions; do 3406 for tmp_ext in MPN_SUFFIXES; do 3407 test "$no_create" = yes || rm -f mpn/$tmp_fn.$tmp_ext 3408 done 3409 3410 # mpn_preinv_divrem_1 might have been provided by divrem_1.asm, likewise 3411 # mpn_preinv_mod_1 by mod_1.asm. 3412 case $tmp_fn in 3413 pre_divrem_1) 3414 if test "$HAVE_NATIVE_mpn_preinv_divrem_1" = yes; then continue; fi ;; 3415 pre_mod_1) 3416 if test "$HAVE_NATIVE_mpn_preinv_mod_1" = yes; then continue; fi ;; 3417 esac 3418 3419 GMP_MULFUNC_CHOICES 3420 3421 found=no 3422 for tmp_dir in $path; do 3423 for tmp_base in $tmp_fn $tmp_mulfunc; do 3424 for tmp_ext in MPN_SUFFIXES; do 3425 tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext 3426 if test -f $tmp_file; then 3427 3428 # For a nails build, check if the file supports our nail bits. 3429 # Generic code always supports all nails. 3430 # 3431 # FIXME: When a multi-function file is selected to provide one of 3432 # the nails-neutral routines, like logops_n for and_n, the 3433 # PROLOGUE grepping will create HAVE_NATIVE_mpn_<foo> defines for 3434 # all functions in that file, even if they haven't all been 3435 # nailified. Not sure what to do about this, it's only really a 3436 # problem for logops_n, and it's not too terrible to insist those 3437 # get nailified always. 3438 # 3439 if test $GMP_NAIL_BITS != 0 && test $tmp_dir != generic; then 3440 case $tmp_fn in 3441 and_n | ior_n | xor_n | andn_n | \ 3442 copyi | copyd | \ 3443 popcount | hamdist | \ 3444 udiv | udiv_w_sdiv | umul | \ 3445 cntlz | invert_limb) 3446 # these operations are either unaffected by nails or defined 3447 # to operate on full limbs 3448 ;; 3449 *) 3450 nails=[`sed -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file `] 3451 for n in $nails; do 3452 case $n in 3453 *-*) 3454 n_start=`echo "$n" | sed -n 's/\(.*\)-.*/\1/p'` 3455 n_end=`echo "$n" | sed -n 's/.*-\(.*\)/\1/p'` 3456 ;; 3457 *) 3458 n_start=$n 3459 n_end=$n 3460 ;; 3461 esac 3462 if test $GMP_NAIL_BITS -ge $n_start && test $GMP_NAIL_BITS -le $n_end; then 3463 found=yes 3464 break 3465 fi 3466 done 3467 if test $found != yes; then 3468 continue 3469 fi 3470 ;; 3471 esac 3472 fi 3473 3474 # If the host uses a non-standard ABI, check if tmp_file supports it 3475 # 3476 if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then 3477 abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] 3478 if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then 3479 true 3480 else 3481 continue 3482 fi 3483 fi 3484 3485 found=yes 3486 eval found_$tmp_ext=yes 3487 3488 if test $tmp_ext = c; then 3489 tmp_u='$U' 3490 else 3491 tmp_u= 3492 fi 3493 3494 mpn_objects="$mpn_objects $tmp_fn$tmp_u.lo" 3495 mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/$tmp_fn$tmp_u.lo" 3496 AC_CONFIG_LINKS(mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext) 3497 gmp_srclinks="$gmp_srclinks mpn/$tmp_fn.$tmp_ext" 3498 3499 # Duplicate AC_DEFINEs are harmless, so it doesn't matter 3500 # that multi-function files get grepped here repeatedly. 3501 # The PROLOGUE pattern excludes the optional second parameter. 3502 gmp_ep=[` 3503 sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ; 3504 sed -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file 3505 `] 3506 for gmp_tmp in $gmp_ep; do 3507 AC_DEFINE_UNQUOTED(HAVE_NATIVE_$gmp_tmp) 3508 eval HAVE_NATIVE_$gmp_tmp=yes 3509 done 3510 3511 case $tmp_fn in 3512 sqr_basecase) sqr_basecase_source=$tmp_file ;; 3513 esac 3514 3515 break 3516 fi 3517 done 3518 if test $found = yes; then break ; fi 3519 done 3520 if test $found = yes; then break ; fi 3521 done 3522 3523 if test $found = no; then 3524 for tmp_optional in $gmp_mpn_functions_optional; do 3525 if test $tmp_optional = $tmp_fn; then 3526 found=yes 3527 fi 3528 done 3529 if test $found = no; then 3530 AC_MSG_ERROR([no version of $tmp_fn found in path: $path]) 3531 fi 3532 fi 3533done 3534 3535# All cycle counters are .asm files currently 3536if test -n "$SPEED_CYCLECOUNTER_OBJ"; then 3537 found_asm=yes 3538fi 3539 3540dnl The following list only needs to have templates for those defines which 3541dnl are going to be tested by the code, there's no need to have every 3542dnl possible mpn routine. 3543 3544AH_VERBATIM([HAVE_NATIVE], 3545[/* Define to 1 each of the following for which a native (ie. CPU specific) 3546 implementation of the corresponding routine exists. */ 3547#undef HAVE_NATIVE_mpn_add_n 3548#undef HAVE_NATIVE_mpn_add_n_sub_n 3549#undef HAVE_NATIVE_mpn_add_nc 3550#undef HAVE_NATIVE_mpn_addaddmul_1msb0 3551#undef HAVE_NATIVE_mpn_addlsh1_n 3552#undef HAVE_NATIVE_mpn_addlsh2_n 3553#undef HAVE_NATIVE_mpn_addlsh_n 3554#undef HAVE_NATIVE_mpn_addlsh1_nc 3555#undef HAVE_NATIVE_mpn_addlsh2_nc 3556#undef HAVE_NATIVE_mpn_addlsh_nc 3557#undef HAVE_NATIVE_mpn_addlsh1_n_ip1 3558#undef HAVE_NATIVE_mpn_addlsh2_n_ip1 3559#undef HAVE_NATIVE_mpn_addlsh_n_ip1 3560#undef HAVE_NATIVE_mpn_addlsh1_nc_ip1 3561#undef HAVE_NATIVE_mpn_addlsh2_nc_ip1 3562#undef HAVE_NATIVE_mpn_addlsh_nc_ip1 3563#undef HAVE_NATIVE_mpn_addlsh1_n_ip2 3564#undef HAVE_NATIVE_mpn_addlsh2_n_ip2 3565#undef HAVE_NATIVE_mpn_addlsh_n_ip2 3566#undef HAVE_NATIVE_mpn_addlsh1_nc_ip2 3567#undef HAVE_NATIVE_mpn_addlsh2_nc_ip2 3568#undef HAVE_NATIVE_mpn_addlsh_nc_ip2 3569#undef HAVE_NATIVE_mpn_addmul_1c 3570#undef HAVE_NATIVE_mpn_addmul_2 3571#undef HAVE_NATIVE_mpn_addmul_3 3572#undef HAVE_NATIVE_mpn_addmul_4 3573#undef HAVE_NATIVE_mpn_addmul_5 3574#undef HAVE_NATIVE_mpn_addmul_6 3575#undef HAVE_NATIVE_mpn_addmul_7 3576#undef HAVE_NATIVE_mpn_addmul_8 3577#undef HAVE_NATIVE_mpn_addmul_2s 3578#undef HAVE_NATIVE_mpn_and_n 3579#undef HAVE_NATIVE_mpn_andn_n 3580#undef HAVE_NATIVE_mpn_bdiv_dbm1c 3581#undef HAVE_NATIVE_mpn_bdiv_q_1 3582#undef HAVE_NATIVE_mpn_pi1_bdiv_q_1 3583#undef HAVE_NATIVE_mpn_cnd_add_n 3584#undef HAVE_NATIVE_mpn_cnd_sub_n 3585#undef HAVE_NATIVE_mpn_com 3586#undef HAVE_NATIVE_mpn_copyd 3587#undef HAVE_NATIVE_mpn_copyi 3588#undef HAVE_NATIVE_mpn_div_qr_1n_pi1 3589#undef HAVE_NATIVE_mpn_div_qr_2 3590#undef HAVE_NATIVE_mpn_divexact_1 3591#undef HAVE_NATIVE_mpn_divexact_by3c 3592#undef HAVE_NATIVE_mpn_divrem_1 3593#undef HAVE_NATIVE_mpn_divrem_1c 3594#undef HAVE_NATIVE_mpn_divrem_2 3595#undef HAVE_NATIVE_mpn_gcd_1 3596#undef HAVE_NATIVE_mpn_gcd_11 3597#undef HAVE_NATIVE_mpn_gcd_22 3598#undef HAVE_NATIVE_mpn_hamdist 3599#undef HAVE_NATIVE_mpn_invert_limb 3600#undef HAVE_NATIVE_mpn_ior_n 3601#undef HAVE_NATIVE_mpn_iorn_n 3602#undef HAVE_NATIVE_mpn_lshift 3603#undef HAVE_NATIVE_mpn_lshiftc 3604#undef HAVE_NATIVE_mpn_lshsub_n 3605#undef HAVE_NATIVE_mpn_mod_1 3606#undef HAVE_NATIVE_mpn_mod_1_1p 3607#undef HAVE_NATIVE_mpn_mod_1c 3608#undef HAVE_NATIVE_mpn_mod_1s_2p 3609#undef HAVE_NATIVE_mpn_mod_1s_4p 3610#undef HAVE_NATIVE_mpn_mod_34lsub1 3611#undef HAVE_NATIVE_mpn_modexact_1_odd 3612#undef HAVE_NATIVE_mpn_modexact_1c_odd 3613#undef HAVE_NATIVE_mpn_mul_1 3614#undef HAVE_NATIVE_mpn_mul_1c 3615#undef HAVE_NATIVE_mpn_mul_2 3616#undef HAVE_NATIVE_mpn_mul_3 3617#undef HAVE_NATIVE_mpn_mul_4 3618#undef HAVE_NATIVE_mpn_mul_5 3619#undef HAVE_NATIVE_mpn_mul_6 3620#undef HAVE_NATIVE_mpn_mul_basecase 3621#undef HAVE_NATIVE_mpn_mullo_basecase 3622#undef HAVE_NATIVE_mpn_nand_n 3623#undef HAVE_NATIVE_mpn_nior_n 3624#undef HAVE_NATIVE_mpn_popcount 3625#undef HAVE_NATIVE_mpn_preinv_divrem_1 3626#undef HAVE_NATIVE_mpn_preinv_mod_1 3627#undef HAVE_NATIVE_mpn_redc_1 3628#undef HAVE_NATIVE_mpn_redc_2 3629#undef HAVE_NATIVE_mpn_rsblsh1_n 3630#undef HAVE_NATIVE_mpn_rsblsh2_n 3631#undef HAVE_NATIVE_mpn_rsblsh_n 3632#undef HAVE_NATIVE_mpn_rsblsh1_nc 3633#undef HAVE_NATIVE_mpn_rsblsh2_nc 3634#undef HAVE_NATIVE_mpn_rsblsh_nc 3635#undef HAVE_NATIVE_mpn_rsh1add_n 3636#undef HAVE_NATIVE_mpn_rsh1add_nc 3637#undef HAVE_NATIVE_mpn_rsh1sub_n 3638#undef HAVE_NATIVE_mpn_rsh1sub_nc 3639#undef HAVE_NATIVE_mpn_rshift 3640#undef HAVE_NATIVE_mpn_sbpi1_bdiv_r 3641#undef HAVE_NATIVE_mpn_sqr_basecase 3642#undef HAVE_NATIVE_mpn_sqr_diagonal 3643#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1 3644#undef HAVE_NATIVE_mpn_sub_n 3645#undef HAVE_NATIVE_mpn_sub_nc 3646#undef HAVE_NATIVE_mpn_sublsh1_n 3647#undef HAVE_NATIVE_mpn_sublsh2_n 3648#undef HAVE_NATIVE_mpn_sublsh_n 3649#undef HAVE_NATIVE_mpn_sublsh1_nc 3650#undef HAVE_NATIVE_mpn_sublsh2_nc 3651#undef HAVE_NATIVE_mpn_sublsh_nc 3652#undef HAVE_NATIVE_mpn_sublsh1_n_ip1 3653#undef HAVE_NATIVE_mpn_sublsh2_n_ip1 3654#undef HAVE_NATIVE_mpn_sublsh_n_ip1 3655#undef HAVE_NATIVE_mpn_sublsh1_nc_ip1 3656#undef HAVE_NATIVE_mpn_sublsh2_nc_ip1 3657#undef HAVE_NATIVE_mpn_sublsh_nc_ip1 3658#undef HAVE_NATIVE_mpn_submul_1c 3659#undef HAVE_NATIVE_mpn_tabselect 3660#undef HAVE_NATIVE_mpn_udiv_qrnnd 3661#undef HAVE_NATIVE_mpn_udiv_qrnnd_r 3662#undef HAVE_NATIVE_mpn_umul_ppmm 3663#undef HAVE_NATIVE_mpn_umul_ppmm_r 3664#undef HAVE_NATIVE_mpn_xor_n 3665#undef HAVE_NATIVE_mpn_xnor_n]) 3666 3667 3668# Don't demand an m4 unless it's actually needed. 3669if test $found_asm = yes; then 3670 GMP_PROG_M4 3671 GMP_M4_M4WRAP_SPURIOUS 3672# else 3673# It's unclear why this m4-not-needed stuff was ever done. 3674# if test -z "$M4" ; then 3675# M4=m4-not-needed 3676# fi 3677fi 3678 3679# Only do the GMP_ASM checks if there's a .S or .asm wanting them. 3680if test $found_asm = no && test $found_S = no; then 3681 gmp_asm_syntax_testing=no 3682fi 3683 3684if test "$gmp_asm_syntax_testing" != no; then 3685 GMP_ASM_TEXT 3686 GMP_ASM_DATA 3687 GMP_ASM_LABEL_SUFFIX 3688 GMP_ASM_GLOBL 3689 GMP_ASM_GLOBL_ATTR 3690 GMP_ASM_UNDERSCORE 3691 GMP_ASM_RODATA 3692 GMP_ASM_TYPE 3693 GMP_ASM_SIZE 3694 GMP_ASM_LSYM_PREFIX 3695 GMP_ASM_W32 3696 GMP_ASM_ALIGN_LOG 3697 3698 case $host in 3699 arm*-*-* | aarch64*-*-*) 3700 case $ABI in 3701 32) 3702 GMP_INCLUDE_MPN(arm/arm-defs.m4) ;; 3703 64) 3704 case $host in 3705 *-*-darwin*) 3706 GMP_INCLUDE_MPN(arm64/darwin.m4) ;; 3707 *) 3708 GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;; 3709 esac 3710 ;; 3711 esac 3712 ;; 3713 hppa*-*-*) 3714 # for both pa32 and pa64 3715 GMP_INCLUDE_MPN(pa32/pa-defs.m4) 3716 ;; 3717 IA64_PATTERN) 3718 GMP_ASM_IA64_ALIGN_OK 3719 ;; 3720 M68K_PATTERN) 3721 GMP_ASM_M68K_INSTRUCTION 3722 GMP_ASM_M68K_ADDRESSING 3723 GMP_ASM_M68K_BRANCHES 3724 ;; 3725 [powerpc*-*-* | power[3-9]-*-*]) 3726 GMP_ASM_POWERPC_PIC_ALWAYS 3727 GMP_ASM_POWERPC_R_REGISTERS 3728 GMP_INCLUDE_MPN(powerpc32/powerpc-defs.m4) 3729 3730 # Check for Linux ELFv1 ABI 3731 AC_EGREP_CPP(yes, 3732[#if _CALL_ELF == 1 3733yes 3734#endif], 3735 [GMP_DEFINE_RAW(["define(<ELFv1_ABI>)"])]) 3736 3737 # Check for Linux ELFv2 ABI 3738 AC_EGREP_CPP(yes, 3739[#if _CALL_ELF == 2 3740yes 3741#endif], 3742 [GMP_DEFINE_RAW(["define(<ELFv2_ABI>)"])]) 3743 3744 case $host in 3745 *-*-aix*) 3746 case $ABI in 3747 mode64) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;; 3748 *) GMP_INCLUDE_MPN(powerpc32/aix.m4) ;; 3749 esac 3750 ;; 3751 *-*-linux* | *-*-*bsd*) 3752 case $ABI in 3753 mode64) GMP_INCLUDE_MPN(powerpc64/elf.m4) ;; 3754 mode32 | 32) GMP_INCLUDE_MPN(powerpc32/elf.m4) ;; 3755 esac 3756 ;; 3757 *-*-darwin*) 3758 case $ABI in 3759 mode64) GMP_INCLUDE_MPN(powerpc64/darwin.m4) ;; 3760 mode32 | 32) GMP_INCLUDE_MPN(powerpc32/darwin.m4) ;; 3761 esac 3762 ;; 3763 *) 3764 # Assume unrecognized operating system is the powerpc eABI 3765 GMP_INCLUDE_MPN(powerpc32/eabi.m4) 3766 ;; 3767 esac 3768 ;; 3769 power*-*-aix*) 3770 GMP_INCLUDE_MPN(powerpc32/aix.m4) 3771 ;; 3772 *sparc*-*-*) 3773 case $ABI in 3774 64) 3775 GMP_ASM_SPARC_REGISTER 3776 ;; 3777 esac 3778 GMP_ASM_SPARC_GOTDATA 3779 GMP_ASM_SPARC_SHARED_THUNKS 3780 ;; 3781 X86_PATTERN | X86_64_PATTERN) 3782 GMP_ASM_ALIGN_FILL_0x90 3783 if test "$x86_have_mulx" = yes; then 3784 GMP_ASM_X86_MULX 3785 fi 3786 GMP_ASM_COFF_TYPE 3787 case $ABI in 3788 32) 3789 GMP_INCLUDE_MPN(x86/x86-defs.m4) 3790 AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86) 3791 GMP_ASM_X86_GOT_UNDERSCORE 3792 GMP_ASM_X86_SHLDL_CL 3793 case $enable_profiling in 3794 prof | gprof) GMP_ASM_X86_MCOUNT ;; 3795 esac 3796 case $host in 3797 *-*-darwin*) 3798 GMP_INCLUDE_MPN(x86/darwin.m4) ;; 3799 esac 3800 ;; 3801 64|x32) 3802 GMP_INCLUDE_MPN(x86_64/x86_64-defs.m4) 3803 AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86_64) 3804 case $host in 3805 *-*-darwin*) 3806 GMP_INCLUDE_MPN(x86_64/darwin.m4) ;; 3807 *-*-mingw* | *-*-msys | *-*-cygwin) 3808 GMP_INCLUDE_MPN(x86_64/dos64.m4) ;; 3809 *-openbsd*) 3810 GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;; 3811 *-linux*) 3812 GMP_DEFINE_RAW(["define(<LINUX>,1)"]) ;; 3813 esac 3814 ;; 3815 esac 3816 ;; 3817 esac 3818fi 3819 3820# For --enable-minithres, prepend "minithres" to path so that its special 3821# gmp-mparam.h will be used. 3822if test $enable_minithres = yes; then 3823 path="minithres $path" 3824fi 3825 3826# Create link for gmp-mparam.h. 3827gmp_mparam_source= 3828for gmp_mparam_dir in $path; do 3829 test "$no_create" = yes || rm -f gmp-mparam.h 3830 tmp_file=$srcdir/mpn/$gmp_mparam_dir/gmp-mparam.h 3831 if test -f $tmp_file; then 3832 AC_CONFIG_LINKS(gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h) 3833 gmp_srclinks="$gmp_srclinks gmp-mparam.h" 3834 gmp_mparam_source=$tmp_file 3835 break 3836 fi 3837done 3838if test -z "$gmp_mparam_source"; then 3839 AC_MSG_ERROR([no version of gmp-mparam.h found in path: $path]) 3840fi 3841 3842# For a helpful message from tune/tuneup.c 3843gmp_mparam_suggest=$gmp_mparam_source 3844if test "$gmp_mparam_dir" = generic; then 3845 for i in $path; do break; done 3846 if test "$i" != generic; then 3847 gmp_mparam_suggest="new file $srcdir/mpn/$i/gmp-mparam.h" 3848 fi 3849fi 3850AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source", 3851[The gmp-mparam.h file (a string) the tune program should suggest updating.]) 3852 3853 3854# Copy relevant parameters from gmp-mparam.h to config.m4. 3855# We only do this for parameters that are used by some assembly files. 3856# Fat binaries do this on a per-file basis, so skip in that case. 3857# 3858if test -z "$fat_path"; then 3859 for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do 3860 value=`sed -n 's/^#define '$i'[ ]*\([0-9A-Z][0-9A-Z_]*\).*$/\1/p' $gmp_mparam_source` 3861 if test -n "$value"; then 3862 GMP_DEFINE_RAW(["define(<$i>,<$value>)"]) 3863 fi 3864 done 3865fi 3866 3867 3868# Sizes of some types, needed at preprocessing time. 3869# 3870# FIXME: The assumption that GMP_LIMB_BITS is 8*sizeof(mp_limb_t) might 3871# be slightly rash, but it's true everywhere we know of and ought to be true 3872# of any sensible system. In a generic C build, grepping LONG_BIT out of 3873# <limits.h> might be an alternative, for maximum portability. 3874# 3875AC_CHECK_SIZEOF(void *) 3876AC_CHECK_SIZEOF(unsigned short) 3877AC_CHECK_SIZEOF(unsigned) 3878AC_CHECK_SIZEOF(unsigned long) 3879AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H) 3880if test "$ac_cv_sizeof_mp_limb_t" = 0; then 3881 AC_MSG_ERROR([Oops, mp_limb_t doesn't seem to work]) 3882fi 3883AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`) 3884GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"]) 3885 3886# Check compiler limb size matches gmp-mparam.h 3887# 3888# FIXME: Some of the cycle counter objects in the tune directory depend on 3889# the size of ulong, it'd be possible to check that here, though a mismatch 3890# probably wouldn't want to be fatal, none of the libgmp assembler code 3891# depends on ulong. 3892# 3893mparam_bits=[`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`] 3894if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then 3895 if test "$test_CFLAGS" = set; then 3896 AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code 3897in this configuration expects $mparam_bits bits. 3898You appear to have set \$CFLAGS, perhaps you also need to tell GMP the 3899intended ABI, see "ABI and ISA" in the manual.]) 3900 else 3901 AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code 3902in this configuration expects $mparam_bits bits.]) 3903 fi 3904fi 3905 3906GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$GMP_LIMB_BITS)"]) 3907GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"]) 3908GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"]) 3909 3910 3911AC_SUBST(mpn_objects) 3912AC_SUBST(mpn_objs_in_libgmp) 3913AC_SUBST(gmp_srclinks) 3914 3915 3916# A recompiled sqr_basecase for use in the tune program, if necessary. 3917TUNE_SQR_OBJ= 3918test -d tune || mkdir tune 3919case $sqr_basecase_source in 3920 *.asm) 3921 sqr_max=[`sed -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`] 3922 if test -n "$sqr_max"; then 3923 TUNE_SQR_OBJ=sqr_asm.o 3924 AC_DEFINE_UNQUOTED(TUNE_SQR_TOOM2_MAX,$sqr_max, 3925 [Maximum size the tune program can test for SQR_TOOM2_THRESHOLD]) 3926 fi 3927 cat >tune/sqr_basecase.c <<EOF 3928/* not sure that an empty file can compile, so put in a dummy */ 3929int sqr_basecase_dummy; 3930EOF 3931 ;; 3932 *.c) 3933 TUNE_SQR_OBJ= 3934 AC_DEFINE(TUNE_SQR_TOOM2_MAX,SQR_TOOM2_MAX_GENERIC) 3935 cat >tune/sqr_basecase.c <<EOF 3936#define TUNE_PROGRAM_BUILD 1 3937#define TUNE_PROGRAM_BUILD_SQR 1 3938#include "mpn/sqr_basecase.c" 3939EOF 3940 ;; 3941esac 3942AC_SUBST(TUNE_SQR_OBJ) 3943 3944 3945# Configs for demos/pexpr.c. 3946# 3947AC_CONFIG_FILES(demos/pexpr-config.h:demos/pexpr-config-h.in) 3948GMP_SUBST_CHECK_FUNCS(clock, cputime, getrusage, gettimeofday, sigaction, sigaltstack, sigstack) 3949GMP_SUBST_CHECK_HEADERS(sys/resource.h) 3950AC_CHECK_TYPES([stack_t], HAVE_STACK_T_01=1, HAVE_STACK_T_01=0, 3951 [#include <signal.h>]) 3952AC_SUBST(HAVE_STACK_T_01) 3953 3954# Configs for demos/calc directory 3955# 3956# AC_SUBST+AC_CONFIG_FILES is used for calc-config.h, rather than AC_DEFINE+ 3957# AC_CONFIG_HEADERS, since with the latter automake (1.8) will then put the 3958# directory (ie. demos/calc) into $(DEFAULT_INCLUDES) for every Makefile.in, 3959# which would look very strange. 3960# 3961# -lcurses is required by libreadline. On a typical SVR4 style system this 3962# normally doesn't have to be given explicitly, since libreadline.so will 3963# have a NEEDED record for it. But if someone for some reason is using only 3964# a static libreadline.a then we must give -lcurses. Readline (as of 3965# version 4.3) doesn't use libtool, so we can't rely on a .la to cover 3966# necessary dependencies. 3967# 3968# On a couple of systems we've seen libreadline available, but the headers 3969# not in the default include path, so check for readline/readline.h. We've 3970# also seen readline/history.h missing, not sure if that's just a broken 3971# install or a very old version, but check that too. 3972# 3973AC_CONFIG_FILES(demos/calc/calc-config.h:demos/calc/calc-config-h.in) 3974LIBCURSES= 3975if test $with_readline != no; then 3976 AC_CHECK_LIB(ncurses, tputs, [LIBCURSES=-lncurses], 3977 [AC_CHECK_LIB(curses, tputs, [LIBCURSES=-lcurses])]) 3978fi 3979AC_SUBST(LIBCURSES) 3980use_readline=$with_readline 3981if test $with_readline = detect; then 3982 use_readline=no 3983 AC_CHECK_LIB(readline, readline, 3984 [AC_CHECK_HEADER(readline/readline.h, 3985 [AC_CHECK_HEADER(readline/history.h, use_readline=yes)])], 3986 , $LIBCURSES) 3987 AC_MSG_CHECKING(readline detected) 3988 AC_MSG_RESULT($use_readline) 3989fi 3990if test $use_readline = yes; then 3991 AC_SUBST(WITH_READLINE_01, 1) 3992 AC_SUBST(LIBREADLINE, -lreadline) 3993else 3994 WITH_READLINE_01=0 3995fi 3996AC_PROG_YACC 3997AM_PROG_LEX 3998 3999LT_INIT 4000 4001# Create config.m4. 4002GMP_FINISH 4003 4004# Create Makefiles 4005# FIXME: Upcoming version of autoconf/automake may not like broken lines. 4006# Right now automake isn't accepting the new AC_CONFIG_FILES scheme. 4007 4008AC_OUTPUT(Makefile \ 4009 mpf/Makefile mpn/Makefile mpq/Makefile \ 4010 mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile \ 4011 tests/Makefile tests/devel/Makefile \ 4012 tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \ 4013 tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \ 4014 tests/cxx/Makefile \ 4015 doc/Makefile tune/Makefile \ 4016 demos/Makefile demos/calc/Makefile demos/expr/Makefile \ 4017 gmp.h:gmp-h.in gmp.pc:gmp.pc.in gmpxx.pc:gmpxx.pc.in) 4018 4019AC_MSG_NOTICE([summary of build options: 4020 4021 Version: ${PACKAGE_STRING} 4022 Host type: ${host} 4023 ABI: ${ABI} 4024 Install prefix: ${prefix} 4025 Compiler: ${CC} 4026 Static libraries: ${enable_static} 4027 Shared libraries: ${enable_shared} 4028]) 4029