=================================================================== RCS file: /home/cvs/OpenXM_contrib/gmp/Attic/configure.in,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.2 diff -u -p -r1.1.1.1 -r1.1.1.2 --- OpenXM_contrib/gmp/Attic/configure.in 2000/01/10 15:35:21 1.1.1.1 +++ OpenXM_contrib/gmp/Attic/configure.in 2000/09/09 14:12:14 1.1.1.2 @@ -1,35 +1,941 @@ -# This file is a shell script fragment that supplies the information -# necessary for a configure script to process the program in -# this directory. For more information, look at ../configure. +dnl Process this file with autoconf to produce a configure script. -configdirs="mpn mpz mpf mpq mpbsd" -srctrigger=gmp-impl.h -srcname="GNU Multi-Precision library" -# per-host: +dnl Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +dnl +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU Lesser General Public License as published +dnl by the Free Software Foundation; either version 2.1 of the License, or (at +dnl your option) any later version. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +dnl License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public License +dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +dnl MA 02111-1307, USA. -# per-target: -case "${target}" in - sparc8* | microsparc*) - if [ x$with_gcc != xno ] - then - target_makefile_frag=config/mt-sprc8-gcc +AC_REVISION($Revision: 1.1.1.2 $)dnl +AC_PREREQ(2.14)dnl +AC_INIT(gmp-impl.h) + +dnl Check system. +AC_CANONICAL_SYSTEM + +dnl Automake +AM_INIT_AUTOMAKE(gmp, GMP_VERSION) +AM_CONFIG_HEADER(config.h:config.in) +AM_MAINTAINER_MODE + +dnl GMP specific +GMP_INIT(config.m4) + + +AC_ARG_ENABLE(assert, +AC_HELP_STRING([--enable-assert],[enable ASSERT checking [default=no]]), +[case "${enableval}" in +yes|no) ;; +*) AC_MSG_ERROR([bad value ${enableval} for --enable-assert, need yes or no]) ;; +esac], +[enable_assert=no]) + +if test "$enable_assert" = "yes"; then + AC_DEFINE(WANT_ASSERT,1, + [./configure --enable-assert option, to enable some ASSERT()s]) +fi + + +AC_ARG_ENABLE(alloca, +AC_HELP_STRING([--enable-alloca],[use alloca for temp space [default=yes]]), +[case "${enableval}" in +yes|no) ;; +*) AC_MSG_ERROR([bad value ${enableval} for --enable-alloca, need yes or no]) ;; +esac], +[enable_alloca=yes]) + +if test "$enable_alloca" = "no"; then + AC_DEFINE(USE_STACK_ALLOC,1, + [./configure --disable-alloca option, to use stack-alloc.c, not alloca]) +fi + + +AC_ARG_ENABLE(fft, +AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [default=no]]), +[case "${enableval}" in +yes|no) ;; +*) AC_MSG_ERROR([bad value ${enableval} for --enable-fft, need yes or no]) ;; +esac], +[enable_fft=no]) + +if test "$enable_fft" = "yes"; then + AC_DEFINE(WANT_FFT,1, + [./configure --enable-fft option, to enable FFTs for multiplication]) +fi + + +AC_ARG_ENABLE(mpbsd, +AC_HELP_STRING([--enable-mpbsd],[build Berkley MP compatibility library [default=no]]), +[case "${enableval}" in +yes|no) ;; +*) AC_MSG_ERROR([bad value ${enableval} for --enable-mpbsd, need yes or no]) ;; +esac], +[enable_mpbsd=no]) +AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes") + + +AC_ARG_ENABLE(mpfr, +AC_HELP_STRING([--enable-mpfr],[build MPFR [default=no]]), +[case "${enableval}" in +yes|no) ;; +*) AC_MSG_ERROR([bad value ${enableval} for --enable-mpfr, need yes or no]) ;; +esac], +[enable_mpfr=no]) +AM_CONDITIONAL(WANT_MPFR, test "$enable_mpfr" = "yes") + + +dnl Switch on OS and determine what compiler to use. +dnl +dnl os_64bit Set to "yes" if OS is 64-bit capable. +dnl FIXME: Rename to `check_64bit_compiler'! +dnl cclist List of compilers, best first. +dnl gmp_cflags_{cc} Flags for compiler named {cc}. +dnl gmp_cflags64_{cc} Flags for compiler named {cc} for 64-bit code. +dnl gmp_optcflags_{cc} Optional compiler flags. +dnl gmp_xoptcflags_{cc} Exclusive optional compiler flags. +dnl +os_64bit="no" +cclist="gcc cc" # FIXME: Prefer c89 to cc. +gmp_cflags_gcc="-g -O2" +gmp_cflags64_gcc="-g -O2" +gmp_cflags_cc="-g" +gmp_cflags64_cc="-g" + +case "$target" in + # Alpha + alpha*-cray-unicos*) + # Don't perform any assembly syntax tests on this beast. + gmp_no_asm_syntax_testing=yes + cclist=cc + gmp_cflags_cc="$gmp_cflags_cc -O" + ;; + alpha*-*-osf*) + flavour=`echo $target_cpu | sed 's/^alpha//g'` + if test -n "$flavour"; then + case $flavour in # compilers don't seem to understand `ev67' and such. + ev6? | ev7*) flavour=ev6;; + esac + gmp_optcflags_gcc="-mcpu=$flavour" + # FIXME: We shouldn't fail fatally if none of these work, but that's + # how xoptcflags work and we don't have any other mechanism right now. + # Why do we need this here and not for alpha*-*-* below? + gmp_xoptcflags_gcc="-Wa,-arch,${flavour} -Wa,-m${flavour}" + gmp_optcflags_cc="-arch $flavour -tune $flavour" fi ;; - supersparc*) - if [ x$with_gcc != xno ] - then - target_makefile_frag=config/mt-supspc-gcc + alpha*-*-*) + cclist="gcc" + flavour=`echo $target_cpu | sed 's/^alpha//g'` + if test -n "$flavour"; then + case $flavour in + ev6? | ev7*) flavour=ev6;; + esac + gmp_optcflags_gcc="-mcpu=$flavour" fi ;; - m888110*) - if [ x$with_gcc != xno ] - then - target_makefile_frag=config/mt-m88110 + # Cray vector machines. This must come after alpha* so that we can + # recognize present and future vector processors with a wildcard. + *-cray-unicos*) + # Don't perform any assembly syntax tests on this beast. + gmp_no_asm_syntax_testing=yes + cclist=cc + # Don't inherit default gmp_cflags_cc value; it comes with -g which + # disables all optimization on Cray vector systems + gmp_cflags_cc="-O" + ;; + + # AMD and Intel x86 configurations + [i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]) + # Rumour has it -O2 used to give worse register allocation than just -O. + gmp_cflags_gcc="-g -O -fomit-frame-pointer" + + case "${target}" in + i386*-*-*) gmp_optcflags_gcc="-mcpu=i386 -march=i386";; + i486*-*-*) gmp_optcflags_gcc="-mcpu=i486 -march=i486";; + i586*-*-* | pentium-*-* | pentiummmx-*-*) + gmp_optcflags_gcc="-mcpu=pentium -march=pentium";; + + # -march=pentiumpro not used because mpz/powm.c (swox cvs rev 1.4) + # tickles a bug in gcc 2.95.2 (believed fixed in 2.96). + [i686*-*-* | pentiumpro-*-* | pentium[23]-*-*]) + gmp_optcflags_gcc="-mcpu=pentiumpro";; + + k6*-*-*) gmp_optcflags_gcc="-mcpu=k6 -march=k6";; + + # Athlon instruction costs are close to p6: 3 cycle load latency, 4-6 + # cycle mul, 40 cycle div, pairable adc, ... + # FIXME: Change this when gcc gets something specific for Athlon. + # -march=pentiumpro not used, per i686 above. + athlon-*-*) gmp_optcflags_gcc="-mcpu=pentiumpro";; + esac + ;; + + # Sparc + [ultrasparc*-*-solaris2.[7-9] | sparcv9-*-solaris2.[7-9]]) + os_64bit=yes + gmp_cflags_gcc="$gmp_cflags_gcc -Wa,-xarch=v8plus" + gmp_xoptcflags_gcc="-mcpu=v9 -mcpu=v8 -mv8" + gmp_cflags64_gcc="$gmp_cflags64_gcc -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9" + gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4" + gmp_cflags64_cc="-xtarget=native -xarch=v9 -xO4" + ;; + sparc64-*-linux*) + os_64bit=yes + gmp_cflags64_gcc="$gmp_cflags64_gcc -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9" + gmp_cflags_gcc="$gmp_cflags_gcc -m32" + gmp_xoptflags_gcc="-mcpu=ultrasparc -mvis" + ;; + ultrasparc*-*-* | sparcv9-*-*) + gmp_cflags_gcc="$gmp_cflags_gcc -Wa,-xarch=v8plus" + gmp_xoptcflags_gcc="-mcpu=v9 -mcpu=v8 -mv8" + gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4" + ;; + sparcv8*-*-solaris2.* | microsparc*-*-solaris2.*) + gmp_cflags_gcc="$gmp_cflags_gcc" + gmp_xoptcflags_gcc="-mcpu=v8 -mv8" + gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4" + ;; + sparcv8*-*-* | microsparc*-*-*) # SunOS, Linux, *BSD + cclist="gcc acc cc" + gmp_cflags_gcc="$gmp_cflags_gcc" + gmp_xoptcflags_gcc="-mcpu=v8 -mv8" + gmp_cflags_acc="-g -O2 -cg92" + gmp_cflags_cc="-O2" # FIXME: Flag for v8? + ;; + supersparc*-*-solaris2.*) + gmp_cflags_gcc="$gmp_cflags_gcc -DSUPERSPARC" + gmp_xoptcflags_gcc="-mcpu=v8 -mv8" + gmp_cflags_cc="-xtarget=native -xarch=v8 -xO4 -DSUPERSPARC" + ;; + supersparc*-*-*) # SunOS, Linux, *BSD + cclist="gcc acc cc" + gmp_cflags_gcc="$gmp_cflags_gcc -DSUPERSPARC" + gmp_xoptcflags_gcc="-mcpu=v8 -mv8" + gmp_cflags_acc="-g -O2 -cg92 -DSUPERSPARC" + gmp_cflags_cc="-O2 -DSUPERSPARC" # FIXME: Flag for v8? + ;; + *sparc*-*-*) + cclist="gcc acc cc" + gmp_cflags_acc="-g -O2" + gmp_cflags_cc="-g -O2" + ;; + + # POWER/PowerPC + powerpc64-*-aix*) + cclist="gcc xlc" + gmp_cflags_gcc="$gmp_cflags_gcc -maix64 -mpowerpc64" + gmp_cflags_xlc="-g -O2 -q64 -qtune=pwr3" + ;; + powerpc*-*-aix*) + cclist="gcc xlc" + gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc" + gmp_cflags_xlc="$gmp_cflags_cc -qarch=ppc -O2" + ;; + power-*-aix*) + cclist="gcc xlc" + gmp_cflags_gcc="$gmp_cflags_gcc -mpower" + gmp_cflags_xlc="$gmp_cflags_cc -qarch=pwr -O2" + ;; + powerpc64*-*-*) + gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc64" + AC_DEFINE(_LONG_LONG_LIMB) dnl FIXME: Remove. + ;; + powerpc*-*-*) + gmp_cflags_gcc="$gmp_cflags_gcc -mpowerpc" + ;; + + # MIPS + mips-sgi-irix6.*) + os_64bit=yes + gmp_cflags64_gcc="-g -O2 -mabi=n32" + gmp_cflags64_cc="$gmp_cflags64_cc -O2 -n32" + ;; + + # Motorola 68k family + m88110*-*-*) + gmp_cflags_gcc="-g -O -m88110" dnl FIXME: Use `-O2'? + ;; + m68*-*-*) + gmp_cflags_gcc="$gmp_cflags_gcc -fomit-frame-pointer" + ;; + + # HP + hppa1.0*-*-*) + cclist="gcc c89 cc" + gmp_cflags_c89="$gmp_cflags_cc +O2" + gmp_cflags_cc="$gmp_cflags_cc +O2" + ;; + hppa2.0w*-*-*) + cclist="c89 cc" + gmp_cflags_c89="+DD64 +O3" + gmp_cflags_cc="+DD64 +O3" + ;; + hppa2.0*-*-*) + os_64bit=yes + cclist="gcc c89 cc" + gmp_cflags64_gcc="$gmp_cflags64_gcc -mWHAT -D_LONG_LONG_LIMB" + # +O2 to cc triggers bug in mpz/powm.c (1.4) + gmp_cflags64_c89="+DA2.0 +e +O3 -D_LONG_LONG_LIMB" + gmp_cflags64_cc="+DA2.0 +e +O3 -D_LONG_LONG_LIMB" + gmp_cflags_c89="$gmp_cflags_cc +O2" + gmp_cflags_cc="$gmp_cflags_cc +O2" + ;; + + # VAX + vax*-*-*) + gmp_cflags_gcc="$gmp_cflags_gcc -fomit-frame-pointer" + ;; + + # Fujitsu + [f30[01]-fujitsu-sysv*]) + cclist="gcc vcc" + gmp_cflags_vcc="-g" # FIXME: flags for vcc? + ;; +esac + +dnl Check for programs needed by macros for finding compiler. +dnl More programs are checked for below, when a compiler is found. +AC_PROG_NM dnl Macro from Libtool. +# nm on 64-bit AIX needs to know the object file format +case "$target" in + powerpc64*-*-aix*) + NM="$NM -X 64" + ;; +esac + +# Save CFLAGS given on command line. +gmp_user_CFLAGS="$CFLAGS" + +if test -z "$CC"; then + # Find compiler. + GMP_PROG_CC_FIND($cclist, $os_64bit) + + # If 64-bit OS and we have a 64-bit compiler, use it. + if test -n "$os_64bit" && test -n "$CC64"; then + CC=$CC64 + CFLAGS=$CFLAGS64 + else + eval CFLAGS=\$gmp_cflags_$CC + fi + + # Try compiler flags that may work with only some compiler versions. + # gmp_optcflags: All or nothing. + eval optcflags=\$gmp_optcflags_$CC + if test -n "$optcflags"; then + CFLAGS_save="$CFLAGS" + CFLAGS="$CFLAGS $optcflags" + AC_MSG_CHECKING([whether $CC accepts $optcflags]) + AC_LANG_C + AC_TRY_COMPILER([int main(){return(0);}], optok, cross) + if test "$optok" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + CFLAGS="$CFLAGS_save" fi + fi + # gmp_xoptcflags: First is best, one has to work. + eval xoptcflags=\$gmp_xoptcflags_$CC + if test -n "$xoptcflags"; then + gmp_found="no" + for xopt in $xoptcflags; do + CFLAGS_save="$CFLAGS" + CFLAGS="$CFLAGS $xopt" + AC_MSG_CHECKING([whether $CC accepts $xopt]) + AC_LANG_C + AC_TRY_COMPILER([int main(){return(0);}], optok, cross) + if test "$optok" = "yes"; then + AC_MSG_RESULT([yes]) + gmp_found="yes" + break + else + AC_MSG_RESULT([no]) + CFLAGS="$CFLAGS_save" + fi + done + if test "$gmp_found" = "no"; then + echo ["$0: fatal: need a compiler that understands one of $xoptcflags"] + exit 1 + fi + fi +fi + +# Restore CFLAGS given on command line. +# FIXME: We've run through quite some unnecessary code looking for a +# nice compiler and working flags for it, just to spoil that with user +# supplied flags. +test -n "$gmp_user_CFLAGS" && CFLAGS="$gmp_user_CFLAGS" + +# Select chosen compiler. +GMP_PROG_CC_SELECT + +# How to assemble. +CCAS="$CC -c" +AC_SUBST(CCAS) + +dnl Checks for programs. +dnl -------------------- +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +GMP_PROG_M4 +AC_CHECK_PROG(AR, ar, ar) +# ar on AIX needs to know the object file format +case "$target" in + powerpc64*-*-aix*) + AR="$AR -X 64" ;; - *-*-linux*) - target_makefile_frag=config/mt-linux ;; - +esac +dnl FIXME: Find good ld? /usr/ucb/ld on Solaris won't work. + +dnl Checks for assembly syntax. +if test "$gmp_no_asm_syntax_testing" != "yes"; then + GMP_CHECK_ASM_TEXT + GMP_CHECK_ASM_DATA + GMP_CHECK_ASM_GLOBL + GMP_CHECK_ASM_LABEL_SUFFIX + GMP_CHECK_ASM_TYPE + GMP_CHECK_ASM_SIZE + GMP_CHECK_ASM_LSYM_PREFIX + GMP_CHECK_ASM_W32 + GMP_CHECK_ASM_UNDERSCORE(underscore=yes, underscore=no) + GMP_CHECK_ASM_ALIGN_LOG(asm_align=log, asm_align=nolog) +fi + +dnl FIXME: Check for FPU and set `floating_point' appropriately. + +dnl ======================================== +dnl Configuring mpn. +dnl ---------------------------------------- +dnl Set the following target specific variables: +dnl path where to search for source files +dnl family processor family (Needed for building +dnl asm-syntax.h for now. FIXME: Remove.) +dnl extra_functions extra functions + +family=generic + +case ${target} in + arm*-*-*) + path="arm" + ;; + [sparcv9*-*-solaris2.[789]* | sparc64*-*-solaris2.[789]* | ultrasparc*-*-solaris2.[789]*]) + if test -n "$CC64"; then + path="sparc64" + else + path="sparc32/v9 sparc32/v8 sparc32" + fi + ;; + sparc64-*-linux*) + path="sparc64" + ;; + sparcv8*-*-* | microsparc*-*-*) + path="sparc32/v8 sparc32" + if test x${floating_point} = xno + then extra_functions="udiv_nfp" + else extra_functions="udiv_fp" + fi + ;; + sparcv9*-*-* | ultrasparc*-*-*) + path="sparc32/v9 sparc32/v8 sparc32" + extra_functions="udiv_fp" + ;; + supersparc*-*-*) + path="sparc32/v8/supersparc sparc32/v8 sparc32" + extra_functions="udiv" + ;; + sparc*-*-*) path="sparc32" + if test x${floating_point} = xno + then extra_functions="udiv_nfp" + else extra_functions="udiv_fp" + fi + ;; + hppa7000*-*-*) + path="hppa/hppa1_1 hppa" + extra_functions="udiv_qrnnd" + ;; + hppa1.0*-*-*) + path="hppa" + extra_functions="udiv_qrnnd" + ;; + hppa2.0w-*-*) + path="pa64w" + extra_functions="umul_ppmm udiv_qrnnd" + ;; + hppa2.0*-*-*) + if test -n "$CC64"; then + path="pa64" + extra_functions="umul_ppmm udiv_qrnnd" + # We need to use the system compiler, or actually the system assembler, + # since GAS has not been ported to understand the 2.0 instructions. + CCAS="$CC64 -c" + else + # FIXME: path should be "hppa/hppa2_0 hppa/hppa1_1 hppa" + path="hppa/hppa1_1 hppa" + extra_functions="udiv_qrnnd" + fi + ;; + hppa*-*-*) #assume pa7100 + path="hppa/hppa1_1/pa7100 hppa/hppa1_1 hppa" + extra_functions="udiv_qrnnd";; + [f30[01]-fujitsu-sysv*]) + path=fujitsu;; + alphaev6*-*-*) path="alpha/ev6 alpha"; extra_functions="invert_limb cntlz";; + alphaev5*-*-*) path="alpha/ev5 alpha"; extra_functions="invert_limb cntlz";; + alpha*-*-*) path="alpha"; extra_functions="invert_limb cntlz";; + # Cray vector machines. This must come after alpha* so that we can + # recognize present and future vector processors with a wildcard. + *-cray-unicos*) + path="cray" + extra_functions="mulww";; + am29000*-*-*) path="a29k";; + a29k*-*-*) path="a29k";; + + # AMD and Intel x86 configurations + + [i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]) + gmp_m4postinc="x86/x86-defs.m4" + extra_functions="udiv umul" + CALLING_CONVENTIONS_OBJS="x86call.o x86check.o" + + GMP_CHECK_ASM_SHLDL_CL( + [GMP_DEFINE(WANT_SHLDL_CL,1)], + [GMP_DEFINE(WANT_SHLDL_CL,0)]) + GMP_CHECK_ASM_ALIGN_FILL_0x90 + + # the CPUs below wanting to know about mmx + case ${target} in + [pentiummmx-*-* | pentium[23]-*-* | k6*-*-* | athlon-*-*]) + GMP_CHECK_ASM_MMX(tmp_mmx=yes, tmp_mmx=no) + ;; + esac + + # default for anything not otherwise mentioned + path="x86" + + case ${target} in + [i[34]86*-*-*]) + path="x86" + ;; + k5*-*-*) + # don't know what best suits k5 + path="x86" + ;; + i586*-*-* | pentium-*-*) + path="x86/pentium x86" + ;; + pentiummmx-*-*) + path="x86/pentium x86" + if test "$tmp_mmx" = yes; then + path="x86/pentium/mmx $path" + fi + ;; + i686*-*-* | pentiumpro-*-*) + path="x86/p6 x86" + ;; + pentium2-*-*) + path="x86/p6 x86" + # The pentium/mmx lshift and rshift are good on p6 and can be used + # until there's something specific for p6. + if test "$tmp_mmx" = yes; then + path="x86/p6/mmx x86/pentium/mmx $path" + fi + ;; + pentium3-*-*) + path="x86/p6 x86" + # The pentium/mmx lshift and rshift are good on p6 and can be used + # until there's something specific for p6. + if test "$tmp_mmx" = yes; then + path="x86/p6/p3mmx x86/p6/mmx x86/pentium/mmx $path" + fi + ;; + [k6[23]*-*-*]) + path="x86/k6 x86" + if test "$tmp_mmx" = yes; then + path="x86/k6/k62mmx x86/k6/mmx $path" + fi + ;; + k6*-*-*) + path="x86/k6 x86" + if test "$tmp_mmx" = yes; then + path="x86/k6/mmx $path" + fi + ;; + athlon-*-*) + path="x86/k7 x86" + if test "$tmp_mmx" = yes; then + path="x86/k7/mmx $path" + fi + ;; + esac + ;; + + + i960*-*-*) path="i960";; + + ia64*-*-*) path="ia64";; + +# Motorola 68k configurations. Let m68k mean 68020-68040. + [m680[234]0*-*-* | m68k*-*-* | \ + m68*-next-nextstep*]) # Nexts are at least '020 + path="m68k/mc68020 m68k" + family=m68k + ;; + m68000*-*-*) + path="m68k" + family=m68k + ;; + + m88k*-*-* | m88k*-*-*) path="m88k";; + m88110*-*-*) path="m88k/mc88110 m88k";; + ns32k*-*-*) path="ns32k";; + + pyramid-*-*) path="pyr";; + + ppc601-*-*) path="power powerpc32";; + powerpc64*-*-*) path="powerpc64";; + powerpc*-*-*) path="powerpc32";; + rs6000-*-* | power-*-* | power2-*-*) + path="power" + extra_functions="udiv_w_sdiv" + ;; + + sh-*-*) path="sh";; + sh2-*-*) path="sh/sh2 sh";; + + [mips[34]*-*-*]) path="mips3";; + mips*-*-irix6*) path="mips3";; + mips*-*-*) path="mips2";; + + vax*-*-*) path="vax"; extra_functions="udiv_w_sdiv";; + + z8000x*-*-*) path="z8000x"; extra_functions="udiv_w_sdiv";; + z8000*-*-*) path="z8000"; extra_functions="udiv_w_sdiv";; + + clipper*-*-*) path="clipper";; esac + +AC_SUBST(CALLING_CONVENTIONS_OBJS) +if test -n "$CALLING_CONVENTIONS_OBJS"; then + AC_DEFINE(HAVE_CALLING_CONVENTIONS,1, + [Define if mpn/tests has calling conventions checking for the CPU]) +fi + + +case ${target} in + [i[5-8]86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]) + # rdtsc is in pentium and up, not in i386 and i486 + SPEED_CYCLECOUNTER_OBJS=pentium.lo + ;; + alpha*-*-*) + SPEED_CYCLECOUNTER_OBJS=alpha.lo + ;; + sparcv9*-*-* | ultrasparc*-*-* | sparc64*-*-*) + SPEED_CYCLECOUNTER_OBJS=sparcv9.lo + ;; + hppa2*-*-*) + SPEED_CYCLECOUNTER_OBJS=hppa2.lo + ;; + hppa*-*-*) + SPEED_CYCLECOUNTER_OBJS=hppa.lo + ;; +esac + +AC_SUBST(SPEED_CYCLECOUNTER_OBJS) + +if test -n "$SPEED_CYCLECOUNTER_OBJS" +then + AC_DEFINE(HAVE_SPEED_CYCLECOUNTER, 1, + [Define if a speed_cyclecounter exists (for the tune programs)]) +fi + + +dnl Extensions for executable and object files. +dnl ------------------------------------------- +AC_EXEEXT +AC_OBJEXT + +dnl Use Libtool. +dnl ------------ +dnl FIXME: Shared libs seem to fail on aix4.3. +dnl FIXME: Should invoke [AC_DISABLE_SHARED], but m4 recurses to death. +case "$target" in + [*-*-aix4.[3-9]*]) enable_shared=no ;; +esac +AC_PROG_LIBTOOL + +dnl Checks for libraries. +dnl --------------------- +AC_CHECK_DECLS((optarg)) + +dnl Checks for header files. +dnl ------------------------ +AC_HEADER_STDC +AC_CHECK_HEADERS(getopt.h unistd.h sys/sysctl.h sys/time.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +dnl -------------------------------------------------------------- +AC_CHECK_TYPES((void)) +AC_C_STRINGIZE + +dnl Checks for library functions. +dnl ----------------------------- +dnl Most of these are only for the benefit of supplementary programs. The +dnl library itself doesn't use anything weird. +dnl AC_FUNC_MEMCMP +dnl AC_TYPE_SIGNAL +dnl AC_CHECK_FUNCS(strtol) +AC_CHECK_FUNCS(getopt_long getpagesize popen processor_info strtoul sysconf sysctlbyname) + +dnl Trick automake into thinking we've run AM_C_PROTOTYPES which it wants +dnl for ansi2knr, and instead use our own test. (It's only a warning +dnl automake prints, but it's good to suppress it.) +ifelse(0,1,[ +AM_C_PROTOTYPES +]) +GMP_C_ANSI2KNR + + +dnl Set `syntax' to one of , "mit", "elf", "aix", "macho". +syntax= +# For now, we use the old switch for setting syntax. +# FIXME: Remove when conversion to .asm is completed. +changequote(,)dnl +case "${target}" in + m680[234]0*-*-linuxaout* | m68k*-*-linuxaout* | \ + m68k-next-nextstep* | \ + m68000*-*-*) + syntax=mit + ;; + m680[234]0*-*-linux* | m68k*-*-linux*) + syntax=elf + ;; + m680[234]0*-*-* | m68k*-*-*) + syntax=mit + ;; +esac +changequote([,])dnl + +dnl ---------------------------------------- +# Now build an asm-syntax.h file for targets that include that from the +# assembly files. +# FIXME: Remove when conversion to .asm is completed. +case "${family}-${underscore}-${asm_align}-${syntax}" in + m68k-yes-log-mit) + echo '#define MIT_SYNTAX' >asm-syntax.h + cat $srcdir/mpn/underscore.h >>asm-syntax.h + echo '#include "'$srcdir'/mpn/m68k/syntax.h"' >>asm-syntax.h;; + m68k-no-nolog-elf) + echo '#define ELF_SYNTAX' >asm-syntax.h + echo '#define C_SYMBOL_NAME(name) name' >>asm-syntax.h + echo '#include "'$srcdir'/mpn/m68k/syntax.h"' >>asm-syntax.h;; +esac + + +# The pattern here tests for an absolute path the same way as +# _AC_OUTPUT_FILES in autoconf acgeneral.m4. +GMP_DEFINE_RAW(["dnl CONFIG_TOP_SRCDIR is a path from the mpn builddir to the top srcdir"]) +case "$srcdir" in +[[\\/]]* | ?:[[\\/]]* ) + GMP_DEFINE_RAW(["define(,<\`$srcdir'>)"]) ;; +*) GMP_DEFINE_RAW(["define(,<\`../$srcdir'>)"]) ;; +esac + +GMP_DEFINE_RAW(["include(CONFIG_TOP_SRCDIR\`/mpn/asm-defs.m4')"], POST) + +# Must be after asm-defs.m4 +GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_TARGET_CPU_$target_cpu')", POST) + + +dnl config.m4 post-includes +dnl ----------------------- +dnl (Note x86 post include set with $path above.) +changequote(,)dnl +case "$target" in + alpha*-cray-unicos*) + gmp_m4postinc="alpha/unicos.m4" + ;; + alpha*-*-*) + gmp_m4postinc="alpha/default.m4" + ;; + power*-*-*) + case "$target" in + *-*-mach* | *-*-rhapsody* | *-*-nextstep*) + ;; # these use non-conventional assembly syntax. + powerpc64-*-aix*) + gmp_m4postinc="powerpc32/regmap.m4 powerpc64/aix.m4" + ;; + *-*-aix*) + gmp_m4postinc="powerpc32/regmap.m4 powerpc32/aix.m4" + ;; + *) + gmp_m4postinc="powerpc32/regmap.m4" + ;; + esac + ;; +esac +changequote([, ])dnl + +for tmp_f in $gmp_m4postinc; do + GMP_DEFINE_RAW(["include_mpn(\`$tmp_f')"], POST) +done + + +# Set up `gmp_links'. It's a list of link:file pairs that configure will +# process to create link -> file. +gmp_links= + +# If the user specified `MPN_PATH', use that instead of the path we've +# come up with. +if test -z "$MPN_PATH"; then + path="$path generic" +else + path="$MPN_PATH" +fi + +# Pick the correct source files in $path and link them to mpn/. +# $gmp_mpn_functions lists all functions we need. +# +# The rule is to find a file with the function name and a .asm, .S, +# .s, or .c extension. Certain multi-function files with special names +# can provide some functions too. (mpn/Makefile.am passes +# -DOPERATION_ to get them to generate the right code.) + +# FIXME: udiv and umul aren't in $gmp_mpn_functions_optional yet since +# there's some versions of those files which should be checked for bit +# rot first. Put them in $extra_functions for each target for now, +# change to standard optionals when all are ready. + +# Note: The following lines defining $gmp_mpn_functions_optional +# and $gmp_mpn_functions are parsed by the "macos/configure" +# Perl script. So if you change the lines in a major way +# make sure to run and examine the output from +# +# % (cd macos; perl configure) + +gmp_mpn_functions_optional="copyi copyd com_n \ + and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n" + +gmp_mpn_functions="${extra_functions} inlines add_n sub_n mul_1 addmul_1 \ + submul_1 lshift rshift diveby3 divrem divrem_1 divrem_2 \ + mod_1 mod_1_rs pre_mod_1 dump \ + mul mul_fft mul_n mul_basecase sqr_basecase random \ + random2 sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \ + bdivmod gcd_1 gcd gcdext tdiv_qr bz_divrem_n sb_divrem_mn jacbase \ + $gmp_mpn_functions_optional" + +# the list of all object files used by mpn/Makefile.in and the +# top-level Makefile.in, respectively +mpn_objects= +mpn_objs_in_libgmp="mpn/mp_bases.lo" + +for tmp_fn in ${gmp_mpn_functions} ; do + [rm -f mpn/${tmp_fn}.[Ssc] mpn/${tmp_fn}.asm] + + # functions that can be provided by multi-function files + tmp_mulfunc= + case $tmp_fn in + add_n|sub_n) tmp_mulfunc="aors_n" ;; + addmul_1|submul_1) tmp_mulfunc="aorsmul_1" ;; + popcount|hamdist) tmp_mulfunc="popham" ;; + and_n|andn_n|nand_n | ior_n|iorn_n|nior_n | xor_n|xnor_n) + tmp_mulfunc="logops_n" ;; + esac + + found=no + for tmp_dir in $path; do + for tmp_base in $tmp_fn $tmp_mulfunc; do + for tmp_ext in asm S s c; do + tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext + if test -f $tmp_file; then + found=yes + + mpn_objects="$mpn_objects ${tmp_fn}.lo" + mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_fn}.lo" + gmp_links="$gmp_links mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext" + + # duplicate AC_DEFINEs are harmless, so it doesn't matter + # that multi-function files get grepped here repeatedly + gmp_ep=["` + sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ; + sed -n 's/^[ ]*PROLOGUE(\(.*\))/\1/p' $tmp_file + `"] + for gmp_tmp in $gmp_ep; do + AC_DEFINE_UNQUOTED(HAVE_NATIVE_${gmp_tmp}) + done + + break + fi + done + if test $found = yes; then break ; fi + done + if test $found = yes; then break ; fi + done + + if test $found = no; then + for tmp_optional in $gmp_mpn_functions_optional; do + if test $tmp_optional = $tmp_fn; then + found=yes + fi + done + if test $found = no; then + AC_MSG_ERROR([no version of $tmp_fn found in path: $path]) + fi + fi +done + +# Create link for gmp-mparam.h. +for tmp_dir in $path ; do + rm -f gmp-mparam.h + if test -f $srcdir/mpn/${tmp_dir}/gmp-mparam.h ; then + gmp_links="$gmp_links gmp-mparam.h:mpn/${tmp_dir}/gmp-mparam.h" + + # Copy any KARATSUBA_SQR_THRESHOLD in gmp-mparam.h to config.m4. + # Some versions of sqr_basecase.asm use this. + tmp_gmp_karatsuba_sqr_threshold="`sed -n 's/^#define KARATSUBA_SQR_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $srcdir/mpn/${tmp_dir}/gmp-mparam.h`" + if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then + GMP_DEFINE_RAW(["define(,<$tmp_gmp_karatsuba_sqr_threshold>)"]) + fi + + break + fi +done + +# Dig out the links from `gmp_links' for inclusion in DISTCLEANFILES. +gmp_srclinks= +for f in $gmp_links; do + gmp_srclinks="$gmp_srclinks `echo $f | sed 's/\(.*\):.*/\1/'`" +done + +AC_SUBST(mpn_objects) +AC_SUBST(mpn_objs_in_libgmp) +AC_SUBST(gmp_srclinks) + +dnl ---------------------------------------- +dnl Make links. +AC_CONFIG_LINKS($gmp_links) + +dnl Create config.m4. +GMP_FINISH + +dnl Create Makefiles +dnl FIXME: Upcoming version of autoconf/automake may not like broken lines. +AC_OUTPUT(Makefile mpf/Makefile mpz/Makefile mpn/Makefile mpq/Makefile \ + mpf/tests/Makefile mpz/tests/Makefile mpq/tests/Makefile mpn/tests/Makefile \ + tests/Makefile tests/rand/Makefile demos/Makefile tune/Makefile \ + mpbsd/Makefile mpbsd/tests/Makefile mpfr/Makefile mpfr/tests/Makefile)