=================================================================== RCS file: /home/cvs/OpenXM_contrib/gmp/Attic/acinclude.m4,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/acinclude.m4 2000/09/09 14:12:13 1.1.1.1 +++ OpenXM_contrib/gmp/Attic/acinclude.m4 2003/08/25 16:05:55 1.1.1.2 @@ -1,7 +1,7 @@ dnl GMP specific autoconf macros -dnl Copyright (C) 2000 Free Software Foundation, Inc. +dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl @@ -21,10 +21,55 @@ dnl the Free Software Foundation, Inc., 59 Temple Pla dnl MA 02111-1307, USA. +define(X86_PATTERN, +[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]]) + +define(POWERPC64_PATTERN, +[[powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-*]]) + + +dnl GMP_STRIP_PATH(subdir) +dnl ---------------------- +dnl Strip entries */subdir from $path. + +define(GMP_STRIP_PATH, +[tmp_path= +for i in $path; do + case $i in + */$1) ;; + *) tmp_path="$tmp_path $i" ;; + esac +done +path="$tmp_path" +]) + + +dnl GMP_INCLUDE_GMP_H +dnl ----------------- +dnl Expand to the right way to #include gmp-h.in. This must be used +dnl instead of gmp.h, since that file isn't generated until the end of the +dnl configure. +dnl +dnl GMP_INCLUDE_GMP_H_BITS_PER_MP_LIMB starts as a dummy, but gets +dnl redefined in GMP_C_SIZES when the right value is known. + +define(GMP_INCLUDE_GMP_H, +[[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ +#define GMP_NAIL_BITS $GMP_NAIL_BITS] +GMP_INCLUDE_GMP_H_BITS_PER_MP_LIMB +[$DEFN_LONG_LONG_LIMB +#include "$srcdir/gmp-h.in"] +]) + +define(GMP_INCLUDE_GMP_H_BITS_PER_MP_LIMB, +[[#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ +#define GMP_LIMB_BITS 123]]) + + dnl GMP_HEADER_GETVAL(NAME,FILE) dnl ---------------------------- -dnl Expand to the value of a "#define NAME" from the given FILE. -dnl The regexps here aren't very rugged, but are enough for gmp. +dnl Expand at autoconf time to the value of a "#define NAME" from the given +dnl FILE. The regexps here aren't very rugged, but are enough for gmp. dnl /dev/null as a parameter prevents a hang if $2 is accidentally omitted. define(GMP_HEADER_GETVAL, @@ -37,49 +82,219 @@ esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null] dnl GMP_VERSION dnl ----------- -dnl The gmp version number, extracted from the #defines in gmp.h. -dnl Two digits like 3.0 if patchlevel <= 0, or three digits like 3.0.1 if -dnl patchlevel > 0. +dnl The gmp version number, extracted from the #defines in gmp-h.in at +dnl autoconf time. Two digits like 3.0 if patchlevel <= 0, or three digits +dnl like 3.0.1 if patchlevel > 0. define(GMP_VERSION, -[GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp.h)[]dnl -.GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp.h)[]dnl -ifelse(m4_eval(GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h) > 0),1, -[.GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h)])]) +[GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp-h.in)[]dnl +.GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp-h.in)[]dnl +ifelse(m4_eval(GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp-h.in) > 0),1, +[.GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp-h.in)])]) -dnl GMP_PROG_M4() -dnl ------------- +dnl GMP_SUBST_CHECK_FUNCS(func,...) +dnl ------------------------------ +dnl Setup an AC_SUBST of HAVE_FUNC_01 for each argument. + +AC_DEFUN(GMP_SUBST_CHECK_FUNCS, +[m4_if([$1],,, +[_GMP_SUBST_CHECK_FUNCS(ac_cv_func_[$1],HAVE_[]m4_translit([$1],[a-z],[A-Z])_01) +GMP_SUBST_CHECK_FUNCS(m4_shift($@))])]) + +dnl Called: _GMP_SUBST_CHECK_FUNCS(cachvar,substvar) +AC_DEFUN(_GMP_SUBST_CHECK_FUNCS, +[case $[$1] in +yes) AC_SUBST([$2],1) ;; +no) [$2]=0 ;; +esac +]) + + +dnl GMP_SUBST_CHECK_HEADERS(foo.h,...) +dnl ---------------------------------- +dnl Setup an AC_SUBST of HAVE_FOO_H_01 for each argument. + +AC_DEFUN(GMP_SUBST_CHECK_HEADERS, +[m4_if([$1],,, +[_GMP_SUBST_CHECK_HEADERS(ac_cv_header_[]m4_translit([$1],[./],[__]), +HAVE_[]m4_translit([$1],[a-z./],[A-Z__])_01) +GMP_SUBST_CHECK_HEADERS(m4_shift($@))])]) + +dnl Called: _GMP_SUBST_CHECK_HEADERS(cachvar,substvar) +AC_DEFUN(_GMP_SUBST_CHECK_HEADERS, +[case $[$1] in +yes) AC_SUBST([$2],1) ;; +no) [$2]=0 ;; +esac +]) + + +dnl GMP_COMPARE_GE(A1,B1, A2,B2, ...) +dnl --------------------------------- +dnl Compare two version numbers A1.A2.etc and B1.B2.etc. Set +dnl $gmp_compare_ge to yes or no accoring to the result. The A parts +dnl should be variables, the B parts fixed numbers. As many parts as +dnl desired can be included. An empty string in an A part is taken to be +dnl zero, the B parts should be non-empty and non-zero. dnl +dnl For example, +dnl +dnl GMP_COMPARE($major,10, $minor,3, $subminor,1) +dnl +dnl would test whether $major.$minor.$subminor is greater than or equal to +dnl 10.3.1. + +AC_DEFUN(GMP_COMPARE_GE, +[gmp_compare_ge=no +GMP_COMPARE_GE_INTERNAL($@) +]) + +AC_DEFUN(GMP_COMPARE_GE_INTERNAL, +[ifelse(len([$3]),0, +[if test -n "$1" && test "$1" -ge $2; then + gmp_compare_ge=yes +fi], +[if test -n "$1"; then + if test "$1" -gt $2; then + gmp_compare_ge=yes + else + if test "$1" -eq $2; then + GMP_COMPARE_GE_INTERNAL(m4_shift(m4_shift($@))) + fi + fi +fi]) +]) + + +dnl GMP_PROG_AR +dnl ----------- +dnl GMP additions to $AR. +dnl +dnl A cross-"ar" may be necessary when cross-compiling since the build +dnl system "ar" might try to interpret the object files to build a symbol +dnl table index, hence the use of AC_CHECK_TOOL. +dnl +dnl A user-selected $AR is always left unchanged. AC_CHECK_TOOL is still +dnl run to get the "checking" message printed though. +dnl +dnl $AR_FLAGS is set to "cq" rather than leaving it to libtool "cru". The +dnl latter fails when libtool goes into piecewise mode and is unlucky +dnl enough to have two same-named objects in separate pieces, as happens +dnl for instance to random.o (and others) on vax-dec-ultrix4.5. Naturally +dnl a user-selected $AR_FLAGS is left unchanged. + +AC_DEFUN(GMP_PROG_AR, +[dnl Want to establish $AR before libtool initialization. +AC_BEFORE([$0],[AC_PROG_LIBTOOL]) +gmp_user_AR=$AR +AC_CHECK_TOOL(AR, ar, ar) +if test -z "$gmp_user_AR"; then + eval arflags=\"\$ar${abi1}_flags\" + test -n "$arflags" || eval arflags=\"\$ar${abi2}_flags\" + if test -n "$arflags"; then + AC_MSG_CHECKING([for extra ar flags]) + AR="$AR $arflags" + AC_MSG_RESULT([$arflags]) + fi +fi +if test -z "$AR_FLAGS"; then + AR_FLAGS=cq +fi +]) + + +dnl GMP_PROG_HOST_CC +dnl ---------------- +dnl Establish a value for $HOST_CC. +dnl +dnl Any HOST_CC already set is used without testing. Likewise any +dnl CC_FOR_BUILD is used without testing. CC_FOR_BUILD is the new name for +dnl a build system compiler, see configfsf.guess. + +AC_DEFUN(GMP_PROG_HOST_CC, +[AC_BEFORE([$0],[AC_PROG_LIBTOOL]) +AC_REQUIRE([AC_PROG_CC]) +AC_CACHE_CHECK([for HOST_CC build system compiler], + gmp_cv_prog_host_cc, +[if test -n "$HOST_CC"; then + gmp_cv_prog_host_cc=$HOST_CC +else + if test -n "$CC_FOR_BUILD"; then + gmp_cv_prog_host_cc=$CC_FOR_BUILD + else + cat >conftest.c <&AC_FD_CC + if ($c conftest.c -o conftest) >&AC_FD_CC 2>&1; then + if (./conftest) >&AC_FD_CC 2>&1; then + gmp_cv_prog_host_cc=$c + break + fi + fi + done + rm -f conftest* + if test -z "$gmp_cv_prog_host_cc"; then + AC_MSG_ERROR([cannot find a build system compiler]) + fi + fi +fi +]) +HOST_CC=$gmp_cv_prog_host_cc +]) + + +dnl GMP_PROG_LEX +dnl ------------ +dnl AC_PROG_LEX bombs if $LEX is set to ${am_missing_run}flex by +dnl AM_PROG_LEX. It needs to see LEX=: if lex is missing. Avoid this by +dnl running AC_PROG_LEX first and then using "missing". +dnl +dnl FIXME: This can be removed and just AM_PROG_LEX used, one that macro +dnl works properly. + +AC_DEFUN(GMP_PROG_LEX, +[AC_REQUIRE([AC_PROG_LEX]) +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi +]) + + +dnl GMP_PROG_M4 +dnl ----------- dnl Find a working m4, either in $PATH or likely locations, and setup $M4 dnl and an AC_SUBST accordingly. If $M4 is already set then it's a user dnl choice and is accepted with no checks. GMP_PROG_M4 is like -dnl AC_PATH_PROG or AC_CHECK_PROG, but it tests each m4 found to see if -dnl it's good enough. +dnl AC_PATH_PROG or AC_CHECK_PROG, but tests each m4 found to see if it's +dnl good enough. dnl dnl See mpn/asm-defs.m4 for details on the known bad m4s. AC_DEFUN(GMP_PROG_M4, -[AC_CACHE_CHECK([for suitable m4], +[AC_ARG_VAR(M4,[m4 macro processor]) +AC_CACHE_CHECK([for suitable m4], gmp_cv_prog_m4, [if test -n "$M4"; then gmp_cv_prog_m4="$M4" else cat >conftest.m4 <<\EOF -dnl must protect this against being expanded during autoconf m4! -[define(dollarhash,``$][#'')dnl -ifelse(dollarhash(x),1,`define(t1,Y)', +dnl Must protect this against being expanded during autoconf m4! +dnl Dont put "dnl"s in this as autoconf will flag an error for unexpanded +dnl macros. +[define(dollarhash,``$][#'')ifelse(dollarhash(x),1,`define(t1,Y)', ``bad: $][# not supported (SunOS /usr/bin/m4) -'')dnl -ifelse(eval(89),89,`define(t2,Y)', +'')ifelse(eval(89),89,`define(t2,Y)', `bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4) -')dnl -ifelse(t1`'t2,YY,`good -')dnl] +')ifelse(t1`'t2,YY,`good +')] EOF - echo "trying m4" 1>&AC_FD_CC - gmp_tmp_val="`(m4 conftest.m4) 2>&AC_FD_CC`" - echo "$gmp_tmp_val" 1>&AC_FD_CC +dnl ' <- balance the quotes for emacs sh-mode + echo "trying m4" >&AC_FD_CC + gmp_tmp_val=`(m4 conftest.m4) 2>&AC_FD_CC` + echo "$gmp_tmp_val" >&AC_FD_CC if test "$gmp_tmp_val" = good; then gmp_cv_prog_m4="m4" else @@ -90,9 +305,9 @@ dnl not every word. This closes a longstanding sh sec ac_dummy="$PATH:/usr/5bin" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - echo "trying $ac_dir/m4" 1>&AC_FD_CC - gmp_tmp_val="`($ac_dir/m4 conftest.m4) 2>&AC_FD_CC`" - echo "$gmp_tmp_val" 1>&AC_FD_CC + echo "trying $ac_dir/m4" >&AC_FD_CC + gmp_tmp_val=`($ac_dir/m4 conftest.m4) 2>&AC_FD_CC` + echo "$gmp_tmp_val" >&AC_FD_CC if test "$gmp_tmp_val" = good; then gmp_cv_prog_m4="$ac_dir/m4" break @@ -110,199 +325,519 @@ AC_SUBST(M4) ]) -dnl GMP_PROG_CC_FIND([CC_LIST], [REQ_64BIT_CC]) -dnl Find first working compiler in CC_LIST. -dnl If REQ_64BIT_CC is "yes", the compiler is required to be able to -dnl produce 64-bit code. -dnl NOTE: If a compiler needs any special flags for producing 64-bit code, -dnl these have to be found in shell variable `gmp_cflags64_{cc}', where `{cc}' -dnl is the name of the compiler. -dnl Set CC to the name of the first working compiler. -dnl If a 64-bit compiler is found, set CC64 to the name of the compiler and -dnl CFLAGS64 to flags to use. -dnl This macro does not test if any of the compilers found is a GNU compiler. -dnl To do this, when you have finally made up your mind on which one to use, -dnl and set CC accordingly, invoke [GMP_PROG_CC_SELECT]. That macro will -dnl also make sure that your selection of CFLAGS is valid. +dnl GMP_M4_M4WRAP_SPURIOUS +dnl ---------------------- +dnl Check for spurious output from m4wrap(), as described in mpn/asm-defs.m4. dnl -AC_DEFUN(GMP_PROG_CC_FIND, -[AC_BEFORE([$0], [CC_PROG_CPP]) -ifelse([$1], , gmp_cc_list="gcc cc", gmp_cc_list="[$1]") -ifelse([$2], , gmp_req_64bit_cc="no", gmp_req_64bit_cc="[$2]") +dnl The following systems have been seen with the problem. +dnl +dnl - Unicos alpha, but its assembler doesn't seem to mind. +dnl - MacOS X Darwin, its assembler fails. +dnl - NetBSD 1.4.1 m68k, and gas 1.92.3 there gives a warning and ignores +dnl the bad last line since it doesn't have a newline. +dnl - NetBSD 1.4.2 alpha, but its assembler doesn't seem to mind. +dnl +dnl Enhancement: Maybe this could be in GMP_PROG_M4, and attempt to prefer +dnl an m4 with a working m4wrap, if it can be found. -CC32= -CC64= -for c in $gmp_cc_list; do - # Avoid cache hits. - unset CC - unset ac_cv_prog_CC - AC_CHECK_TOOL(CC, $c, $c) - if test -n "$CC"; then - eval c_flags=\$gmp_cflags_$c - GMP_PROG_CC_WORKS($CC, $c_flags, - gmp_prog_cc_works=yes, - gmp_prog_cc_works=no) +AC_DEFUN(GMP_M4_M4WRAP_SPURIOUS, +[AC_REQUIRE([GMP_PROG_M4]) +AC_CACHE_CHECK([if m4wrap produces spurious output], + gmp_cv_m4_m4wrap_spurious, +[# hide the d-n-l from autoconf's error checking +tmp_d_n_l=d""nl +cat >conftest.m4 <&AC_FD_CC +cat conftest.m4 >&AC_FD_CC +tmp_chars=`$M4 conftest.m4 | wc -c` +echo produces $tmp_chars chars output >&AC_FD_CC +rm -f conftest.m4 +if test $tmp_chars = 0; then + gmp_cv_m4_m4wrap_spurious=no +else + gmp_cv_m4_m4wrap_spurious=yes +fi +]) +GMP_DEFINE_RAW(["define(,<$gmp_cv_m4_m4wrap_spurious>)"]) +]) - if test "$gmp_prog_cc_works" != "yes"; then - continue - fi - # Save first working compiler, whether 32- or 64-bit capable. - if test -z "$CC32"; then - CC32="$CC" - fi - if test "$gmp_req_64bit_cc" = "yes"; then - eval c_flags=\$gmp_cflags64_$c +dnl GMP_PROG_NM +dnl ----------- +dnl GMP additions to libtool AC_PROG_NM. +dnl +dnl Note that if AC_PROG_NM can't find a working nm it still leaves +dnl $NM set to "nm", so $NM can't be assumed to actually work. +dnl +dnl A user-selected $NM is always left unchanged. AC_PROG_NM is still run +dnl to get the "checking" message printed though. - # Verify that the compiler works in 64-bit mode as well. - # /usr/ucb/cc on Solaris 7 can *compile* in 64-bit mode, but not link. - GMP_PROG_CC_WORKS($c, $c_flags, - gmp_prog_cc_works=yes, - gmp_prog_cc_works=no) +AC_DEFUN(GMP_PROG_NM, +[dnl Make sure we're the first to call AC_PROG_NM, so our extra flags are +dnl used by everyone. +AC_BEFORE([$0],[AC_PROG_NM]) +gmp_user_NM=$NM +AC_PROG_NM - if test "$gmp_prog_cc_works" = "yes"; then - GMP_CHECK_CC_64BIT($c, $c_flags) - if test "$gmp_cv_cc_64bit" = "yes"; then - test -z "$CC64" && CC64="$c" - test -z "$CFLAGS64" && CFLAGS64="$c_flags" - # We have CC64 so we're done. - break - fi - fi - else - # We have CC32, and we don't need a 64-bit compiler so we're done. - break +# FIXME: When cross compiling (ie. $ac_tool_prefix not empty), libtool +# defaults to plain "nm" if a "${ac_tool_prefix}nm" is not found. In this +# case run it again to try the native "nm", firstly so that likely locations +# are searched, secondly so that -B or -p are added if necessary for BSD +# format. This is necessary for instance on OSF with "./configure +# --build=alphaev5-dec-osf --host=alphaev6-dec-osf". +# +if test -z "$gmp_user_NM" && test -n "$ac_tool_prefix" && test "$NM" = nm; then + $as_unset lt_cv_path_NM + gmp_save_ac_tool_prefix=$ac_tool_prefix + ac_tool_prefix= + NM= + AC_PROG_NM + ac_tool_prefix=$gmp_save_ac_tool_prefix +fi + +if test -z "$gmp_user_NM"; then + eval nmflags=\"\$nm${abi1}_flags\" + test -n "$nmflags" || eval nmflags=\"\$nm${abi2}_flags\" + if test -n "$nmflags"; then + AC_MSG_CHECKING([for extra nm flags]) + NM="$NM $nmflags" + AC_MSG_RESULT([$nmflags]) + fi +fi +]) + + +dnl GMP_PROG_CC_WORKS(cc+cflags,[ACTION-IF-WORKS][,ACTION-IF-NOT-WORKS]) +dnl -------------------------------------------------------------------- +dnl Check if cc+cflags can compile and link. +dnl +dnl This test is designed to be run repeatedly with different cc+cflags +dnl selections, so the result is not cached. +dnl +dnl For a native build, meaning $cross_compiling == no, we require that the +dnl generated program will run. This is the same as AC_PROG_CC does in +dnl _AC_COMPILER_EXEEXT_WORKS, and checking here will ensure we don't pass +dnl a CC/CFLAGS combination that it rejects. +dnl +dnl sparc-*-solaris2.7 can compile ABI=64 but won't run it if the kernel +dnl was booted in 32-bit mode. The effect of requiring the compiler output +dnl will run is that a plain native "./configure" falls back on ABI=32, but +dnl ABI=64 is still available as a cross-compile. + +AC_DEFUN(GMP_PROG_CC_WORKS, +[AC_MSG_CHECKING([compiler $1]) +cat >conftest.c <= 0 ? n : 0); } + +/* 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 +gmp_prog_cc_works=no +gmp_compile="$1 conftest.c >&AC_FD_CC" +if AC_TRY_EVAL(gmp_compile); then + if test "$cross_compiling" = no; then + if AC_TRY_COMMAND([./a.out || ./a.exe || ./conftest]); then + gmp_prog_cc_works=yes fi + else + gmp_prog_cc_works=yes fi -done -CC="$CC32" -])dnl +fi +rm -f conftest* a.out a.exe +AC_MSG_RESULT($gmp_prog_cc_works) +if test $gmp_prog_cc_works = yes; then + ifelse([$2],,:,[$2]) +else + ifelse([$3],,:,[$3]) +fi +]) -dnl GMP_PROG_CC_SELECT -dnl Check that `CC' works with `CFLAGS'. Check if `CC' is a GNU compiler. -dnl Cache the result as `ac_cv_prog_CC'. -AC_DEFUN(GMP_PROG_CC_SELECT, -[AC_BEFORE([$0], [CC_PROG_CPP]) -AC_PROG_CC_WORKS -AC_PROG_CC_GNU -if test "$ac_cv_prog_gcc" = "yes"; then - GCC=yes +dnl GMP_PROG_CC_IS_GNU(CC,[ACTIONS-IF-YES][,ACTIONS-IF-NO]) +dnl ------------------------------------------------------- +dnl Determine whether the given compiler is GNU C. +dnl +dnl This test is the same as autoconf _AC_LANG_COMPILER_GNU, but doesn't +dnl cache the result. The same "ifndef" style test is used, to avoid +dnl problems with syntax checking cpp's used on NeXT and Apple systems. + +AC_DEFUN(GMP_PROG_CC_IS_GNU, +[cat >conftest.c <