]> www.ginac.de Git - cln.git/commitdiff
Optional support for configure --with-gmp=GMP-PREFIX.
authorRichard Kreckel <kreckel@ginac.de>
Sat, 15 Mar 2008 21:13:51 +0000 (21:13 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Sat, 15 Mar 2008 21:13:51 +0000 (21:13 +0000)
ChangeLog
configure.ac
doc/cln.texi
m4/gmp.m4

index 746e0b4aaa8a7d0ee124bd1d7603234429bf12ac..c24586cd3615d1e21a4aab1ce02a742a4d185561 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,17 @@
-2007-02-23  Bruno Haible  <bruno@clisp.org>
+2008-03-15  Richard B. Kreckel  <kreckel@ginac.de>
+
+       * m4/gmp.m4 (CL_LIBGMP): New macro brings support for --with-gmp=DIR...
+       * configure.ac: ...used here.
+       * doc/cln.texi: Document that new feature.
+       Suggested by Paul Zimmermann <paul.zimmermann@loria.fr>.
+
+2008-02-23  Bruno Haible  <bruno@clisp.org>
 
        Support for gcc-4.3 snapshots.
        * autoconf/floatparam.c (check): Change argument types to
        'volatile type*'. This defeats optimizations of gcc 4.3.0 snapshots.
 
-2007-02-23  Bruno Haible  <bruno@clisp.org>
+2008-02-23  Bruno Haible  <bruno@clisp.org>
 
        Change "make alls" and "make allo" to recurse into subdirectories.
        * src/Makefile.in (alls-local): Renamed from alls.
@@ -13,7 +20,7 @@
        (alls, allo): New rules.
        (SUBDIRS_TARGET_ALLS, SUBDIRS_TARGET_ALLO): New variables.
 
-2007-02-22  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-22  Richard B. Kreckel  <kreckel@ginac.de>
 
        * include/cln/integer_io.h (read_integer): Make index args uintC.
        * src/integer/input/cl_I_readparsed.cc: Likewise.
        * src/vector/output/cl_SV_aprint.cc: Likewise.
        * src/vector/output/cl_SV_number_aprint.cc: Likewise.
 
-2007-02-15  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-15  Richard B. Kreckel  <kreckel@ginac.de>
 
        * m4/cc.m4 (CL_HAVE_ATTRIBUTE_FLATTEN): More robust definition allows...
        * src/base/cl_maybe_inline.h (CL_FLATTEN): ...simplification here.
 
-2007-02-10  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-10  Richard B. Kreckel  <kreckel@ginac.de>
 
        * autoconf/ltmain.sh: Update to libtool-1.5.26.
        * autoconf/config.guess: Likewise.
        * autoconf/config.sub: Likewise.
        * m4/libtool.m4: Likewise.
 
-2007-02-09  Alexei Sheplyakov  <varg@theor.jinr.ru>
+2008-02-09  Alexei Sheplyakov  <varg@theor.jinr.ru>
             Richard B. Kreckel  <kreckel@ginac.de>
 
        Avoid compiler warning about ignored 'flatten' attribute directive:
@@ -46,7 +53,7 @@
        * include/cln/config.h.in: ...defining CL_HAVE_ATTRIBUTE_FLATTEN,...
        * src/base/cl_maybe_inline.h: ...used to prevent a warning here.
 
-2007-02-07  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-07  Richard B. Kreckel  <kreckel@ginac.de>
 
        * include/cln/integer.h: Enable modifying operators by default.
        * include/cln/rational.h: Likewise.
        * include/cln/complex.h: Likewise.
        * doc/cln.texi: Document that.
 
-2007-02-06  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-06  Richard B. Kreckel  <kreckel@ginac.de>
 
        Fix crash in output of huge numbers:
        * src/integer/conv/cl_I_to_digits.cc: Make erglen uintC.
        * src/integer/output/cl_I_print_string.cc: Make B_baselen uintC.
 
-2007-02-04  Richard B. Kreckel  <kreckel@ginac.de>
+2008-02-04  Richard B. Kreckel  <kreckel@ginac.de>
 
        Fix cl_F output of more than 2^32 decimal digits:
        * src/base/string/cl_sstring.cc (cl_sstring): make len uintC.
        * src/base/string/cl_sstring.h: Likewise.
 
-2007-01-23  Bruno Haible  <bruno@clisp.org>
+2008-01-23  Bruno Haible  <bruno@clisp.org>
 
        Allow 64-bit builds on MacOS X 10.5.
        * m4/general.m4 (CL_CANONICAL_HOST_CPU): Test for x86_64 CPU if
        "uname -m" returns "i386".
        Reported by Ron Garret <ron@flownet.com>.
 
-2007-01-20  Bruno Haible  <bruno@clisp.org>
+2008-01-20  Bruno Haible  <bruno@clisp.org>
 
        Avoid some gcc warnings.
        * autoconf/floatparam.c (flipped_double): Use a union instead of a
        * src/float/transcendental/cl_LF_zeta_int.cc (compute_zeta_cvz2):
        Remove unused local variable.
 
-2007-01-19  Richard B. Kreckel  <kreckel@ginac.de>
+2008-01-19  Richard B. Kreckel  <kreckel@ginac.de>
 
        * Version 1.2.0 released.
 
-2007-01-19  Richard B. Kreckel  <kreckel@ginac.de>
+2008-01-19  Richard B. Kreckel  <kreckel@ginac.de>
 
        * doc/Makefile.in: texi2html -split_chapter doesn't generate
        cln_toc.html any more.
        * doc/cln.texi: Add table of contents in TeX output.
 
-2007-01-18  Alexei Sheplyakov  <varg@theor.jinr.ru>
+2008-01-18  Alexei Sheplyakov  <varg@theor.jinr.ru>
 
        Fix linking problems on some platforms caused by inline/non-inline
        versions of same functions (obsoletes MAYBE_INLINE):
index e5e06de9567205eb3fbc8cc91bd5dc599abdd9bc..051223eda50ff766a7b09102e1bd88f64a6d5baa 100644 (file)
@@ -154,32 +154,12 @@ dnl           checks for compiler characteristics
 dnl
 AC_C_CHAR_UNSIGNED
                       dnl DEFS __CHAR_UNSIGNED__ if char is unsigned
-test -d 'include/cln' || mkdir -p 'include/cln'
 CL_MACHINE([integer types and behaviour],${srcdir}/autoconf/intparam.c,[CL_INTPARAM_CROSS],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,[CL_FLOATPARAM_CROSS],include/cln/floatparam.h,cl_cv_file_floatparam_h)
                       dnl builds include/cln/floatparam.h
-dnl
-dnl           interfacing to GNU gmp (must be at least version 3)
-dnl
-AC_ARG_WITH(gmp, AS_HELP_STRING([--with-gmp], 
-  [use external fast low-level functions from GNU MP (default: yes).]),
-  with_gmp="$withval",
-  with_gmp="yes")
-if test "$with_gmp" = yes; then
-  CL_GMP_H_VERSION
-  if test "$cl_cv_new_gmp_h" = no; then with_gmp="no"; fi
-  if test "$with_gmp" = yes; then
-    CL_GMP_CHECK
-    if test "$cl_cv_new_libgmp" = no; then with_gmp="no"; fi
-  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])
-fi
+CL_LIBGMP
+                      dnl DEFS CL_USE_GMP, GMP_DEMANDS_UINTD_*
 dnl
 dnl           That's it.
 dnl
index 47a3bcc57b4cce2dc5eae19d0903464262414806..813ce4af28ff52e994c67bbb16a964dab5078299 100644 (file)
@@ -471,6 +471,9 @@ Flags to be given to the C++ compiler when compiling programs (not when linking)
 
 @item CPPFLAGS
 Flags to be given to the C/C++ preprocessor.
+
+@item LDFLAGS
+Flags to be given to the linker.
 @end table
 
 Examples:
@@ -538,25 +541,31 @@ libraries so runtime-critical applications should be linked statically.
 @subsection Using the GNU MP Library
 @cindex GMP
 
-Starting with version 1.1, CLN may be configured to make use of a
-preinstalled @code{gmp} library for some low-level routines.  Please
-make sure that you have at least @code{gmp} version 3.0 installed
-since earlier versions are unsupported and likely not to work.  This
-feature is known to be quite a boost for CLN's performance.
+CLN may be configured to make use of a preinstalled @code{gmp} library
+for some low-level routines.  Please make sure that you have at least
+@code{gmp} version 3.0 installed since earlier versions are unsupported
+and likely not to work.  Using @code{gmp} is known to be quite a boost
+for CLN's performance.
+
+By default, CLN will autodetect @code{gmp} and use it. If you do not
+want CLN to make use of a preinstalled @code{gmp} library, then you can
+explicitly specify so by calling @code{configure} with the option
+@samp{--without-gmp}.
 
-By default, CLN will autodetect @code{gmp} and use it. But if you have
-installed the @code{gmp} library and its header file in some place where
-your compiler cannot find it by default, you must help @code{configure}
-by setting @code{CPPFLAGS} and @code{LDFLAGS}.  Here is an example:
+If you have installed the @code{gmp} library and its header files in
+some place where the compiler cannot find it by default, you must help
+@code{configure} and specify the prefix that was used when @code{gmp}
+was configured. Here is an example:
 
 @example
-$ CFLAGS="-O2" CXXFLAGS="-O2" CPPFLAGS="-I/opt/gmp/include" \
-  LDFLAGS="-L/opt/gmp/lib" ./configure --with-gmp
+$ ./configure --with-gmp=/opt/gmp-4.2.2
 @end example
 
-If you do not want CLN to make use of a preinstalled @code{gmp}
-library, then you can explicitly specify so by calling
-@code{configure} with the option @samp{--without-gmp}.
+This assumes that the @code{gmp} header files have been installed in
+@file{/opt/gmp-4.2.2/include/} and the library in
+@file{/opt/gmp-4.2.2/lib/}. More uncommon GMP installations can be
+handled by setting CPPFLAGS and LDFLAGS appropriately prior to running
+@code{configure}.
 
 
 @node Installing the library
index 455a3042320f5aa3b920d877e5dfc58fa55406ea..1ad8898b151fc4bd1fb717b0f01ab3ca1eb14172 100644 (file)
--- a/m4/gmp.m4
+++ b/m4/gmp.m4
@@ -1,5 +1,5 @@
 dnl -*- Autoconf -*-
-dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
+dnl Copyright (C) 1993-2008 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -28,7 +28,7 @@ AC_DEFUN([CL_GMP_CHECK],
     AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
 cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no")
     LIBS=$SAVELIBS])
-    if test x"$cl_cv_new_libgmp" = xyes; then
+    if test "$cl_cv_new_libgmp" = yes; then
       LIBS="$LIBS -lgmp"
     fi
 ])
@@ -64,3 +64,62 @@ int main() {
 ])
 AC_DEFINE_UNQUOTED($cl_gmp_demands)
 ])
+
+dnl Whether or not to use GMP. Sets CL_USE_GMP.
+dnl Also sets CPPFLAGS, LDFLAGS if --with-gmp=DIR was specified.
+AC_DEFUN([CL_LIBGMP],
+[AC_ARG_WITH(gmp, AS_HELP_STRING([--with-gmp@<:@=DIR@:>@],
+  [use external low-level functions from GNU MP (installed in prefix DIR) @<:@default=yes@:>@.]),[
+    with_gmp="$withval"
+  ],
+  with_gmp="yes")
+case $with_gmp in
+  yes)
+    dnl --with-gmp
+    CL_GMP_H_VERSION
+    if test "$cl_cv_new_gmp_h" = yes; then
+      CL_GMP_CHECK
+      if test "$cl_cv_new_libgmp" = yes; then
+        CL_GMP_SET_UINTD
+        AC_DEFINE(CL_USE_GMP)
+      else
+        AC_MSG_WARN([The GNU MP library is too old to be used.])
+      fi
+    else
+      AC_MSG_WARN([The header file <gmp.h> is too old to be used.])
+    fi
+  ;;
+  no)
+    dnl --without-gmp
+  ;;
+  *)
+    dnl --with-gmp=DIR
+    case $withval in
+      [[\\/$]]* | ?:[[\\/]]* )
+      ;;
+      *) AC_MSG_ERROR([expected an absolute directory name for --with-gmp: $withval])
+      ;;
+    esac
+    saved_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -I${withval}/include"
+    saved_LDFLAGS="$LDFLAGS"
+    LDFLAGS="$LDFLAGS -L${withval}/lib"
+    CL_GMP_H_VERSION
+    if test "$cl_cv_new_gmp_h" = yes; then
+      CL_GMP_CHECK
+      if test "$cl_cv_new_libgmp" = yes; then
+        CL_GMP_SET_UINTD
+        AC_DEFINE(CL_USE_GMP)
+      else
+        AC_MSG_WARN([The GNU MP library is too old to be used.])
+        CPPFLAGS="$saved_CPPFLAGS"
+        LDFLAGS="$saved_LDFLAGS"
+      fi
+    else
+      AC_MSG_WARN([The header file <gmp.h> is too old to be used.])
+      CPPFLAGS="$saved_CPPFLAGS"
+      LDFLAGS="$saved_LDFLAGS"
+    fi
+  ;;
+esac
+])