configure
上传用户:qaz666999
上传日期:2022-08-06
资源大小:2570k
文件大小:938k
- case $enable_nails in
- yes) GMP_NAIL_BITS=2 ;;
- no) GMP_NAIL_BITS=0 ;;
- *) GMP_NAIL_BITS=$enable_nails ;;
- esac
- # Check whether --enable-profiling was given.
- if test "${enable_profiling+set}" = set; then :
- enableval=$enable_profiling; case $enableval in
- no|prof|gprof|instrument) ;;
- *) as_fn_error "bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" "$LINENO" 5 ;;
- esac
- else
- enable_profiling=no
- fi
- case $enable_profiling in
- prof)
- $as_echo "#define WANT_PROFILING_PROF 1" >>confdefs.h
- ;;
- gprof)
- $as_echo "#define WANT_PROFILING_GPROF 1" >>confdefs.h
- ;;
- instrument)
- $as_echo "#define WANT_PROFILING_INSTRUMENT 1" >>confdefs.h
- ;;
- esac
- echo "define(<WANT_PROFILING>,<`$enable_profiling'>)" >> $gmp_tmpconfigm4
- # -fomit-frame-pointer is incompatible with -pg on some chips
- if test "$enable_profiling" = gprof; then
- fomit_frame_pointer=
- else
- fomit_frame_pointer="-fomit-frame-pointer"
- fi
- # Check whether --with-readline was given.
- if test "${with_readline+set}" = set; then :
- withval=$with_readline; case $withval in
- yes|no|detect) ;;
- *) as_fn_error "bad value $withval for --with-readline, need yes/no/detect" "$LINENO" 5 ;;
- esac
- else
- with_readline=detect
- fi
- # Check whether --enable-fat was given.
- if test "${enable_fat+set}" = set; then :
- enableval=$enable_fat; case $enableval in
- yes|no) ;;
- *) as_fn_error "bad value $enableval for --enable-fat, need yes or no" "$LINENO" 5 ;;
- esac
- else
- enable_fat=no
- fi
- # Check whether --enable-minithres was given.
- if test "${enable_minithres+set}" = set; then :
- enableval=$enable_minithres; case $enableval in
- yes|no) ;;
- *) as_fn_error "bad value $enableval for --enable-minithres, need yes or no" "$LINENO" 5 ;;
- esac
- else
- enable_minithres=no
- fi
- tmp_host=`echo $host_cpu | sed 's/./_/'`
- cat >>confdefs.h <<_ACEOF
- #define HAVE_HOST_CPU_$tmp_host 1
- _ACEOF
- echo "define_not_for_expansion(`HAVE_HOST_CPU_$tmp_host')" >> $gmp_tmpconfigm4p
- # Table of compilers, options, and mpn paths. This code has various related
- # purposes
- #
- # - better default CC/CFLAGS selections than autoconf otherwise gives
- # - default CC/CFLAGS selections for extra CPU types specific to GMP
- # - a few tests for known bad compilers
- # - choice of ABIs on suitable systems
- # - selection of corresponding mpn search path
- #
- # After GMP specific searches and tests, the standard autoconf AC_PROG_CC is
- # called. User selections of CC etc are respected.
- #
- # Care is taken not to use macros like AC_TRY_COMPILE during the GMP
- # pre-testing, since they of course depend on AC_PROG_CC, and also some of
- # them cache their results, which is not wanted.
- #
- # The ABI selection mechanism is unique to GMP. All that reaches autoconf
- # is a different selection of CC/CFLAGS according to the best ABI the system
- # supports, and/or what the user selects. Naturally the mpn assembler code
- # selected is very dependent on the ABI.
- #
- # The closest the standard tools come to a notion of ABI is something like
- # "sparc64" which encodes a CPU and an ABI together. This doesn't seem to
- # scale well for GMP, where exact CPU types like "ultrasparc2" are wanted,
- # separate from the ABI used on them.
- #
- #
- # The variables set here are
- #
- # cclist the compiler choices
- # xx_cflags flags for compiler xx
- # xx_cflags_maybe flags for compiler xx, if they work
- # xx_cppflags cpp flags for compiler xx
- # xx_cflags_optlist list of sets of optional flags
- # xx_cflags_yyy set yyy of optional flags for compiler xx
- # xx_ldflags -Wc,-foo flags for libtool linking with compiler xx
- # ar_flags extra flags for $AR
- # nm_flags extra flags for $NM
- # limb limb size, can be "longlong"
- # path mpn search path
- # extra_functions extra mpn functions
- # fat_path fat binary mpn search path [if fat binary desired]
- # fat_functions fat functions
- # fat_thresholds fat thresholds
- #
- # Suppose xx_cflags_optlist="arch", then flags from $xx_cflags_arch are
- # tried, and the first flag that works will be used. An optlist like "arch
- # cpu optimize" can be used to get multiple independent sets of flags tried.
- # The first that works from each will be used. If no flag in a set works
- # then nothing from that set is added.
- #
- # For multiple ABIs, the scheme extends as follows.
- #
- # abilist set of ABI choices
- # cclist_aa compiler choices in ABI aa
- # xx_aa_cflags flags for xx in ABI aa
- # xx_aa_cflags_maybe flags for xx in ABI aa, if they work
- # xx_aa_cppflags cpp flags for xx in ABI aa
- # xx_aa_cflags_optlist list of sets of optional flags in ABI aa
- # xx_aa_cflags_yyy set yyy of optional flags for compiler xx in ABI aa
- # xx_aa_ldflags -Wc,-foo flags for libtool linking
- # ar_aa_flags extra flags for $AR in ABI aa
- # nm_aa_flags extra flags for $NM in ABI aa
- # limb_aa limb size in ABI aa, can be "longlong"
- # path_aa mpn search path in ABI aa
- # extra_functions_aa extra mpn functions in ABI aa
- #
- # As a convenience, the unadorned xx_cflags (etc) are used for the last ABI
- # in ablist, if an xx_aa_cflags for that ABI isn't given. For example if
- # abilist="64 32" then $cc_64_cflags will be used for the 64-bit ABI, but
- # for the 32-bit either $cc_32_cflags or $cc_cflags is used, whichever is
- # defined. This makes it easy to add some 64-bit compilers and flags to an
- # unadorned 32-bit set.
- #
- # limb=longlong (or limb_aa=longlong) applies to all compilers within that
- # ABI. It won't work to have some needing long long and some not, since a
- # single instantiated gmp.h will be used by both.
- #
- # SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are
- # also set here, with an ABI suffix.
- #
- #
- #
- # A table-driven approach like this to mapping cpu type to good compiler
- # options is a bit of a maintenance burden, but there's not much uniformity
- # between options specifications on different compilers. Some sort of
- # separately updatable tool might be cute.
- #
- # The use of lots of variables like this, direct and indirect, tends to
- # obscure when and how various things are done, but unfortunately it's
- # pretty much the only way. If shell subroutines were portable then actual
- # code like "if this .. do that" could be written, but attempting the same
- # with full copies of GMP_PROG_CC_WORKS etc expanded at every point would
- # hugely bloat the output.
- # abilist needs to be non-empty, "standard" is just a generic name here
- abilist="standard"
- # FIXME: We'd like to prefer an ANSI compiler, perhaps by preferring
- # c89 over cc here. But note that on HP-UX c89 provides a castrated
- # environment, and would want to be excluded somehow. Maybe
- # AC_PROG_CC_STDC already does enough to stick cc into ANSI mode and
- # we don't need to worry.
- #
- cclist="gcc cc"
- gcc_cflags="-O2 -pedantic"
- gcc_64_cflags="-O2 -pedantic"
- cc_cflags="-O"
- cc_64_cflags="-O"
- SPEED_CYCLECOUNTER_OBJ=
- cyclecounter_size=2
- HAVE_HOST_CPU_FAMILY_power=0
- HAVE_HOST_CPU_FAMILY_powerpc=0
- case $host in
- a29k*-*-*)
- path="a29k"
- ;;
- alpha*-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_alpha 1" >>confdefs.h
- case $host_cpu in
- alphaev5* | alphapca5*)
- path="alpha/ev5 alpha" ;;
- alphaev67 | alphaev68 | alphaev7*)
- path="alpha/ev67 alpha/ev6 alpha" ;;
- alphaev6)
- path="alpha/ev6 alpha" ;;
- *)
- path="alpha" ;;
- esac
- extra_functions="cntlz"
- gcc_cflags_optlist="asm cpu oldas" # need asm ahead of cpu, see below
- gcc_cflags_oldas="-Wa,-oldas" # see GMP_GCC_WA_OLDAS.
- # gcc 2.7.2.3 doesn't know any -mcpu= for alpha, apparently.
- # gcc 2.95 knows -mcpu= ev4, ev5, ev56, pca56, ev6.
- # gcc 3.0 adds nothing.
- # gcc 3.1 adds ev45, ev67 (but ev45 is the same as ev4).
- # gcc 3.2 adds nothing.
- #
- # gcc version "2.9-gnupro-99r1" under "-O2 -mcpu=ev6" strikes internal
- # compiler errors too easily and is rejected by GMP_PROG_CC_WORKS. Each
- # -mcpu=ev6 below has a fallback to -mcpu=ev56 for this reason.
- #
- case $host_cpu in
- alpha) gcc_cflags_cpu="-mcpu=ev4" ;;
- alphaev5) gcc_cflags_cpu="-mcpu=ev5" ;;
- alphaev56) gcc_cflags_cpu="-mcpu=ev56" ;;
- alphapca56 | alphapca57)
- gcc_cflags_cpu="-mcpu=pca56" ;;
- alphaev6) gcc_cflags_cpu="-mcpu=ev6 -mcpu=ev56" ;;
- alphaev67 | alphaev68 | alphaev7*)
- gcc_cflags_cpu="-mcpu=ev67 -mcpu=ev6 -mcpu=ev56" ;;
- esac
- # gcc version "2.9-gnupro-99r1" on alphaev68-dec-osf5.1 has been seen
- # accepting -mcpu=ev6, but not putting the assembler in the right mode
- # for what it produces. We need to do this for it, and need to do it
- # before testing the -mcpu options.
- #
- # On old versions of gcc, which don't know -mcpu=, we believe an
- # explicit -Wa,-mev5 etc will be necessary to put the assembler in
- # the right mode for our .asm files and longlong.h asm blocks.
- #
- # On newer versions of gcc, when -mcpu= is known, we must give a -Wa
- # which is at least as high as the code gcc will generate. gcc
- # establishes what it needs with a ".arch" directive, our command line
- # option seems to override that.
- #
- # gas prior to 2.14 doesn't accept -mev67, but -mev6 seems enough for
- # ctlz and cttz (in 2.10.0 at least).
- #
- # OSF `as' accepts ev68 but stupidly treats it as ev4. -arch only seems
- # to affect insns like ldbu which are expanded as macros when necessary.
- # Insns like ctlz which were never available as macros are always
- # accepted and always generate their plain code.
- #
- case $host_cpu in
- alpha) gcc_cflags_asm="-Wa,-arch,ev4 -Wa,-mev4" ;;
- alphaev5) gcc_cflags_asm="-Wa,-arch,ev5 -Wa,-mev5" ;;
- alphaev56) gcc_cflags_asm="-Wa,-arch,ev56 -Wa,-mev56" ;;
- alphapca56 | alphapca57)
- gcc_cflags_asm="-Wa,-arch,pca56 -Wa,-mpca56" ;;
- alphaev6) gcc_cflags_asm="-Wa,-arch,ev6 -Wa,-mev6" ;;
- alphaev67 | alphaev68 | alphaev7*)
- gcc_cflags_asm="-Wa,-arch,ev67 -Wa,-mev67 -Wa,-arch,ev6 -Wa,-mev6" ;;
- esac
- # It might be better to ask "cc" whether it's Cray C or DEC C,
- # instead of relying on the OS part of $host. But it's hard to
- # imagine either of those compilers anywhere except their native
- # systems.
- #
- echo "include_mpn(`alpha/alpha-defs.m4')" >> $gmp_tmpconfigm4i
- case $host in
- *-cray-unicos*)
- cc_cflags="-O" # no -g, it silently disables all optimizations
- echo "include_mpn(`alpha/unicos.m4')" >> $gmp_tmpconfigm4i
- # Don't perform any assembly syntax tests on this beast.
- gmp_asm_syntax_testing=no
- ;;
- *-*-osf*)
- echo "include_mpn(`alpha/default.m4')" >> $gmp_tmpconfigm4i
- cc_cflags=""
- cc_cflags_optlist="opt cpu"
- # not sure if -fast works on old versions, so make it optional
- cc_cflags_opt="-fast -O2"
- # DEC C V5.9-005 knows ev4, ev5, ev56, pca56, ev6.
- # Compaq C V6.3-029 adds ev67.
- #
- case $host_cpu in
- alpha) cc_cflags_cpu="-arch~ev4~-tune~ev4" ;;
- alphaev5) cc_cflags_cpu="-arch~ev5~-tune~ev5" ;;
- alphaev56) cc_cflags_cpu="-arch~ev56~-tune~ev56" ;;
- alphapca56 | alphapca57)
- cc_cflags_cpu="-arch~pca56~-tune~pca56" ;;
- alphaev6) cc_cflags_cpu="-arch~ev6~-tune~ev6" ;;
- alphaev67 | alphaev68 | alphaev7*)
- cc_cflags_cpu="-arch~ev67~-tune~ev67 -arch~ev6~-tune~ev6" ;;
- esac
- ;;
- *)
- echo "include_mpn(`alpha/default.m4')" >> $gmp_tmpconfigm4i
- ;;
- esac
- case $host in
- *-*-unicos*)
- # tune/alpha.asm assumes int==4bytes but unicos uses int==8bytes
- ;;
- *)
- SPEED_CYCLECOUNTER_OBJ=alpha.lo
- cyclecounter_size=1 ;;
- esac
- ;;
- # Cray vector machines.
- # This must come after alpha* so that we can recognize present and future
- # vector processors with a wildcard.
- *-cray-unicos*)
- gmp_asm_syntax_testing=no
- cclist="cc"
- # We used to have -hscalar0 here as a workaround for miscompilation of
- # mpz/import.c, but let's hope Cray fixes their bugs instead, since
- # -hscalar0 causes disastrously poor code to be generated.
- cc_cflags="-O3 -hnofastmd -htask0 -Wa,-B"
- path="cray"
- ;;
- arm*-*-*)
- path="arm"
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_testlist="gcc-arm-umodsi"
- echo "include_mpn(`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
- ;;
- clipper*-*-*)
- path="clipper"
- ;;
- # Fujitsu
- f30[01]-fujitsu-sysv*)
- cclist="gcc vcc"
- # FIXME: flags for vcc?
- vcc_cflags="-g"
- path="fujitsu"
- ;;
- hppa*-*-*)
- # HP cc (the one sold separately) is K&R by default, but AM_C_PROTOTYPES
- # will add "-Ae", or "-Aa -D_HPUX_SOURCE", to put it into ansi mode, if
- # possible.
- #
- # gcc for hppa 2.0 can be built either for 2.0n (32-bit) or 2.0w
- # (64-bit), but not both, so there's no option to choose the desired
- # mode, we must instead detect which of the two it is. This is done by
- # checking sizeof(long), either 4 or 8 bytes respectively. Do this in
- # ABI=1.0 too, in case someone tries to build that with a 2.0w gcc.
- #
- gcc_cflags_optlist="arch"
- gcc_testlist="sizeof-long-4"
- SPEED_CYCLECOUNTER_OBJ=hppa.lo
- cyclecounter_size=1
- # FIXME: For hppa2.0*, path should be "pa32/hppa2_0 pa32/hppa1_1 pa32".
- # (Can't remember why this isn't done already, have to check what .asm
- # files are available in each and how they run on a typical 2.0 cpu.)
- #
- case $host_cpu in
- hppa1.0*) path="pa32" ;;
- hppa7000*) path="pa32/hppa1_1 pa32" ;;
- hppa2.0* | hppa64)
- path="pa32/hppa2_0 pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;;
- *) # default to 7100
- path="pa32/hppa1_1/pa7100 pa32/hppa1_1 pa32" ;;
- esac
- # gcc 2.7.2.3 knows -mpa-risc-1-0 and -mpa-risc-1-1
- # gcc 2.95 adds -mpa-risc-2-0, plus synonyms -march=1.0, 1.1 and 2.0
- #
- # We don't use -mpa-risc-2-0 in ABI=1.0 because 64-bit registers may not
- # be saved by the kernel on an old system. Actually gcc (as of 3.2)
- # only adds a few float instructions with -mpa-risc-2-0, so it would
- # probably be safe, but let's not take the chance. In any case, a
- # configuration like --host=hppa2.0 ABI=1.0 is far from optimal.
- #
- case $host_cpu in
- hppa1.0*) gcc_cflags_arch="-mpa-risc-1-0" ;;
- *) # default to 7100
- gcc_cflags_arch="-mpa-risc-1-1" ;;
- esac
- case $host_cpu in
- hppa1.0*) cc_cflags="+O2" ;;
- *) # default to 7100
- cc_cflags="+DA1.1 +O2" ;;
- esac
- case $host in
- hppa2.0*-*-* | hppa64-*-*)
- cclist_20n="gcc cc"
- abilist="2.0n 1.0"
- path_20n="pa64"
- limb_20n=longlong
- any_20n_testlist="sizeof-long-4"
- SPEED_CYCLECOUNTER_OBJ_20n=hppa2.lo
- cyclecounter_size_20n=2
- # -mpa-risc-2-0 is only an optional flag, in case an old gcc is
- # used. Assembler support for 2.0 is essential though, for our asm
- # files.
- gcc_20n_cflags="-O2"
- gcc_20n_cflags_optlist="arch"
- gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
- gcc_20n_testlist="sizeof-long-4 hppa-level-2.0"
- cc_20n_cflags="+DA2.0 +e +O2 -Wl,+vnocompatwarnings"
- cc_20n_testlist="hpc-hppa-2-0"
- # ABI=2.0w is available for hppa2.0w and hppa2.0, but not for
- # hppa2.0n, on the assumption that that the latter indicates a
- # desire for ABI=2.0n.
- case $host in
- hppa2.0n-*-*) ;;
- *)
- # HPUX 10 and earlier cannot run 2.0w. Not sure about other
- # systems (GNU/Linux for instance), but lets assume they're ok.
- case $host in
- *-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*) ;;
- *) abilist="2.0w $abilist" ;;
- esac
- cclist_20w="gcc cc"
- gcc_20w_cflags="-O2 -mpa-risc-2-0"
- cc_20w_cflags="+DD64 +O2"
- cc_20w_testlist="hpc-hppa-2-0"
- path_20w="pa64"
- any_20w_testlist="sizeof-long-8"
- SPEED_CYCLECOUNTER_OBJ_20w=hppa2w.lo
- cyclecounter_size_20w=2
- ;;
- esac
- ;;
- esac
- ;;
- i960*-*-*)
- path="i960"
- ;;
- ia64*-*-* | itanium-*-* | itanium2-*-*)
- abilist="64"
- echo "include_mpn(`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i
- SPEED_CYCLECOUNTER_OBJ=ia64.lo
- case $host_cpu in
- itanium) path="ia64/itanium ia64" ;;
- itanium2) path="ia64/itanium2 ia64" ;;
- *) path="ia64" ;;
- esac
- gcc_64_cflags_optlist="tune"
- gcc_32_cflags_optlist=$gcc_64_cflags_optlist
- # gcc pre-release 3.4 adds -mtune itanium and itanium2
- case $host_cpu in
- itanium) gcc_cflags_tune="-mtune=itanium" ;;
- itanium2) gcc_cflags_tune="-mtune=itanium2" ;;
- esac
- case $host in
- *-*-linux*)
- cclist="gcc icc"
- icc_cflags="-no-gcc"
- icc_cflags_optlist="opt"
- # Don't use -O3, it is for "large data sets" and also miscompiles GMP.
- # But icc miscompiles GMP at any optimization level, at higher levels
- # it miscompiles more files...
- icc_cflags_opt="-O2 -O1"
- ;;
- *-*-hpux*)
- # HP cc sometimes gets internal errors if the optimization level is
- # too high. GMP_PROG_CC_WORKS detects this, the "_opt" fallbacks
- # let us use whatever seems to work.
- #
- abilist="32 64"
- cclist_32="gcc cc"
- path_32="ia64"
- cc_32_cflags=""
- cc_32_cflags_optlist="opt"
- cc_32_cflags_opt="+O3 +O2 +O1"
- gcc_32_cflags="-milp32 -O2"
- limb_32=longlong
- SPEED_CYCLECOUNTER_OBJ_32=ia64.lo
- cyclecounter_size_32=2
- # Must have +DD64 in CPPFLAGS to get the right __LP64__ for headers,
- # but also need it in CFLAGS for linking programs, since automake
- # only uses CFLAGS when linking, not CPPFLAGS.
- # FIXME: Maybe should use cc_64_ldflags for this, but that would
- # need GMP_LDFLAGS used consistently by all the programs.
- #
- cc_64_cflags="+DD64"
- cc_64_cppflags="+DD64"
- cc_64_cflags_optlist="opt"
- cc_64_cflags_opt="+O3 +O2 +O1"
- gcc_64_cflags="$gcc_64_cflags -mlp64"
- ;;
- esac
- ;;
- # Motorola 68k
- #
- m68k-*-* | m68[0-9][0-9][0-9]-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_m68k 1" >>confdefs.h
- echo "include_mpn(`m68k/m68k-defs.m4')" >> $gmp_tmpconfigm4i
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_cflags_optlist="arch"
- # gcc 2.7.2 knows -m68000, -m68020, -m68030, -m68040.
- # gcc 2.95 adds -mcpu32, -m68060.
- # FIXME: Maybe "-m68020 -mnobitfield" would suit cpu32 on 2.7.2.
- #
- case $host_cpu in
- m68020) gcc_cflags_arch="-m68020" ;;
- m68030) gcc_cflags_arch="-m68030" ;;
- m68040) gcc_cflags_arch="-m68040" ;;
- m68060) gcc_cflags_arch="-m68060 -m68000" ;;
- m68360) gcc_cflags_arch="-mcpu32 -m68000" ;;
- *) gcc_cflags_arch="-m68000" ;;
- esac
- # FIXME: m68k/mc68020 looks like it's ok for cpu32, but this wants to be
- # tested. Will need to introduce an m68k/cpu32 if m68k/mc68020 ever uses
- # the bitfield instructions.
- case $host_cpu in
- m680[234]0 | m68360) path="m68k/mc68020 m68k" ;;
- *) path="m68k" ;;
- esac
- ;;
- # Motorola 88k
- m88k*-*-*)
- path="m88k"
- ;;
- m88110*-*-*)
- gcc_cflags="$gcc_cflags -m88110"
- path="m88k/mc88110 m88k"
- ;;
- # National Semiconductor 32k
- ns32k*-*-*)
- path="ns32k"
- ;;
- # IRIX 5 and earlier can only run 32-bit o32.
- #
- # IRIX 6 and up always has a 64-bit mips CPU can run n32 or 64. n32 is
- # preferred over 64, but only because that's been the default in past
- # versions of GMP. The two are equally efficient.
- #
- # Linux kernel 2.2.13 arch/mips/kernel/irixelf.c has a comment about not
- # supporting n32 or 64.
- #
- # For reference, libtool (eg. 1.5.6) recognises the n32 ABI and knows the
- # right options to use when linking (both cc and gcc), so no need for
- # anything special from us.
- #
- mips*-*-*)
- abilist="o32"
- gcc_cflags_optlist="abi"
- gcc_cflags_abi="-mabi=32"
- gcc_testlist="gcc-mips-o32"
- path="mips32"
- cc_cflags="-O2 -o32" # no -g, it disables all optimizations
- # this suits both mips32 and mips64
- echo "include_mpn(`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
- case $host in
- mips64*-*-* | mips*-*-irix[6789]*)
- abilist="n32 64 o32"
- cclist_n32="gcc cc"
- gcc_n32_cflags="-O2 -mabi=n32"
- cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
- limb_n32=longlong
- path_n32="mips64"
- cclist_64="gcc cc"
- gcc_64_cflags="$gcc_64_cflags -mabi=64"
- gcc_64_ldflags="-Wc,-mabi=64"
- cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
- cc_64_ldflags="-Wc,-64"
- path_64="mips64"
- ;;
- esac
- ;;
- # Darwin (powerpc-apple-darwin1.3) has it's hacked gcc installed as cc.
- # Our usual "gcc in disguise" detection means gcc_cflags etc here gets
- # used.
- #
- # The darwin pre-compiling preprocessor is disabled with -no-cpp-precomp
- # since it doesn't like "__attribute__ ((mode (SI)))" etc in gmp-impl.h,
- # and so always ends up running the plain preprocessor anyway. This could
- # be done in CPPFLAGS rather than CFLAGS, but there's not many places
- # preprocessing is done separately, and this is only a speedup, the normal
- # preprocessor gets run if there's any problems.
- #
- # We used to use -Wa,-mppc with gcc, but can't remember exactly why.
- # Presumably it was for old versions of gcc where -mpowerpc doesn't put
- # the assembler in the right mode. In any case -Wa,-mppc is not good, for
- # instance -mcpu=604 makes recent gcc use -m604 to get access to the
- # "fsel" instruction, but a -Wa,-mppc overrides that, making code that
- # comes out with fsel fail.
- #
- # (Note also that the darwin assembler doesn't accept "-mppc", so any
- # -Wa,-mppc was used only if it worked. The right flag on darwin would be
- # "-arch ppc" or some such, but that's already the default.)
- #
- powerpc*-*-* | power[3-9]-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_powerpc 1" >>confdefs.h
- HAVE_HOST_CPU_FAMILY_powerpc=1
- abilist="32"
- cclist="gcc cc"
- cc_cflags="-O2"
- gcc_cflags="$gcc_cflags -mpowerpc"
- gcc_cflags_optlist="precomp subtype asm cpu"
- gcc_cflags_precomp="-no-cpp-precomp"
- gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin
- gcc_cflags_asm=""
- gcc_cflags_cpu=""
- vmx_path=""
- # grab this object, though it's not a true cycle counter routine
- SPEED_CYCLECOUNTER_OBJ=powerpc.lo
- cyclecounter_size=0
- case $host_cpu in
- powerpc740 | powerpc750)
- path="powerpc32/750 powerpc32" ;;
- powerpc7400 | powerpc7410)
- path="powerpc32/vmx powerpc32/750 powerpc32" ;;
- powerpc74[45]?)
- path="powerpc32/vmx powerpc32" ;;
- *)
- path="powerpc32" ;;
- esac
- # gcc 2.7.2 knows -mcpu=403, 601, 603, 604.
- # gcc 2.95 adds 401, 505, 602, 603e, ec603e, 604e, 620, 740, 750,
- # 801, 821, 823, 860.
- # gcc 3.0 adds 630, rs64a.
- # gcc 3.1 adds 405, 7400, 7450.
- # gcc 3.2 adds nothing.
- # gcc 3.3 adds power3, power4, 8540. power3 seems to be a synonym for 630.
- # gcc pre-release 3.4 adds 405fp, 440, 440fp, 970.
- #
- # FIXME: The way 603e falls back to 603 for gcc 2.7.2 should be
- # done for all the others too. But what would be the correct
- # arrangements?
- #
- case $host_cpu in
- powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
- powerpc403) gcc_cflags_cpu="-mcpu=403" ;;
- powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
- powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
- powerpc601) gcc_cflags_cpu="-mcpu=601" ;;
- powerpc602) gcc_cflags_cpu="-mcpu=602" ;;
- powerpc603) gcc_cflags_cpu="-mcpu=603" ;;
- powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;;
- powerpc604) gcc_cflags_cpu="-mcpu=604" ;;
- powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;;
- powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
- powerpc630) gcc_cflags_cpu="-mcpu=630"
- cpu_path="p3" ;;
- powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
- powerpc7400 | powerpc7410)
- gcc_cflags_asm="-Wa,-maltivec"
- gcc_cflags_cpu="-mcpu=7400 -mcpu=750" ;;
- powerpc74[45]?)
- gcc_cflags_asm="-Wa,-maltivec"
- gcc_cflags_cpu="-mcpu=7450" ;;
- powerpc750) gcc_cflags_cpu="-mcpu=750" ;;
- powerpc801) gcc_cflags_cpu="-mcpu=801" ;;
- powerpc821) gcc_cflags_cpu="-mcpu=821" ;;
- powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
- powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
- powerpc970) gcc_cflags_cpu="-mtune=970"
- vmx_path="powerpc64/vmx"
- cpu_path="p4" ;;
- power4) gcc_cflags_cpu="-mtune=power4"
- cpu_path="p4" ;;
- power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4"
- cpu_path="p5 p4" ;;
- power6) gcc_cflags_cpu="-mtune=power6"
- cpu_path="p6" ;;
- esac
- case $host in
- *-*-aix*)
- cclist="gcc xlc cc"
- xlc_cflags="-O2 -qmaxmem=20000"
- xlc_cflags_optlist="arch"
- # xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604,
- # 403, rs64a
- # -qarch=ppc is needed, so ensure everything falls back to that.
- # FIXME: Perhaps newer versions know more flavours.
- #
- case $host_cpu in
- powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
- powerpc601) xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
- powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
- powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
- powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
- *) xlc_cflags_arch="-qarch=ppc" ;;
- esac
- ;;
- esac
- case $host in
- powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*)
- case $host in
- *-*-aix*)
- # On AIX a true 64-bit ABI is available.
- # Need -Wc to pass object type flags through to the linker.
- abilist="aix64 $abilist"
- cclist_aix64="gcc xlc"
- gcc_aix64_cflags="-O2 -maix64 -mpowerpc64"
- gcc_aix64_cflags_optlist="cpu"
- gcc_aix64_ldflags="-Wc,-maix64"
- xlc_aix64_cflags="-O2 -q64 -qtune=pwr3 -qmaxmem=20000"
- xlc_aix64_ldflags="-Wc,-q64"
- # Must indicate object type to ar and nm
- ar_aix64_flags="-X64"
- nm_aix64_flags="-X64"
- path_aix64=""
- for i in $cpu_path; do path_aix64="${path_aix64}powerpc64/mode64/$i "; done
- path_aix64="${path_aix64}powerpc64/mode64 $vmx_path powerpc64"
- # grab this object, though it's not a true cycle counter routine
- SPEED_CYCLECOUNTER_OBJ_aix64=powerpc64.lo
- cyclecounter_size_aix64=0
- ;;
- *-*-darwin*)
- # On Darwin we can use 64-bit instructions with a longlong limb,
- # but the chip still in 32-bit mode.
- # In theory this can be used on any OS which knows how to save
- # 64-bit registers in a context switch.
- #
- # Note that we must use -mpowerpc64 with gcc, since the
- # longlong.h macros expect limb operands in a single 64-bit
- # register, not two 32-bit registers as would be given for a
- # long long without -mpowerpc64. In theory we could detect and
- # accommodate both styles, but the proper 64-bit registers will
- # be fastest and are what we really want to use.
- #
- # One would think -mpowerpc64 would set the assembler in the right
- # mode to handle 64-bit instructions. But for that, also
- # -force_cpusubtype_ALL is needed.
- #
- # Do not use -fast for Darwin, it actually adds options
- # incompatible with a shared library.
- #
- abilist="mode64 mode32 $abilist"
- gcc_cflags_opt="-O3 -O2 -O1" # will this become used?
- cclist_mode32="gcc"
- gcc_mode32_cflags="-mpowerpc64"
- gcc_mode32_cflags_optlist="subtype cpu opt"
- gcc_mode32_cflags_subtype="-force_cpusubtype_ALL"
- gcc_mode32_cflags_opt="-O3 -O2 -O1"
- path_mode32="powerpc64/mode32 $vmx_path powerpc64"
- limb_mode32=longlong
- cclist_mode64="gcc"
- gcc_mode64_cflags="-m64"
- gcc_mode64_cflags_optlist="cpu opt"
- gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- for i in $cpu_path; do path_mode64="${path_mode64}powerpc64/mode64/$i "; done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
- any_mode64_testlist="sizeof-long-8"
- ;;
- *-*-linux* | *-*-*bsd*)
- # On GNU/Linux, assume the processor is in 64-bit mode. Some
- # environments have a gcc that is always in 64-bit mode, while
- # others require -m64, hence the use of cflags_maybe. The
- # sizeof-long-8 test checks the mode is right (for the no option
- # case).
- #
- # -mpowerpc64 is not used, since it should be the default in
- # 64-bit mode. (We need its effect for the various longlong.h
- # asm macros to be right of course.)
- #
- # gcc64 was an early port of gcc to 64-bit mode, but should be
- # obsolete before too long. We prefer plain gcc when it knows
- # 64-bits.
- #
- abilist="mode64 mode32 $abilist"
- cclist_mode32="gcc"
- gcc_mode32_cflags="-mpowerpc64"
- gcc_mode32_cflags_optlist="cpu opt"
- gcc_mode32_cflags_opt="-O3 -O2 -O1"
- path_mode32="powerpc64/mode32 $vmx_path powerpc64"
- limb_mode32=longlong
- cclist_mode64="gcc gcc64"
- gcc_mode64_cflags_maybe="-m64"
- gcc_mode64_cflags_optlist="cpu opt"
- gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- for i in $cpu_path; do path_mode64="${path_mode64}powerpc64/mode64/$i "; done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
- any_mode64_testlist="sizeof-long-8"
- ;;
- esac
- ;;
- esac
- ;;
- # POWER
- power-*-* | power[12]-*-* | power2sc-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_power 1" >>confdefs.h
- HAVE_HOST_CPU_FAMILY_power=1
- cclist="gcc"
- extra_functions="udiv_w_sdiv"
- path="power"
- # gcc 2.7.2 knows rios1, rios2, rsc
- #
- # -mcpu=rios2 can tickle an AIX assembler bug (see GMP_PROG_CC_WORKS) so
- # there needs to be a fallback to just -mpower.
- #
- gcc_cflags_optlist="cpu"
- case $host in
- power-*-*) gcc_cflags_cpu="-mcpu=power -mpower" ;;
- power1-*-*) gcc_cflags_cpu="-mcpu=rios1 -mpower" ;;
- power2-*-*) gcc_cflags_cpu="-mcpu=rios2 -mpower" ;;
- power2sc-*-*) gcc_cflags_cpu="-mcpu=rsc -mpower" ;;
- esac
- case $host in
- *-*-aix*)
- cclist="gcc xlc"
- xlc_cflags="-O2 -qarch=pwr -qmaxmem=20000"
- ;;
- esac
- ;;
- pyramid-*-*)
- path="pyr"
- ;;
- # IBM s/370 and similar
- s3[6-9]0*-*-*)
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- path="s390"
- extra_functions="udiv_w_sdiv"
- ;;
- sh-*-*) path="sh" ;;
- sh2-*-*) path="sh/sh2 sh" ;;
- *sparc*-*-*)
- # sizeof(long)==4 or 8 is tested, to ensure we get the right ABI. We've
- # had various bug reports where users have set CFLAGS for their desired
- # mode, but not set our ABI. For some reason it's sparc where this
- # keeps coming up, presumably users there are accustomed to driving the
- # compiler mode that way. The effect of our testlist setting is to
- # reject ABI=64 in favour of ABI=32 if the user has forced the flags to
- # 32-bit mode.
- #
- abilist="32"
- cclist="gcc acc cc"
- any_testlist="sizeof-long-4"
- echo "include_mpn(`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
- case $host_cpu in
- sparcv8 | microsparc | turbosparc)
- path="sparc32/v8 sparc32" ;;
- supersparc)
- path="sparc32/v8/supersparc sparc32/v8 sparc32" ;;
- sparc64 | sparcv9* | ultrasparc*)
- path="sparc32/v9 sparc32/v8 sparc32" ;;
- *)
- path="sparc32" ;;
- esac
- # gcc 2.7.2 doesn't know about v9 and doesn't pass -xarch=v8plus to the
- # assembler. Add it explicitly since the solaris assembler won't accept
- # our sparc32/v9 asm code without it. gas accepts -xarch=v8plus too, so
- # it can be in the cflags unconditionally (though gas doesn't need it).
- #
- # gcc -m32 is needed to force 32-bit mode on a dual-ABI system, but past
- # gcc doesn't know that flag, hence cflags_maybe. Note that -m32 cannot
- # be done through the optlist since the plain cflags would be run first
- # and we don't want to require the default mode (whatever it is) works.
- #
- # Note it's gcc_32_cflags_maybe and not gcc_cflags_maybe because the
- # latter would be used in the 64-bit ABI on systems like "*bsd" where
- # abilist="64" only.
- #
- case $host_cpu in
- sparc64 | sparcv9* | ultrasparc*)
- gcc_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
- *)
- gcc_cflags="$gcc_cflags" ;;
- esac
- gcc_32_cflags_maybe="-m32"
- gcc_cflags_optlist="cpu"
- # gcc 2.7.2 knows -mcypress, -msupersparc, -mv8, -msparclite.
- # gcc 2.95 knows -mcpu= v7, hypersparc, sparclite86x, f930, f934,
- # sparclet, tsc701, v9, ultrasparc. A warning is given that the
- # plain -m forms will disappear.
- # gcc 3.0 adds nothing.
- # gcc 3.1 adds nothing.
- # gcc 3.2 adds nothing.
- # gcc 3.3 adds ultrasparc3.
- #
- case $host_cpu in
- supersparc) gcc_cflags_cpu="-mcpu=supersparc -msupersparc" ;;
- sparcv8 | microsparc | turbosparc)
- gcc_cflags_cpu="-mcpu=v8 -mv8" ;;
- sparc64 | sparcv9*) gcc_cflags_cpu="-mcpu=v9 -mv8" ;;
- ultrasparc3) gcc_cflags_cpu="-mcpu=ultrasparc3 -mcpu=ultrasparc -mv8" ;;
- ultrasparc*) gcc_cflags_cpu="-mcpu=ultrasparc -mv8" ;;
- *) gcc_cflags_cpu="-mcpu=v7 -mcypress" ;;
- esac
- # SunPRO cc and acc, and SunOS bundled cc
- case $host in
- *-*-solaris* | *-*-sunos*)
- # Note no -g, it disables all optimizations.
- cc_cflags=
- cc_cflags_optlist="opt arch cpu"
- # SunOS cc doesn't know -xO4, fallback to -O2.
- cc_cflags_opt="-xO4 -O2"
- # SunOS cc doesn't know -xarch, apparently always generating v7
- # code, so make this optional
- case $host_cpu in
- sparcv8 | microsparc | supersparc | turbosparc)
- cc_cflags_arch="-xarch=v8" ;;
- sparc64 | sparcv9* | ultrasparc*) cc_cflags_arch="-xarch=v8plus" ;;
- *) cc_cflags_arch="-xarch=v7" ;;
- esac
- # SunOS cc doesn't know -xchip and doesn't seem to have an equivalent.
- # SunPRO cc 5 recognises -xchip=generic, old, super, super2, micro,
- # micro2, hyper, hyper2, powerup, ultra, ultra2, ultra2i.
- # SunPRO cc 6 adds -xchip=ultra2e, ultra3cu.
- #
- # FIXME: Which of ultra, ultra2 or ultra2i is the best fallback for
- # ultrasparc3?
- #
- case $host_cpu in
- supersparc) cc_cflags_cpu="-xchip=super" ;;
- microsparc) cc_cflags_cpu="-xchip=micro" ;;
- turbosparc) cc_cflags_cpu="-xchip=micro2" ;;
- ultrasparc) cc_cflags_cpu="-xchip=ultra" ;;
- ultrasparc2) cc_cflags_cpu="-xchip=ultra2" ;;
- ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;;
- ultrasparc3) cc_cflags_cpu="-xchip=ultra3 -xchip=ultra" ;;
- *) cc_cflags_cpu="-xchip=generic" ;;
- esac
- esac
- case $host_cpu in
- sparc64 | sparcv9* | ultrasparc*)
- case $host in
- # Solaris 6 and earlier cannot run ABI=64 since it doesn't save
- # registers properly, so ABI=32 is left as the only choice.
- #
- *-*-solaris2.[0-6] | *-*-solaris2.[0-6].*) ;;
- # BSD sparc64 ports are 64-bit-only systems, so ABI=64 is the only
- # choice. In fact they need no special compiler flags, gcc -m64
- # is the default, but it doesn't hurt to add it. v9 CPUs always
- # use the sparc64 port, since the plain 32-bit sparc ports don't
- # run on a v9.
- #
- *-*-*bsd*) abilist="64" ;;
- # For all other systems, we try both 64 and 32.
- #
- # GNU/Linux sparc64 has only recently gained a 64-bit user mode.
- # In the past sparc64 meant a v9 cpu, but there were no 64-bit
- # operations in user mode. We assume that if "gcc -m64" works
- # then the system is suitable. Hopefully even if someone attempts
- # to put a new gcc and/or glibc on an old system it won't run.
- #
- *) abilist="64 32" ;;
- esac
- case $host_cpu in
- ultrasparc | ultrasparc2 | ultrasparc2i)
- path_64="sparc64/ultrasparc12 sparc64" ;;
- ultrasparc3)
- path_64="sparc64/ultrasparc34 sparc64/ultrasparc12 sparc64" ;;
- *)
- path_64="sparc64"
- esac
- cclist_64="gcc"
- any_64_testlist="sizeof-long-8"
- # gcc -mptr64 is probably implied by -m64, but we're not sure if
- # this was always so. On Solaris in the past we always used both
- # "-m64 -mptr64".
- #
- # gcc -Wa,-xarch=v9 is thought to be necessary in some cases on
- # solaris, but it would seem likely that if gcc is going to generate
- # 64-bit code it will have to add that option itself where needed.
- # An extra copy of this option should be harmless though, but leave
- # it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the
- # higher cpu types instead.)
- #
- gcc_64_cflags="$gcc_64_cflags -m64 -mptr64"
- gcc_64_ldflags="-Wc,-m64"
- gcc_64_cflags_optlist="cpu"
- case $host in
- *-*-solaris*)
- # Sun cc.
- #
- # We used to have -fast and some fixup options here, but it
- # recurrently caused problems with miscompilation. Of course,
- # -fast is documented as miscompiling things for the sake of speed.
- #
- cclist_64="$cclist_64 cc"
- cc_64_cflags="-xO3 -xarch=v9"
- cc_64_cflags_optlist="cpu"
- ;;
- esac
- # using the v9 %tick register
- SPEED_CYCLECOUNTER_OBJ_32=sparcv9.lo
- SPEED_CYCLECOUNTER_OBJ_64=sparcv9.lo
- cyclecounter_size_32=2
- cyclecounter_size_64=2
- ;;
- esac
- ;;
- # VAX
- vax*-*-*)
- # Currently gcc (version 3.0) on vax always uses a frame pointer
- # (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
- # will be ignored.
- #
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- path="vax"
- extra_functions="udiv_w_sdiv"
- ;;
- # AMD and Intel x86 configurations, including AMD64
- #
- # Rumour has it gcc -O2 used to give worse register allocation than just
- # -O, but lets assume that's no longer true.
- #
- # -m32 forces 32-bit mode on a bi-arch 32/64 amd64 build of gcc. -m64 is
- # the default in such a build (we think), so -m32 is essential for ABI=32.
- # This is, of course, done for any $host_cpu, not just x86_64, so we can
- # get such a gcc into the right mode to cross-compile to say i486-*-*.
- #
- # -m32 is not available in gcc 2.95 and earlier, hence cflags_maybe to use
- # it when it works. We check sizeof(long)==4 to ensure we get the right
- # mode, in case -m32 has failed not because it's an old gcc, but because
- # it's a dual 32/64-bit gcc without a 32-bit libc, or whatever.
- #
- i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei-*-* | x86_64-*-* | nano-*-*)
- abilist="32"
- cclist="gcc icc cc"
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_32_cflags_maybe="-m32"
- icc_cflags="-no-gcc"
- icc_cflags_optlist="opt"
- icc_cflags_opt="-O3 -O2 -O1"
- any_32_testlist="sizeof-long-4"
- CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo'
- # Availability of rdtsc is checked at run-time.
- SPEED_CYCLECOUNTER_OBJ=pentium.lo
- # gcc 2.7.2 only knows i386 and i486, using -m386 or -m486. These
- # represent -mcpu= since -m486 doesn't generate 486 specific insns.
- # gcc 2.95 adds k6, pentium and pentiumpro, and takes -march= and -mcpu=.
- # gcc 3.0 adds athlon.
- # gcc 3.1 adds k6-2, k6-3, pentium-mmx, pentium2, pentium3, pentium4,
- # athlon-tbird, athlon-4, athlon-xp, athlon-mp.
- # gcc 3.2 adds winchip2.
- # gcc 3.3 adds winchip-c6.
- # gcc 3.3.1 from mandrake adds k8 and knows -mtune.
- # gcc 3.4 adds c3, c3-2, k8, and deprecates -mcpu in favour of -mtune.
- #
- # In gcc 2.95.[0123], -march=pentiumpro provoked a stack slot bug in an
- # old version of mpz/powm.c. Seems to be fine with the current code, so
- # no need for any restrictions on that option.
- #
- # -march=pentiumpro can fail if the assembler doesn't know "cmov"
- # (eg. solaris 2.8 native "as"), so always have -march=pentium after
- # that as a fallback.
- #
- # -march=pentium4 and -march=k8 enable SSE2 instructions, which may or
- # may not be supported by the assembler and/or the OS, and is bad in gcc
- # prior to 3.3. The tests will reject these if no good, so fallbacks
- # like "-march=pentium4 -mno-sse2" are given to try also without SSE2.
- # Note the relevant -march types are listed in the optflags handling
- # below, be sure to update there if adding new types emitting SSE2.
- #
- # -mtune is used at the start of each cpu option list to give something
- # gcc 3.4 will use, thereby avoiding warnings from -mcpu. -mcpu forms
- # are retained for use by prior gcc. For example pentium has
- # "-mtune=pentium -mcpu=pentium ...", the -mtune is for 3.4 and the
- # -mcpu for prior. If there's a brand new choice in 3.4 for a chip,
- # like k8 for x86_64, then it can be the -mtune at the start, no need to
- # duplicate anything.
- #
- gcc_cflags_optlist="cpu arch"
- case $host_cpu in
- i386*)
- gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
- gcc_cflags_arch="-march=i386"
- ;;
- i486*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- ;;
- i586 | pentium)
- gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium"
- ;;
- pentiummmx)
- gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium-mmx -march=pentium"
- ;;
- i686 | pentiumpro)
- gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentiumpro -march=pentium"
- ;;
- pentium2)
- gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
- ;;
- pentium3 | pentiumm)
- gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
- ;;
- k6)
- gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6"
- ;;
- k62)
- gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-2 -march=k6"
- ;;
- k63)
- gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-3 -march=k6"
- ;;
- geode)
- gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6-3 -march=k6"
- ;;
- athlon)
- # Athlon instruction costs are close to P6 (3 cycle load latency,
- # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
- # know athlon (eg. 2.95.2 doesn't) then fall back on pentiumpro.
- gcc_cflags_cpu="-mtune=athlon -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=athlon -march=pentiumpro -march=pentium"
- ;;
- i786 | pentium4)
- # pentiumpro is the primary fallback when gcc doesn't know pentium4.
- # This gets us cmov to eliminate branches. Maybe "athlon" would be
- # a possibility on gcc 3.0.
- #
- gcc_cflags_cpu="-mtune=pentium4 -mcpu=pentium4 -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentium4 -march=pentium4~-mno-sse2 -march=pentiumpro -march=pentium"
- gcc_64_cflags_cpu="-mtune=nocona"
- ;;
- viac32)
- # Not sure of the best fallbacks here for -mcpu.
- # c3-2 has sse and mmx, so pentium3 is good for -march.
- gcc_cflags_cpu="-mtune=c3-2 -mcpu=c3-2 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=c3-2 -march=pentium3 -march=pentiumpro -march=pentium"
- ;;
- viac3*)
- # Not sure of the best fallbacks here.
- gcc_cflags_cpu="-mtune=c3 -mcpu=c3 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=c3 -march=pentium-mmx -march=pentium"
- ;;
- athlon64 | x86_64)
- gcc_cflags_cpu="-mtune=k8 -mcpu=athlon -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k8 -march=k8~-mno-sse2 -march=athlon -march=pentiumpro -march=pentium"
- ;;
- core2 | corei)
- gcc_cflags_cpu="-mtune=core2 -mtune=k8"
- gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
- ;;
- atom)
- gcc_cflags_cpu="-mtune=atom -mtune=pentium3"
- gcc_cflags_arch="-march=atom -march=pentium3"
- ;;
- *)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- ;;
- esac
- case $host_cpu in
- i386*) path="x86" ;;
- i486*) path="x86/i486 x86" ;;
- i586 | pentium) path="x86/pentium x86" ;;
- pentiummmx) path="x86/pentium/mmx x86/pentium x86" ;;
- i686 | pentiumpro) path="x86/p6 x86" ;;
- pentium2) path="x86/p6/mmx x86/p6 x86" ;;
- pentium3) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
- pentiumm | core2 | corei)
- path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
- k6[23]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
- k6) path="x86/k6/mmx x86/k6 x86" ;;
- geode) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
- # we don't have any specific 32-bit code for athlon64/opteron, the
- # athlon code should be reasonable
- athlon | athlon64) path="x86/k7/mmx x86/k7 x86" ;;
- i786 | pentium4) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
- # VIA/Centaur processors, sold as CyrixIII and C3.
- viac32) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
- viac3*) path="x86/pentium/mmx x86/pentium x86";;
- atom) path="x86/atom x86" ;;
- *) path="x86" ;;
- esac
- case $host in
- athlon64-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei-*-* | x86_64-*-* | nano-*-*)
- cclist_64="gcc"
- gcc_64_cflags="$gcc_64_cflags -m64"
- gcc_64_cflags_optlist="cpu arch"
- CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
- SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
- cyclecounter_size_64=2
- abilist="64 32"
- path_64="x86_64"
- case $host_cpu in
- x86_64)
- ;;
- athlon64)
- path_64="x86_64/k8 $path_64"
- ;;
- pentium4)
- path_64="x86_64/pentium4 $path_64"
- ;;
- core2)
- path_64="x86_64/core2 $path_64"
- ;;
- corei)
- path_64="x86_64/corei x86_64/core2 $path_64"
- ;;
- atom)
- path_64="x86_64/atom $path_64"
- ;;
- nano)
- path_64="x86_64/nano $path_64"
- ;;
- esac
- case $host in
- *-*-solaris*)
- # Sun cc.
- cclist_64="$cclist_64 cc"
- cc_64_cflags="-xO3 -m64"
- ;;
- *-*-mingw*)
- limb_64=longlong
- path_64="" # Windows amd64 calling conventions are *different*
- # Silence many pedantic warnings for w64. FIXME.
- gcc_64_cflags="$gcc_64_cflags -std=gnu99"
- ;;
- esac
- ;;
- esac
- ;;
- # FIXME: z8kx won't get through config.sub. Could make 16 versus 32 bit
- # limb an ABI option perhaps.
- z8kx*-*-*)
- path="z8000x"
- extra_functions="udiv_w_sdiv"
- ;;
- z8k*-*-*)
- path="z8000"
- extra_functions="udiv_w_sdiv"
- ;;
- # Special CPU "none" selects generic C. -DNO_ASM is used to disable gcc
- # asm blocks in longlong.h (since they're driven by cpp pre-defined
- # symbols like __alpha rather than the configured $host_cpu).
- #
- none-*-*)
- abilist="long longlong"
- cclist_long=$cclist
- gcc_long_cflags=$gcc_cflags
- gcc_long_cppflags="-DNO_ASM"
- cc_long_cflags=$cc_cflags
- cclist_longlong=$cclist
- gcc_longlong_cflags=$gcc_cflags
- gcc_longlong_cppflags="-DNO_ASM"
- cc_longlong_cflags=$cc_cflags
- limb_longlong=longlong
- ;;
- esac
- # mingw can be built by the cygwin gcc if -mno-cygwin is added. For
- # convenience add this automatically if it works. Actual mingw gcc accepts
- # -mno-cygwin too, but of course is the default. mingw only runs on the
- # x86s, but allow any CPU here so as to catch "none" too.
- #
- case $host in
- *-*-mingw*)
- gcc_cflags_optlist="$gcc_cflags_optlist nocygwin"
- gcc_cflags_nocygwin="-mno-cygwin"
- ;;
- esac
- CFLAGS_or_unset=${CFLAGS-'(unset)'}
- CPPFLAGS_or_unset=${CPPFLAGS-'(unset)'}
- cat >&5 <<EOF
- User:
- ABI=$ABI
- CC=$CC
- CFLAGS=$CFLAGS_or_unset
- CPPFLAGS=$CPPFLAGS_or_unset
- MPN_PATH=$MPN_PATH
- GMP:
- abilist=$abilist
- cclist=$cclist
- EOF
- test_CFLAGS=${CFLAGS+set}
- test_CPPFLAGS=${CPPFLAGS+set}
- for abi in $abilist; do
- abi_last="$abi"
- done
- # If the user specifies an ABI then it must be in $abilist, after that
- # $abilist is restricted to just that choice.
- #
- if test -n "$ABI"; then
- found=no
- for abi in $abilist; do
- if test $abi = "$ABI"; then found=yes; break; fi
- done
- if test $found = no; then
- as_fn_error "ABI=$ABI is not among the following valid choices: $abilist" "$LINENO" 5
- fi
- abilist="$ABI"
- fi
- found_compiler=no
- for abi in $abilist; do
- echo "checking ABI=$abi"
- # Suppose abilist="64 32", then for abi=64, will have abi1="_64" and
- # abi2="_64". For abi=32, will have abi1="_32" and abi2="". This is how
- # $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the
- # abilist), but there's no fallback for $gcc_64_cflags.
- #
- abi1=`echo _$abi | sed 's/[.]//g'`
- if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi
- # Compiler choices under this ABI
- eval cclist_chosen="$cclist$abi1"
- test -n "$cclist_chosen" || eval cclist_chosen="$cclist$abi2"
- # If there's a user specified $CC then don't use a list for
- # $cclist_chosen, just a single value for $ccbase.
- #
- if test -n "$CC"; then
- # The first word of $CC, stripped of any directory. For instance
- # CC="/usr/local/bin/gcc -pipe" will give "gcc".
- #
- for ccbase in $CC; do break; done
- ccbase=`echo $ccbase | sed 's:.*/::'`
- # If this $ccbase is in $cclist_chosen then it's a compiler we know and
- # we can do flags defaulting with it. If not, then $cclist_chosen is
- # set to "unrecognised" so no default flags are used.
- #
- # "unrecognised" is used to avoid bad effects with eval if $ccbase has
- # non-symbol characters. For instance ccbase=my+cc would end up with
- # something like cflags="$my+cc_cflags" which would give
- # cflags="+cc_cflags" rather than the intended empty string for an
- # unknown compiler.
- #
- found=unrecognised
- for i in $cclist_chosen; do
- if test "$ccbase" = $i; then
- found=$ccbase
- break
- fi
- done
- cclist_chosen=$found
- fi
- for ccbase in $cclist_chosen; do
- # When cross compiling, look for a compiler with the $host_alias as a
- # prefix, the same way that AC_CHECK_TOOL does. But don't do this to a
- # user-selected $CC.
- #
- # $cross_compiling will be yes/no/maybe at this point. Do the host
- # prefixing for "maybe" as well as "yes".
- #
- if test "$cross_compiling" != no && test -z "$CC"; then
- cross_compiling_prefix="${host_alias}-"
- fi
- for ccprefix in $cross_compiling_prefix ""; do
- cc="$CC"
- test -n "$cc" || cc="$ccprefix$ccbase"
- # If the compiler is gcc but installed under another name, then change
- # $ccbase so as to use the flags we know for gcc. This helps for
- # instance when specifying CC=gcc272 on Debian GNU/Linux, or the
- # native cc which is really gcc on NeXT or MacOS-X.
- #
- # FIXME: There's a slight misfeature here. If cc is actually gcc but
- # gcc is not a known compiler under this $abi then we'll end up
- # testing it with no flags and it'll work, but chances are it won't be
- # in the right mode for the ABI we desire. Let's quietly hope this
- # doesn't happen.
- #
- if test $ccbase != gcc; then
- cat >conftest.c <<EOF
- #if ! defined (__GNUC__) || defined (__INTEL_COMPILER)
- choke me
- #endif
- EOF
- gmp_compile="$cc -c conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $cc is gcc" >&5
- $as_echo_n "checking whether $cc is gcc... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
- $as_echo "yes" >&6; }
- ccbase=gcc
- else
- rm -f conftest*
- :
- fi
- fi
- # Similarly if the compiler is IBM xlc but invoked as cc or whatever
- # then change $ccbase and make the default xlc flags available.
- if test $ccbase != xlc; then
- gmp_command="$cc 2>&1 | grep xlc >/dev/null"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_command""; } >&5
- (eval $gmp_command) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $cc is xlc" >&5
- $as_echo_n "checking whether $cc is xlc... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
- $as_echo "yes" >&6; }
- ccbase=xlc
- else
- :
- fi
- fi
- # acc was Sun's first unbundled compiler back in the SunOS days, or
- # something like that, but today its man page says it's not meant to
- # be used directly (instead via /usr/ucb/cc). The options are pretty
- # much the same as the main SunPRO cc, so share those configs.
- #
- case $host in
- *sparc*-*-solaris* | *sparc*-*-sunos*)
- if test "$ccbase" = acc; then ccbase=cc; fi ;;
- esac
- for tmp_cflags_maybe in yes no; do
- eval cflags="$${ccbase}${abi1}_cflags"
- test -n "$cflags" || eval cflags="$${ccbase}${abi2}_cflags"
- if test "$tmp_cflags_maybe" = yes; then
- # don't try cflags_maybe when the user set CFLAGS
- if test "$test_CFLAGS" = set; then continue; fi
- eval cflags_maybe="$${ccbase}${abi1}_cflags_maybe"
- test -n "$cflags_maybe" || eval cflags_maybe="$${ccbase}${abi2}_cflags_maybe"
- # don't try cflags_maybe if there's nothing set
- if test -z "$cflags_maybe"; then continue; fi
- cflags="$cflags_maybe $cflags"
- fi
- # Any user CFLAGS, even an empty string, takes precedence
- if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
- # Any user CPPFLAGS, even an empty string, takes precedence
- eval cppflags="$${ccbase}${abi1}_cppflags"
- test -n "$cppflags" || eval cppflags="$${ccbase}${abi2}_cppflags"
- if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
- # --enable-profiling adds -p/-pg even to user-specified CFLAGS.
- # This is convenient, but it's perhaps a bit naughty to modify user
- # CFLAGS.
- case "$enable_profiling" in
- prof) cflags="$cflags -p" ;;
- gprof) cflags="$cflags -pg" ;;
- instrument) cflags="$cflags -finstrument-functions" ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags" >&5
- $as_echo_n "checking compiler $cc $cflags $cppflags... " >&6; }
- gmp_prog_cc_works=yes
- # first see a simple "main()" works, then go on to other checks
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- int main () { return 0; }
- EOF
- echo "Test compile: " >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no"
- ;;
- norun)
- gmp_prog_cc_works="no, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
- (without -maix64), hence detecting an unusable compiler */
- void *g() { return (void *) 0; }
- void *f() { return g(); }
- int main () { return 0; }
- EOF
- echo "Test compile: function pointer return" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, function pointer return"
- ;;
- norun)
- gmp_prog_cc_works="no, function pointer return, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an invalid instruction syntax from i386 gcc
- -march=pentiumpro on Solaris 2.8. The native sun assembler
- requires a non-standard syntax for cmov which gcc (as of 2.95.2 at
- least) doesn't know. */
- int n;
- int cmov () { return (n >= 0 ? n : 0); }
- int main () { return 0; }
- EOF
- echo "Test compile: cmov instruction" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, cmov instruction"
- ;;
- norun)
- gmp_prog_cc_works="no, cmov instruction, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes a linker invocation problem with gcc 3.0.3
- on AIX 4.3 under "-maix64 -mpowerpc64 -mcpu=630". The -mcpu=630
- option causes gcc to incorrectly select the 32-bit libgcc.a, not
- the 64-bit one, and consequently it misses out on the __fixunsdfdi
- helper (double -> uint64 conversion). */
- double d;
- unsigned long gcc303 () { return (unsigned long) d; }
- int main () { return 0; }
- EOF
- echo "Test compile: double -> ulong conversion" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double -> ulong conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, double -> ulong conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an error from hppa gcc 2.95 under -mpa-risc-2-0 if
- the assembler doesn't know hppa 2.0 instructions. fneg is a 2.0
- instruction, and a negation like this comes out using it. */
- double fneg_data;
- unsigned long fneg () { return -fneg_data; }
- int main () { return 0; }
- EOF
- echo "Test compile: double negation" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double negation"
- ;;
- norun)
- gmp_prog_cc_works="no, double negation, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following makes gcc 3.3 -march=pentium4 generate an SSE2 xmm insn
- (cvtsd2ss) which will provoke an error if the assembler doesn't recognise
- those instructions. Not sure how much of the gmp code will come out
- wanting sse2, but it's easiest to reject an option we know is bad. */
- double ftod_data;
- float ftod () { return (float) ftod_data; }
- int main () { return 0; }
- EOF
- echo "Test compile: double -> float conversion" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double -> float conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, double -> float conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error from gcc version
- "2.9-gnupro-99r1" under "-O2 -mcpu=ev6", apparently relating to char
- values being spilled into floating point registers. The problem doesn't
- show up all the time, but has occurred enough in GMP for us to reject
- this compiler+flags. */
- #include <string.h> /* for memcpy */
- struct try_t
- {
- char dst[2];
- char size;
- long d0, d1, d2, d3, d4, d5, d6;
- char overlap;
- };
- struct try_t param[6];
- int
- param_init ()
- {
- struct try_t *p;
- memcpy (p, ¶m[ 2 ], sizeof (*p));
- memcpy (p, ¶m[ 2 ], sizeof (*p));
- p->size = 2;
- memcpy (p, ¶m[ 1 ], sizeof (*p));
- p->dst[0] = 1;
- p->overlap = 2;
- memcpy (p, ¶m[ 3 ], sizeof (*p));
- p->dst[0] = 1;
- p->overlap = 8;
- memcpy (p, ¶m[ 4 ], sizeof (*p));
- memcpy (p, ¶m[ 4 ], sizeof (*p));
- p->overlap = 8;
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- return 0;
- }
- int main () { return 0; }
- EOF
- echo "Test compile: gnupro alpha ev6 char spilling" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, gnupro alpha ev6 char spilling"
- ;;
- norun)
- gmp_prog_cc_works="no, gnupro alpha ev6 char spilling, program does not run"
- ;;
- esac
- fi
- # __builtin_alloca is not available everywhere, check it exists before
- # seeing that it works
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- int k; int foo () { __builtin_alloca (k); }
- EOF
- echo "Test compile: __builtin_alloca availability" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error from Itanium HP-UX cc
- under +O2 or higher. We use this sort of code in mpn/generic/mul_fft.c. */
- int k;
- int foo ()
- {
- int i, **a;
- a = __builtin_alloca (k);
- for (i = 0; i <= k; i++)
- a[i] = __builtin_alloca (1 << i);
- }
- int main () { return 0; }
- EOF
- echo "Test compile: alloca array" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, alloca array"
- ;;
- norun)
- gmp_prog_cc_works="no, alloca array, program does not run"
- ;;
- esac
- fi
- ;;
- no)
- ;;
- norun)
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal error from the assembler on
- power2-ibm-aix4.3.1.0. gcc -mrios2 compiles to nabs+fcirz, and this
- results in "Internal error related to the source program domain".
- For reference it seems to be the combination of nabs+fcirz which is bad,
- not either alone. This sort of thing occurs in mpz/get_str.c with the
- way double chars_per_bit_exactly is applied in MPN_SIZEINBASE. Perhaps
- if that code changes to a scaled-integer style then we won't need this
- test. */
- double fp[1];
- int x;
- int f ()
- {
- int a;
- a = (x >= 0 ? x : -x);
- return a * fp[0];
- }
- int main () { return 0; }
- EOF
- echo "Test compile: abs int -> double conversion" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, abs int -> double conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, abs int -> double conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes a segfault in the compiler on powerpc-apple-darwin.
- Extracted from tests/mpn/t-iord_u.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to segfault with e.g., -O2 -mpowerpc64. */
- #if defined (__GNUC__) && ! defined (__cplusplus)
- typedef unsigned long long t1;typedef t1*t2;
- static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
- {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
- f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
- for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
- h(){}g(){}
- #else
- int dummy;
- #endif
- int main () { return 0; }
- EOF
- echo "Test compile: long long reliability test 1" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, long long reliability test 1"
- ;;
- norun)
- gmp_prog_cc_works="no, long long reliability test 1, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error on powerpc-apple-darwin.
- Extracted from mpz/cfdiv_q_2exp.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to get an ICE with -O1 -mpowerpc64. */
- #if defined (__GNUC__) && ! defined (__cplusplus)
- f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
- g(){}
- #else
- int dummy;
- #endif
- int main () { return 0; }
- EOF
- echo "Test compile: long long reliability test 2" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, long long reliability test 2"
- ;;
- norun)
- gmp_prog_cc_works="no, long long reliability test 2, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following is mis-compiled by HP ia-64 cc version
- cc: HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]
- under "cc +O3", both in +DD32 and +DD64 modes. The mpn_lshift_com gets
- inlined and its return value somehow botched to be 0 instead of 1. This
- arises in the real mpn_lshift_com in mul_fft.c. A lower optimization
- level, like +O2 seems ok. This code needs to be run to show the problem,
- but that's fine, the offending cc is a native-only compiler so we don't
- have to worry about cross compiling. */
- #if ! defined (__cplusplus)
- unsigned long
- lshift_com (rp, up, n, cnt)
- unsigned long *rp;
- unsigned long *up;
- long n;
- unsigned cnt;
- {
- unsigned long retval, high_limb, low_limb;
- unsigned tnc;
- long i;
- tnc = 8 * sizeof (unsigned long) - cnt;
- low_limb = *up++;
- retval = low_limb >> tnc;
- high_limb = low_limb << cnt;
- for (i = n - 1; i != 0; i--)
- {
- low_limb = *up++;
- *rp++ = ~(high_limb | (low_limb >> tnc));
- high_limb = low_limb << cnt;
- }
- return retval;
- }
- int
- main ()
- {
- unsigned long cy, rp[2], up[2];
- up[0] = ~ 0L;
- up[1] = 0;
- cy = lshift_com (rp, up, 2L, 1);
- if (cy != 1L)
- return 1;
- return 0;
- }
- #else
- int
- main ()
- {
- return 0;
- }
- #endif
- EOF
- echo "Test compile: mpn_lshift_com optimization" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, mpn_lshift_com optimization"
- ;;
- norun)
- gmp_prog_cc_works="no, mpn_lshift_com optimization, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following is mis-compiled by Intel ia-64 icc version 1.8 under
- "icc -O3", After several calls, the function writes parial garbage to
- the result vector. Perhaps relates to the chk.a.nc insn. This code needs
- to be run to show the problem, but that's fine, the offending cc is a
- native-only compiler so we don't have to worry about cross compiling. */
- #if ! defined (__cplusplus)
- #include <stdlib.h>
- void
- lshift_com (rp, up, n, cnt)
- unsigned long *rp;
- unsigned long *up;
- long n;
- unsigned cnt;
- {
- unsigned long high_limb, low_limb;
- unsigned tnc;
- long i;
- up += n;
- rp += n;
- tnc = 8 * sizeof (unsigned long) - cnt;
- low_limb = *--up;
- high_limb = low_limb << cnt;
- for (i = n - 1; i != 0; i--)
- {
- low_limb = *--up;
- *--rp = ~(high_limb | (low_limb >> tnc));
- high_limb = low_limb << cnt;
- }
- *--rp = ~high_limb;
- }
- int
- main ()
- {
- unsigned long *r, *r2;
- unsigned long a[88 + 1];
- long i;
- for (i = 0; i < 88 + 1; i++)
- a[i] = ~0L;
- r = malloc (10000 * sizeof (unsigned long));
- r2 = r;
- for (i = 0; i < 528; i += 22)
- {
- lshift_com (r2, a,
- i / (8 * sizeof (unsigned long)) + 1,
- i % (8 * sizeof (unsigned long)));
- r2 += 88 + 1;
- }
- if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 ||
- r[2052] != 0 || r[2053] != 0 || r[2054] != 0)
- abort ();
- return 0;
- }
- #else
- int
- main ()
- {
- return 0;
- }
- #endif
- EOF
- echo "Test compile: mpn_lshift_com optimization 2" >&5
- gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, mpn_lshift_com optimization 2"
- ;;
- norun)
- gmp_prog_cc_works="no, mpn_lshift_com optimization 2, program does not run"
- ;;
- esac
- fi
- # A certain _GLOBAL_OFFSET_TABLE_ problem in past versions of gas, tickled
- # by recent versions of gcc.
- #
- if test "$gmp_prog_cc_works" = yes; then
- case $host in
- i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*)
- # this problem only arises in PIC code, so don't need to test when
- # --disable-shared. We don't necessarily have $enable_shared set to
- # yes at this point, it will still be unset for the default (which is
- # yes); hence the use of "!= no".
- if test "$enable_shared" != no; then
- echo "Testing gcc GOT with eax emitted" >&5
- cat >conftest.c <<EOF
- int foo;
- int bar () { return foo; }
- EOF
- tmp_got_emitted=no
- gmp_compile="$cc $cflags $cppflags -fPIC -S conftest.c >&5 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- if grep "addl.*_GLOBAL_OFFSET_TABLE_.*eax" conftest.s >/dev/null; then
- tmp_got_emitted=yes
- fi
- fi
- rm -f conftest.*
- echo "Result: $tmp_got_emitted" >&5
- if test "$tmp_got_emitted" = yes; then
- echo "Testing gas GOT with eax good" >&5
- cat >conftest.awk <<EOF
- BEGIN {
- want[0] = "001"
- want[1] = "043"
- want[2] = "105"
- want[3] = "147"
- want[4] = "211"
- want[5] = "253"
- want[6] = "315"
- want[7] = "357"
- want[8] = "005"
- want[9] = "002"
- want[10] = "000"
- want[11] = "000"
- want[12] = "000"
- want[13] = "376"
- want[14] = "334"
- want[15] = "272"
- want[16] = "230"
- want[17] = "166"
- want[18] = "124"
- want[19] = "062"
- want[20] = "020"
- result = "yes"
- }
- {
- for (f = 2; f <= NF; f++)
- {
- for (i = 0; i < 20; i++)
- got[i] = got[i+1];
- got[20] = $f;
- found = 1
- for (i = 0; i < 21; i++)
- if (got[i] != want[i])
- {
- found = 0
- break
- }
- if (found)
- {
- result = "no"
- exit
- }
- }
- }
- END {
- print result
- }
- EOF
- cat >conftest.s <<EOF
- .text
- .byte 1, 35, 69, 103, 137, 171, 205, 239
- addl $_GLOBAL_OFFSET_TABLE_, %eax
- .byte 254, 220, 186, 152, 118, 84, 50, 16
- EOF
- tmp_got_good=yes
- gmp_compile="$cc $cflags $cppflags -fPIC -o conftest.o -c conftest.s >&5 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- tmp_got_good=`od -b conftest.o | $AWK -f conftest.awk`
- fi
- rm -f conftest.*
- echo "Result: $tmp_got_good" >&5
- if test "$tmp_got_good" = no; then
- gmp_prog_cc_works="no, bad gas GOT with eax"
- else
- :
- fi
- else
- :
- fi
- fi
- ;;
- esac
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cc_works" >&5
- $as_echo "$gmp_prog_cc_works" >&6; }
- case $gmp_prog_cc_works in
- yes)
- ;;
- *)
- continue
- ;;
- esac
- # If we're supposed to be using a "long long" for a limb, check that
- # it works.
- eval limb_chosen="$limb$abi1"
- test -n "$limb_chosen" || eval limb_chosen="$limb$abi2"
- if test "$limb_chosen" = longlong; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags has long long" >&5
- $as_echo_n "checking compiler $cc $cflags $cppflags has long long... " >&6; }
- cat >conftest.c <<EOF
- long long foo;
- long long bar () { return foo; }
- int main () { return 0; }
- EOF
- gmp_prog_cc_works=no
- gmp_compile="$cc $cflags $cppflags -c conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- gmp_prog_cc_works=yes
- else
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cc_works" >&5
- $as_echo "$gmp_prog_cc_works" >&6; }
- if test $gmp_prog_cc_works = yes; then
- :
- else
- continue
- fi
- fi
- # The tests to perform on this $cc, if any
- eval testlist="$${ccbase}${abi1}_testlist"
- test -n "$testlist" || eval testlist="$${ccbase}${abi2}_testlist"
- test -n "$testlist" || eval testlist="$any${abi1}_testlist"
- test -n "$testlist" || eval testlist="$any${abi2}_testlist"
- testlist_pass=yes
- for tst in $testlist; do
- case $tst in
- hpc-hppa-2-0) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether HP compiler $cc is good for 64-bits" >&5
- $as_echo_n "checking whether HP compiler $cc is good for 64-bits... " >&6; }
- # Bad compiler output:
- # ccom: HP92453-01 G.10.32.05 HP C Compiler
- # Good compiler output:
- # ccom: HP92453-01 A.10.32.30 HP C Compiler
- # Let A.10.32.30 or higher be ok.
- echo >conftest.c
- gmp_tmp_vs=`$cc -V -c -o conftest.$OBJEXT conftest.c 2>&1 | grep "^ccom:"`
- echo "Version string: $gmp_tmp_vs" >&5
- rm conftest*
- gmp_tmp_v1=`echo $gmp_tmp_vs | sed 's/.* ..([0-9]*).*/1/'`
- gmp_tmp_v2=`echo $gmp_tmp_vs | sed 's/.* ...*.(.*)..* HP C.*/1/'`
- gmp_tmp_v3=`echo $gmp_tmp_vs | sed 's/.* ...*..*.(.*) HP C.*/1/'`
- echo "Version number: $gmp_tmp_v1.$gmp_tmp_v2.$gmp_tmp_v3" >&5
- if test -z "$gmp_tmp_v1"; then
- gmp_hpc_64bit=not-applicable
- else
- gmp_compare_ge=no
- if test -n "$gmp_tmp_v1"; then
- if test "$gmp_tmp_v1" -gt 10; then
- gmp_compare_ge=yes
- else
- if test "$gmp_tmp_v1" -eq 10; then
- if test -n "$gmp_tmp_v2"; then
- if test "$gmp_tmp_v2" -gt 32; then
- gmp_compare_ge=yes
- else
- if test "$gmp_tmp_v2" -eq 32; then
- if test -n "$gmp_tmp_v3" && test "$gmp_tmp_v3" -ge 30; then
- gmp_compare_ge=yes
- fi
- fi
- fi
- fi
- fi
- fi
- fi
- gmp_hpc_64bit=$gmp_compare_ge
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_hpc_64bit" >&5
- $as_echo "$gmp_hpc_64bit" >&6; }
- if test $gmp_hpc_64bit = yes; then
- :
- else
- testlist_pass=no
- fi
- ;;
- gcc-arm-umodsi) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ARM gcc unsigned division works" >&5
- $as_echo_n "checking whether ARM gcc unsigned division works... " >&6; }
- tmp_version=`$cc --version`
- echo "$tmp_version" >&5
- case $tmp_version in
- 2.95 | 2.95.[123])
- testlist_pass=no
- gmp_gcc_arm_umodsi_result="no, gcc 2.95.[0123]" ;;
- *)
- :
- gmp_gcc_arm_umodsi_result=yes ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_gcc_arm_umodsi_result" >&5
- $as_echo "$gmp_gcc_arm_umodsi_result" >&6; }
- ;;
- gcc-mips-o32) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc supports o32" >&5
- $as_echo_n "checking whether gcc supports o32... " >&6; }
- echo 'int x;' >conftest.c
- echo "$cc -mabi=32 -c conftest.c" >&5
- if $cc -mabi=32 -c conftest.c >conftest.out 2>&1; then
- result=yes
- else
- cat conftest.out >&5
- if grep "cc1: Invalid option `abi=32'" conftest.out >/dev/null; then
- result=yes
- else
- result=no
- fi
- fi
- rm -f conftest.*
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test $result = yes; then
- :
- else
- testlist_pass=no
- fi
- ;;
- hppa-level-2.0) { $as_echo "$as_me:${as_lineno-$LINENO}: checking $cc $cflags assembler knows hppa 2.0" >&5
- $as_echo_n "checking $cc $cflags assembler knows hppa 2.0... " >&6; }
- result=no
- cat >conftest.s <<EOF
- .level 2.0
- EOF
- gmp_compile="$cc $cflags -c conftest.s >&5 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- result=yes
- else
- echo "failed program was" >&5
- cat conftest.s >&5
- fi
- rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test "$result" = yes; then
- :
- else
- testlist_pass=no
- fi
- ;;
- sizeof*) echo "configure: testlist $tst" >&5
- gmp_sizeof_type=`echo "$tst" | sed 's/sizeof-([a-z]*).*/1/'`
- gmp_sizeof_want=`echo "$tst" | sed 's/sizeof-[a-z]*-([0-9]*).*/1/'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want" >&5
- $as_echo_n "checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want... " >&6; }
- cat >conftest.c <<EOF
- int
- main ()
- {
- static int test_array [1 - 2 * (long) (sizeof ($gmp_sizeof_type) != $gmp_sizeof_want)];
- test_array[0] = 0;
- return 0;
- }
- EOF
- gmp_c_testlist_sizeof=no
- gmp_compile="$cc $cflags -c conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- gmp_c_testlist_sizeof=yes
- fi
- rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_c_testlist_sizeof" >&5
- $as_echo "$gmp_c_testlist_sizeof" >&6; }
- if test $gmp_c_testlist_sizeof = yes; then
- :
- else
- testlist_pass=no
- fi
- ;;
- esac
- if test $testlist_pass = no; then break; fi
- done
- if test $testlist_pass = yes; then
- found_compiler=yes
- break
- fi
- done
- if test $found_compiler = yes; then break; fi
- done
- if test $found_compiler = yes; then break; fi
- done
- if test $found_compiler = yes; then break; fi
- done
- # If we recognised the CPU, as indicated by $path being set, then insist
- # that we have a working compiler, either from our $cclist choices or from
- # $CC. We can't let AC_PROG_CC look around for a compiler because it might
- # find one that we've rejected (for not supporting the modes our asm code
- # demands, etc).
- #
- # If we didn't recognise the CPU (and this includes host_cpu=none), then
- # fall through and let AC_PROG_CC look around for a compiler too. This is
- # mostly in the interests of following a standard autoconf setup, after all
- # we've already tested cc and gcc adequately (hopefully). As of autoconf
- # 2.50 the only thing AC_PROG_CC really adds is a check for "cl" (Microsoft
- # C on MS-DOS systems).
- #
- if test $found_compiler = no && test -n "$path"; then
- as_fn_error "could not find a working compiler, see config.log for details" "$LINENO" 5
- fi
- case $host in
- i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | athlon64-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei-*-* | x86_64-*-* | nano-*-*)
- # If the user asked for a fat build, override the path and flags set above
- if test $enable_fat = yes; then
- gcc_cflags_cpu=""
- gcc_cflags_arch=""
- if test "$abi" = 32; then
- extra_functions="$extra_functions fat fat_entry"
- path="x86/fat x86"
- fat_path="x86 x86/fat x86/i486
- x86/k6 x86/k6/mmx x86/k6/k62mmx
- x86/k7 x86/k7/mmx
- x86/pentium x86/pentium/mmx
- x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
- x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2"
- fi
- if test "$abi" = 64; then
- gcc_64_cflags=""
- extra_functions_64="$extra_functions_64 fat fat_entry"
- path_64="x86_64/fat x86_64"
- fat_path="x86_64 x86_64/fat x86_64/pentium4 x86_64/core2 x86_64/corei x86_64/atom x86_64/nano"
- fi
- fat_functions="add_n addmul_1 copyd copyi
- dive_1 diveby3 divrem_1 gcd_1 lshift
- mod_1 mod_34lsub1 mode1o mul_1 mul_basecase
- pre_divrem_1 pre_mod_1 rshift
- sqr_basecase sub_n submul_1"
- fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD
- SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD"
- fi
- ;;
- esac
- if test $found_compiler = yes; then
- # If we're creating CFLAGS, then look for optional additions. If the user
- # set CFLAGS then leave it alone.
- #
- if test "$test_CFLAGS" != set; then
- eval optlist="$${ccbase}${abi1}_cflags_optlist"
- test -n "$optlist" || eval optlist="$${ccbase}${abi2}_cflags_optlist"
- for opt in $optlist; do
- eval optflags="$${ccbase}${abi1}_cflags_${opt}"
- test -n "$optflags" || eval optflags="$${ccbase}${abi2}_cflags_${opt}"
- test -n "$optflags" || eval optflags="$${ccbase}_cflags_${opt}"
- for flag in $optflags; do
- # ~ represents a space in an option spec
- flag=`echo "$flag" | tr '~' ' '`
- case $flag in
- -march=pentium4 | -march=k8)
- # For -march settings which enable SSE2 we exclude certain bad
- # gcc versions and we need an OS knowing how to save xmm regs.
- #
- # This is only for ABI=32, any 64-bit gcc is good and any OS
- # knowing x86_64 will know xmm.
- #
- # -march=k8 was only introduced in gcc 3.3, so we shouldn't need
- # the GMP_GCC_PENTIUM4_SSE2 check (for gcc 3.2 and prior). But
- # it doesn't hurt to run it anyway, sharing code with the
- # pentium4 case.
- #
- if test "$abi" = 32; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc is good for sse2" >&5
- $as_echo_n "checking whether gcc is good for sse2... " >&6; }
- case `$cc $cflags $cppflags -dumpversion` in
- 3.[012] | 3.[012].*) result=no ;;
- *) result=yes ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test "$result" = yes; then
- :
- else
- continue
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the operating system supports XMM registers" >&5
- $as_echo_n "checking whether the operating system supports XMM registers... " >&6; }
- if test "${gmp_cv_os_x86_xmm+set}" = set; then :
- $as_echo_n "(cached) " >&6
- else
- if test "$build" = "$host"; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.s <<EOF
- .text
- main:
- _main:
- .globl main
- .globl _main
- .byte 0x0f, 0x57, 0xc0
- xorl %eax, %eax
- ret
- EOF
- gmp_compile="$cc $cflags $cppflags conftest.s -o conftest >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- gmp_cv_os_x86_xmm=yes
- else
- gmp_cv_os_x86_xmm=no
- fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Oops, cannot compile test program" >&5
- $as_echo "$as_me: WARNING: Oops, cannot compile test program" >&2;}
- fi
- rm -f conftest*
- fi
- if test -z "$gmp_cv_os_x86_xmm"; then
- case $host_os in
- freebsd[123] | freebsd[123].*)
- gmp_cv_os_x86_xmm=no ;;
- freebsd*)
- gmp_cv_os_x86_xmm=yes ;;
- *)
- gmp_cv_os_x86_xmm=probably ;;
- esac
- fi
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_os_x86_xmm" >&5
- $as_echo "$gmp_cv_os_x86_xmm" >&6; }
- if test "$gmp_cv_os_x86_xmm" = probably; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not certain of OS support for xmm when cross compiling." >&5
- $as_echo "$as_me: WARNING: Not certain of OS support for xmm when cross compiling." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&5
- $as_echo "$as_me: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&2;}
- fi
- case $gmp_cv_os_x86_xmm in
- no)
- continue
- ;;
- *)
- ;;
- esac
- fi
- ;;
- -no-cpp-precomp)
- # special check, avoiding a warning
- if test "$ccbase" = gcc; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags -no-cpp-precomp" >&5
- $as_echo_n "checking compiler $cc $cflags -no-cpp-precomp... " >&6; }
- result=no
- cat >conftest.c <<EOF
- int main () { return 0; }
- EOF
- gmp_compile="$cc $cflags -no-cpp-precomp conftest.c >conftest.out 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- if grep "unrecognized option.*-no-cpp-precomp" conftest.out >/dev/null; then : ;
- else
- result=yes
- fi
- fi
- cat conftest.out >&5
- rm -f conftest* a.out b.out a.exe a_out.exe
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test "$result" = yes; then
- cflags="$cflags $flag"
- break
- else
- continue
- fi
- fi
- ;;
- -Wa,-m*)
- case $host in
- alpha*-*-*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler $cc $cflags $flag" >&5
- $as_echo_n "checking assembler $cc $cflags $flag... " >&6; }
- result=no
- cat >conftest.c <<EOF
- int main () {}
- EOF
- gmp_compile="$cc $cflags $flag -c conftest.c >conftest.out 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- if grep "Unknown CPU identifier" conftest.out >/dev/null; then : ;
- else
- result=yes
- fi
- fi
- cat conftest.out >&5
- rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test "$result" = yes; then
- :
- else
- continue
- fi
- ;;
- esac
- ;;
- -Wa,-oldas)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $cc $cflags $cppflags -Wa,-oldas" >&5
- $as_echo_n "checking for $cc $cflags $cppflags -Wa,-oldas... " >&6; }
- result=no
- cat >conftest.c <<EOF
- EOF
- echo "with empty conftest.c" >&5
- gmp_compile="$cc $cflags $cppflags -c conftest.c >&5 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then : ;
- else
- # empty fails
- gmp_compile="$cc $cflags $cppflags -Wa,-oldas -c conftest.c >&5 2>&1"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- # but with -Wa,-oldas it works
- result=yes
- fi
- fi
- rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
- $as_echo "$result" >&6; }
- if test "$result" = yes; then
- cflags="$cflags $flag"
- break
- else
- continue
- fi
- ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags $flag" >&5
- $as_echo_n "checking compiler $cc $cflags $cppflags $flag... " >&6; }
- gmp_prog_cc_works=yes
- # first see a simple "main()" works, then go on to other checks
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- int main () { return 0; }
- EOF
- echo "Test compile: " >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no"
- ;;
- norun)
- gmp_prog_cc_works="no, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal error from gcc 2.95.2 -mpowerpc64
- (without -maix64), hence detecting an unusable compiler */
- void *g() { return (void *) 0; }
- void *f() { return g(); }
- int main () { return 0; }
- EOF
- echo "Test compile: function pointer return" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, function pointer return"
- ;;
- norun)
- gmp_prog_cc_works="no, function pointer return, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an invalid instruction syntax from i386 gcc
- -march=pentiumpro on Solaris 2.8. The native sun assembler
- requires a non-standard syntax for cmov which gcc (as of 2.95.2 at
- least) doesn't know. */
- int n;
- int cmov () { return (n >= 0 ? n : 0); }
- int main () { return 0; }
- EOF
- echo "Test compile: cmov instruction" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, cmov instruction"
- ;;
- norun)
- gmp_prog_cc_works="no, cmov instruction, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes a linker invocation problem with gcc 3.0.3
- on AIX 4.3 under "-maix64 -mpowerpc64 -mcpu=630". The -mcpu=630
- option causes gcc to incorrectly select the 32-bit libgcc.a, not
- the 64-bit one, and consequently it misses out on the __fixunsdfdi
- helper (double -> uint64 conversion). */
- double d;
- unsigned long gcc303 () { return (unsigned long) d; }
- int main () { return 0; }
- EOF
- echo "Test compile: double -> ulong conversion" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double -> ulong conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, double -> ulong conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an error from hppa gcc 2.95 under -mpa-risc-2-0 if
- the assembler doesn't know hppa 2.0 instructions. fneg is a 2.0
- instruction, and a negation like this comes out using it. */
- double fneg_data;
- unsigned long fneg () { return -fneg_data; }
- int main () { return 0; }
- EOF
- echo "Test compile: double negation" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double negation"
- ;;
- norun)
- gmp_prog_cc_works="no, double negation, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following makes gcc 3.3 -march=pentium4 generate an SSE2 xmm insn
- (cvtsd2ss) which will provoke an error if the assembler doesn't recognise
- those instructions. Not sure how much of the gmp code will come out
- wanting sse2, but it's easiest to reject an option we know is bad. */
- double ftod_data;
- float ftod () { return (float) ftod_data; }
- int main () { return 0; }
- EOF
- echo "Test compile: double -> float conversion" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, double -> float conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, double -> float conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error from gcc version
- "2.9-gnupro-99r1" under "-O2 -mcpu=ev6", apparently relating to char
- values being spilled into floating point registers. The problem doesn't
- show up all the time, but has occurred enough in GMP for us to reject
- this compiler+flags. */
- #include <string.h> /* for memcpy */
- struct try_t
- {
- char dst[2];
- char size;
- long d0, d1, d2, d3, d4, d5, d6;
- char overlap;
- };
- struct try_t param[6];
- int
- param_init ()
- {
- struct try_t *p;
- memcpy (p, ¶m[ 2 ], sizeof (*p));
- memcpy (p, ¶m[ 2 ], sizeof (*p));
- p->size = 2;
- memcpy (p, ¶m[ 1 ], sizeof (*p));
- p->dst[0] = 1;
- p->overlap = 2;
- memcpy (p, ¶m[ 3 ], sizeof (*p));
- p->dst[0] = 1;
- p->overlap = 8;
- memcpy (p, ¶m[ 4 ], sizeof (*p));
- memcpy (p, ¶m[ 4 ], sizeof (*p));
- p->overlap = 8;
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- memcpy (p, ¶m[ 5 ], sizeof (*p));
- return 0;
- }
- int main () { return 0; }
- EOF
- echo "Test compile: gnupro alpha ev6 char spilling" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, gnupro alpha ev6 char spilling"
- ;;
- norun)
- gmp_prog_cc_works="no, gnupro alpha ev6 char spilling, program does not run"
- ;;
- esac
- fi
- # __builtin_alloca is not available everywhere, check it exists before
- # seeing that it works
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- int k; int foo () { __builtin_alloca (k); }
- EOF
- echo "Test compile: __builtin_alloca availability" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error from Itanium HP-UX cc
- under +O2 or higher. We use this sort of code in mpn/generic/mul_fft.c. */
- int k;
- int foo ()
- {
- int i, **a;
- a = __builtin_alloca (k);
- for (i = 0; i <= k; i++)
- a[i] = __builtin_alloca (1 << i);
- }
- int main () { return 0; }
- EOF
- echo "Test compile: alloca array" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, alloca array"
- ;;
- norun)
- gmp_prog_cc_works="no, alloca array, program does not run"
- ;;
- esac
- fi
- ;;
- no)
- ;;
- norun)
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal error from the assembler on
- power2-ibm-aix4.3.1.0. gcc -mrios2 compiles to nabs+fcirz, and this
- results in "Internal error related to the source program domain".
- For reference it seems to be the combination of nabs+fcirz which is bad,
- not either alone. This sort of thing occurs in mpz/get_str.c with the
- way double chars_per_bit_exactly is applied in MPN_SIZEINBASE. Perhaps
- if that code changes to a scaled-integer style then we won't need this
- test. */
- double fp[1];
- int x;
- int f ()
- {
- int a;
- a = (x >= 0 ? x : -x);
- return a * fp[0];
- }
- int main () { return 0; }
- EOF
- echo "Test compile: abs int -> double conversion" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, abs int -> double conversion"
- ;;
- norun)
- gmp_prog_cc_works="no, abs int -> double conversion, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes a segfault in the compiler on powerpc-apple-darwin.
- Extracted from tests/mpn/t-iord_u.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to segfault with e.g., -O2 -mpowerpc64. */
- #if defined (__GNUC__) && ! defined (__cplusplus)
- typedef unsigned long long t1;typedef t1*t2;
- static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
- {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
- f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
- for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
- h(){}g(){}
- #else
- int dummy;
- #endif
- int main () { return 0; }
- EOF
- echo "Test compile: long long reliability test 1" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, long long reliability test 1"
- ;;
- norun)
- gmp_prog_cc_works="no, long long reliability test 1, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following provokes an internal compiler error on powerpc-apple-darwin.
- Extracted from mpz/cfdiv_q_2exp.c. Causes Apple's gcc 3.3 build 1640 and
- 1666 to get an ICE with -O1 -mpowerpc64. */
- #if defined (__GNUC__) && ! defined (__cplusplus)
- f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
- g(){}
- #else
- int dummy;
- #endif
- int main () { return 0; }
- EOF
- echo "Test compile: long long reliability test 2" >&5
- gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo ""$as_me":${as_lineno-$LINENO}: "$gmp_compile""; } >&5
- (eval $gmp_compile) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; then
- cc_works_part=yes
- if test "$cross_compiling" = no; then
- if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo ""$as_me":${as_lineno-$LINENO}: "$ac_try""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: $? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
- else
- cc_works_part=norun
- fi
- fi
- else
- cc_works_part=no
- fi
- if test "$cc_works_part" != yes; then
- echo "failed program was:" >&5
- cat conftest.c >&5
- fi
- rm -f conftest* a.out b.out a.exe a_out.exe
- case $cc_works_part in
- yes)
- ;;
- no)
- gmp_prog_cc_works="no, long long reliability test 2"
- ;;
- norun)
- gmp_prog_cc_works="no, long long reliability test 2, program does not run"
- ;;
- esac
- fi
- if test "$gmp_prog_cc_works" = yes; then
- # remove anything that might look like compiler output to our "||" expression
- rm -f conftest* a.out b.out a.exe a_out.exe
- cat >conftest.c <<EOF
- /* The following is mis-compiled by HP ia-64 cc version
- cc: HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]
- under "cc +O3", both in +DD32 and +DD64 modes. The mpn_lshift_com gets
- inlined and its return value somehow botched to be 0 instead of 1. This
- arises in the real mpn_lshift_com in mul_fft.c. A lower optimization
- level, like +O2 seems ok. This code needs to be run to show the problem,
- but that's fine, the offending cc is a native-only compiler so we don't
- have to worry about cross compiling. */
- #if ! defined (__cplusplus)
- unsigned long
- lshift_com (rp, up, n, cnt)
- unsigned long *rp;
- unsigned long *up;
- long n;
- unsigned cnt;
- {
- unsigned long retval, high_limb, low_limb;
- unsigned tnc;
- long i;
- tnc = 8 * sizeof (unsigned long) - cnt;
- low_limb = *up++;
- retval = low_limb >> tnc;
- high_limb = low_limb << cnt;
- for (i = n - 1; i != 0; i--)
- {
- low_limb = *up++;
- *rp++ = ~(high_limb | (low_limb >> tnc));
- high_limb = low_limb << cnt;
- }
- return retval;
- }
- int
- main ()