From bae52a8fac7b77a4e252483eb81a8fd71c55fd6f Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Thu, 16 Nov 2000 18:39:55 +0000 Subject: [PATCH] * autoconf/aclocal.m4 (CL_GMP_SET_UINTD): New macro... * configure.in: ...used here. * include/cln/config.h.in: Put in macros defined by CL_GMP_SET_UINTD... * include/cln/types.h: ...used here. * autoconf/acgeneral.m4, autoconf/aclocal.m4: Adhere to FHS. --- ChangeLog | 8 +++++ NEWS | 7 ++-- autoconf/acgeneral.m4 | 5 +-- autoconf/aclocal.m4 | 23 ++++++++++++ configure.in | 4 +-- doc/Makefile.in | 4 +-- include/cln/config.h.in | 6 ++++ include/cln/types.h | 79 ++++++++++++++++++++++++----------------- 8 files changed, 96 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 487d7dd..9316b7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-11-16 Richard Kreckel + + * autoconf/aclocal.m4 (CL_GMP_SET_UINTD): New macro... + * configure.in: ...used here. + * include/cln/config.h.in: Put in macros defined by CL_GMP_SET_UINTD... + * include/cln/types.h: ...used here. + * autoconf/acgeneral.m4, autoconf/aclocal.m4: Adhere to FHS. + 2000-11-13 Richard Kreckel * src/base/digitseq/cl_asm.h: Test if (intDsize==32) for MIPS and HPPA, diff --git a/NEWS b/NEWS index 5ecb74c..cd52890 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -2000-06-xx, version 1.1.0 +2000-11-xx, version 1.1.0 ========================= Functional changes @@ -22,7 +22,10 @@ Implementation changes * Adjusted several break-even points to make better use of a faster libgmp and better match present-day CPUs. -* Fix compilation errors with gcc-2.96. +* Fix several errors for architectures with 64-bit wide words. + (Others than Alpha.) + +* Fix compilation errors with current GCC3.0 snapshots. 2000-01-13, version 1.0.3 diff --git a/autoconf/acgeneral.m4 b/autoconf/acgeneral.m4 index 78fb594..c17e1cb 100644 --- a/autoconf/acgeneral.m4 +++ b/autoconf/acgeneral.m4 @@ -50,6 +50,7 @@ dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. dnl dnl Changed by Bruno Haible, 18 January 1999 +dnl Changed more by Richard Kreckel, 16 November 2000 dnl divert(-1)dnl Throw away output until AC_INIT is called. changequote([, ]) @@ -204,8 +205,8 @@ localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +infodir='${datadir}/info' +mandir='${datadir}/man' # Initialize some other variables. subdirs= diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4 index dcd1d84..e53abcf 100644 --- a/autoconf/aclocal.m4 +++ b/autoconf/aclocal.m4 @@ -956,3 +956,26 @@ AC_DEFUN(CL_GMP_CHECK, AC_TRY_LINK([#include ],[mpn_divexact_by3(0,0,0)], cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS) ])]) + +# What is sizeof(mp_limb_t)? (It has to match sizeof(uintD) later.) +AC_DEFUN(CL_GMP_SET_UINTD, +[AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [ + AC_TRY_RUN([#include +#include +int main() { + FILE *f=fopen("conftestval", "w"); + if (!f) return(1); + if (sizeof(mp_limb_t) > sizeof(long)) + fprintf(f, "long long"); + else if (sizeof(mp_limb_t) == sizeof(long)) + fprintf(f, "long"); + else if (sizeof(mp_limb_t) == sizeof(int)) + fprintf(f, "int"); + else return(1); + return(0); +}], cl_cv_gmp_set_uintd=`cat conftestval`; \ + cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`"; + AC_DEFINE_UNQUOTED($cl_gmp_demands), + AC_MSG_ERROR([CLN can't handle the result]),dnl + AC_MSG_ERROR([cross-compiling - cannot determine])) +])]) diff --git a/configure.in b/configure.in index e38db7d..84e4f0a 100644 --- a/configure.in +++ b/configure.in @@ -95,7 +95,7 @@ dnl release version for cln/config.h, so it can be tested by the preprocessor AC_DEFINE_UNQUOTED(CL_VERSION_MAJOR, $CL_VERSION_MAJOR) AC_DEFINE_UNQUOTED(CL_VERSION_MINOR, $CL_VERSION_MINOR) AC_DEFINE_UNQUOTED(CL_VERSION_PATCHLEVEL, $CL_VERSION_PATCHLEVEL) -dnl concateneted release version +dnl concatenated release version CL_VERSION=$CL_VERSION_MAJOR.$CL_VERSION_MINOR.$CL_VERSION_PATCHLEVEL AC_DEFINE_UNQUOTED(CL_VERSION, $CL_VERSION) AC_SUBST(CL_VERSION) @@ -145,7 +145,6 @@ dnl checks for compiler characteristics dnl CL_CHAR_UNSIGNED dnl DEFS __CHAR_UNSIGNED__ if char is unsigned -test -d 'include' || mkdir 'include' CL_MACHINE([integer types and behaviour],${srcdir}/autoconf/intparam.c,include/cln/intparam.h,cl_cv_file_intparam_h) dnl builds include/cln/intparam.h CL_MACHINE([floating-point types and behaviour],${srcdir}/autoconf/floatparam.c,include/cln/floatparam.h,cl_cv_file_floatparam_h) @@ -164,6 +163,7 @@ if test "$with_gmp" = yes; then fi fi if test "$with_gmp" = yes; then + CL_GMP_SET_UINTD AC_DEFINE(CL_USE_GMP) else AC_MSG_WARN([disabling external GNU MP library]) diff --git a/doc/Makefile.in b/doc/Makefile.in index 6430021..fd3902c 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -78,17 +78,17 @@ $(PACKAGE)_toc.html : $(srcdir)/$(PACKAGE).texi install : all force + if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi if [ ! -d $(infodir) ] ; then mkdir $(infodir) ; fi $(INSTALL_DATA) $(srcdir)/$(PACKAGE).info $(infodir)/$(PACKAGE).info - if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi if [ ! -d $(htmldir) ] ; then mkdir $(htmldir) ; fi $(INSTALL_DATA) $(srcdir)/$(PACKAGE)_*.html $(htmldir) if [ ! -d $(dvidir) ] ; then mkdir $(dvidir) ; fi $(INSTALL_DATA) $(srcdir)/$(PACKAGE).dvi $(dvidir)/$(PACKAGE).dvi installdirs : force - if [ ! -d $(infodir) ] ; then mkdir $(infodir) ; fi if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi + if [ ! -d $(infodir) ] ; then mkdir $(infodir) ; fi if [ ! -d $(htmldir) ] ; then mkdir $(htmldir) ; fi if [ ! -d $(dvidir) ] ; then mkdir $(dvidir) ; fi diff --git a/include/cln/config.h.in b/include/cln/config.h.in index 58b0f04..ef87e31 100644 --- a/include/cln/config.h.in +++ b/include/cln/config.h.in @@ -90,6 +90,12 @@ /* Define if you have . */ #undef HAVE_UNISTD_H +/* CL_GMP_SET_UINTD */ +/* Define one of the following so sizeof(uintD) matches sizeof(mp_limb_t). */ +#undef GMP_DEMANDS_UINTD_LONG_LONG +#undef GMP_DEMANDS_UINTD_LONG +#undef GMP_DEMANDS_UINTD_INT + /* functions and declarations */ diff --git a/include/cln/types.h b/include/cln/types.h index 7191208..876ebcc 100644 --- a/include/cln/types.h +++ b/include/cln/types.h @@ -101,42 +101,48 @@ typedef long sintP; typedef unsigned long uintP; -// Largest integer type which can be manipulated as efficiently as a pointer. -// This is normally the same as the hardware register size. -// Assumption: cl_word_size >= intPsize - #ifdef HAVE_FAST_LONGLONG - #define cl_word_size 64 - #else - #define cl_word_size 32 - #endif - // Numbers in the heap are stored as "digit" sequences. // A digit is an unsigned int with intDsize bits. -// intDsize should be 8 or 16 or 32 or 64. - #if (defined(HAVE_FAST_LONGLONG) && (defined(__alpha__) || defined(__ia64__))) - #define intDsize 64 - #define intDDsize 128 // = 2*intDsize - #define log2_intDsize 6 // = log2(intDsize) - #else - #define intDsize 32 - #define intDDsize 64 // = 2*intDsize - #define log2_intDsize 5 // = log2(intDsize) - #endif - #if (intDsize==8) - typedef sint8 sintD; - typedef uint8 uintD; - #endif - #if (intDsize==16) - typedef sint16 sintD; - typedef uint16 uintD; - #endif - #if (intDsize==32) - typedef sint32 sintD; - typedef uint32 uintD; +// intDsize should be 8 or 16 or 32 or 64 and it should match mp_limb_t, +// if CLN is sitting on top of GMP. + #if defined(GMP_DEMANDS_UINTD_LONG_LONG) + #define HAVE_FAST_LONGLONG + #define intDsize long_long_bitsize + typedef long long sintD; + typedef unsigned long long uintD; + #elif defined(GMP_DEMANDS_UINTD_LONG) + #define intDsize long_bitsize + typedef long sintD; + typedef unsigned long uintD; + #elif defined(GMP_DEMANDS_UINTD_INT) + #define intDsize int_bitsize + typedef int sintD; + typedef unsigned int uintD; + #else // we are not using GMP, so just guess something reasonable + #if (defined(HAVE_FAST_LONGLONG) && (defined(__alpha__) || defined(__ia64__))) + #define intDsize 64 + typedef sint64 sintD; + typedef uint64 uintD; + #else + #define intDsize 32 + typedef sint32 sintD; + typedef uint32 uintD; + #endif #endif #if (intDsize==64) - typedef sint64 sintD; - typedef uint64 uintD; + #define intDDsize 128 // = 2*intDsize + #define log2_intDsize 6 // = log2(intDsize) + #elif (intDsize==32) + #define intDDsize 64 // = 2*intDsize + #define log2_intDsize 5 // = log2(intDsize) + #elif (intDsize==16) + #define intDDsize 32 // = 2*intDsize + #define log2_intDsize 4 // = log2(intDsize) + #elif (intDsize==8) + #define intDDsize 16 // = 2*intDsize + #define log2_intDsize 3 // = log2(intDsize) + #else + #error "What is intDsize again?" #endif // HAVE_DD means that there are unsigned ints with 2*intDsize bits. #if (intDDsize <= (defined(HAVE_FAST_LONGLONG) ? 64 : 32)) @@ -157,4 +163,13 @@ #define HAVE_DD 0 #endif +// Largest integer type which can be manipulated as efficiently as a pointer. +// This is normally the same as the hardware register size. +// Assumption: cl_word_size >= intPsize + #ifdef HAVE_FAST_LONGLONG + #define cl_word_size 64 + #else + #define cl_word_size 32 + #endif + #endif /* _CL_TYPES_H */