This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Add toplevel configure check for MPFR


Gfortran currently requires GMP (GNU Multiple Precision library) for 
compile-time arithmetic. In order to accurately match target arithmetic we 
also require MPFR. MPFR is part of GMP, although it is not always enabled.

The patch below modifies the existing GMP configure check to include MPFR.

Tested on i686-linux with and without MPFR installed.
Ok for mainline?

Paul

2004-07-25  Paul Brook  <paul@codesourcery.com>

	* configure.in: Check for MPFR as well as GMP.
	* configure: Regenerate.
	* gcc/doc/install.texi: Document MPFR requirement.

Index: configure.in
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/configure.in,v
retrieving revision 1.301
diff -u -p -r1.301 configure.in
--- configure.in	9 Jul 2004 22:57:07 -0000	1.301
+++ configure.in	25 Jul 2004 14:40:33 -0000
@@ -1027,7 +1027,7 @@ fi
 ACX_PROG_GNAT
 ACX_PROG_CMP_IGNORE_INITIAL
 
-# Check for GMP
+# Check for and MPFR/GMP
 gmplibs=
 gmpinc=
 have_gmp=yes
@@ -1035,25 +1035,26 @@ have_gmp=yes
 AC_ARG_WITH(gmp-dir, [  --with-gmp-dir=PATH     Specify source directory for 
GMP library])
 
 if test "x$with_gmp_dir" != x && test -f "$with_gmp_dir/gmp.h"; then
-  gmpinc="-I$with_gmp_dir"
+  gmpinc="-I$with_gmp_dir -I$with_gmp_dir/mpfr"
   if test -f "$with_gmp_dir/.libs/libgmp.a"; then
     gmplibs="$with_gmp_dir/.libs/libgmp.a"
   elif test -f "$with_gmp_dir/_libs/libgmp.a"; then
     gmplibs="$with_gmp_dir/_libs/libgmp.a"
   fi
   # One of the later tests will catch the error if neither library is 
present.
+  gmplibs="$with_gmp_dir/mpfr/libmpfr.a $gmplibs"
 fi
 
 AC_ARG_WITH(gmp, [  --with-gmp=PATH         Specify directory for installed 
GMP library])
 
 if test "x$with_gmp" != x && test -d "$with_gmp"; then
-  gmplibs="-L$with_gmp/lib -lgmp"
+  gmplibs="-L$with_gmp/lib -lmpfr -lgmp"
   gmpinc="-I$with_gmp/include"
 fi
 
 # Use system gmp if nothing else specified
 if test "x$gmplibs" = x; then
-  gmplibs="-lgmp"
+  gmplibs="-lmpfr -lgmp"
 fi
 
 saved_CFLAGS="$CFLAGS"
@@ -1068,11 +1069,12 @@ choke me
   [AC_MSG_RESULT([no]); have_gmp=no])
 
 if test x"$have_gmp" = xyes; then
-  AC_MSG_CHECKING([for mpf_init in -lgmp])
+  AC_MSG_CHECKING([for mpfr_init in GMP])
 
   saved_LIBS="$LIBS"
   LIBS="$LIBS $gmplibs"
-  AC_TRY_LINK([#include <gmp.h>], [mpf_t n; mpf_init(n);],
+  AC_TRY_LINK([#include <gmp.h>
+#include <mpfr.h>], [mpfr_t n; mpfr_init(n);],
     [AC_MSG_RESULT([yes])],  [AC_MSG_RESULT([no]); have_gmp=no])
   LIBS="$saved_LIBS"
   CFLAGS="$saved_CFLAGS"
Index: gcc/doc/install.texi
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/doc/install.texi,v
retrieving revision 1.299
diff -u -p -r1.299 install.texi
--- gcc/doc/install.texi	20 Jul 2004 19:52:11 -0000	1.299
+++ gcc/doc/install.texi	25 Jul 2004 14:13:03 -0000
@@ -287,9 +287,13 @@ systems' @command{tar} programs will als
 
 @item GNU Multiple Precision Library (GMP) version 4.0 (or later)
 
-Necessary to build the Fortran frontend. If you don't have it
-installed in your library search path, you will have to configure with
-the @option{--with-gmp} or @option{--with-gmp-dir} configure option.
+Necessary to build the Fortran frontend.  GMP must be built with MPFR
+support, ie. specify --enable-mpfr when configuring GMP.  Some common
+systems provide a version of GMP which does not include MPFR.
+
+If you don't have a suitable GMP library installed in your library search
+path, you will have to configure with the @option{--with-gmp} or
+@option{--with-gmp-dir} configure option.
 
 @end table
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]