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 #2


Attached is a second attempt at adding toplevel configure checks for the MPFR 
library. This adds separate options for GMP and MPFR as it appears these are 
now distributed separately.

Tested on i686-linux with and without gmp and mpfr installed.
Ok?

Paul

2004-07-31  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	31 Jul 2004 17:52:53 -0000
@@ -1027,33 +1027,48 @@ fi
 ACX_PROG_GNAT
 ACX_PROG_CMP_IGNORE_INITIAL
 
-# Check for GMP
+# Check for GMP and MPFR
 gmplibs=
 gmpinc=
 have_gmp=yes
+# Specify a location for mpfr
+# check for this first so it ends up on the link line before gmp.
+AC_ARG_WITH(mpfr-dir, [  --with-mpfr-dir=PATH    Specify source directory for MPFR library])
+
+if test "x$with_mpfr_dir" != x; then
+  gmpinc="-I$with_mpfr_dir/mpfr"
+  gmplibs="$with_mpfr_dir/libmpfr.a"
+else
+  gmplibs="-lmpfr"
+fi
+
+AC_ARG_WITH(mpfr, [  --with-mpfr=PATH        Specify directory for installed MPFR library])
+
+if test "x$with_mpfr" != x; then
+  gmplibs="-L$with_mpfr/lib $gmplibs"
+  gmpinc="-I$with_mpfr/include"
+fi
+
 # Specify a location for gmp
 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"
+if test "x$with_gmp_dir" != x; then
+  gmpinc="$gmpinc -I$with_gmp_dir"
   if test -f "$with_gmp_dir/.libs/libgmp.a"; then
-    gmplibs="$with_gmp_dir/.libs/libgmp.a"
+    gmplibs="$gmplibs $with_gmp_dir/.libs/libgmp.a"
   elif test -f "$with_gmp_dir/_libs/libgmp.a"; then
-    gmplibs="$with_gmp_dir/_libs/libgmp.a"
+    gmplibs="$gmplibs $with_gmp_dir/_libs/libgmp.a"
   fi
   # One of the later tests will catch the error if neither library is present.
+else
+  gmplibs="$gmplibs -lgmp"
 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"
-  gmpinc="-I$with_gmp/include"
-fi
-
-# Use system gmp if nothing else specified
-if test "x$gmplibs" = x; then
-  gmplibs="-lgmp"
+if test "x$with_gmp" != x; then
+  gmplibs="-L$with_gmp/lib $gmplibs"
+  gmpinc="-I$with_gmp/include $gmpinc"
 fi
 
 saved_CFLAGS="$CFLAGS"
@@ -1068,16 +1083,18 @@ 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])
 
   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"
 fi
 
+# Flags needed for both GMP and/or MPFR
 AC_SUBST(gmplibs)
 AC_SUBST(gmpinc)
 
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	31 Jul 2004 17:37:51 -0000
@@ -291,6 +291,15 @@ Necessary to build the Fortran frontend.
 installed in your library search path, you will have to configure with
 the @option{--with-gmp} or @option{--with-gmp-dir} configure option.
 
+@item MPFR Library
+
+Necessary to build the Fortran frontend.  It can be downloaded from
+@uref{http://http://www.mpfr.org/}.  It is also included in the current GMP
+release (4.1.3) when configured with @option{--enable-mpfr}.
+
+The @option{--with-mpfr} or @option{--with-mpfr-dir} configure option should
+be used if your MPFR Library is not installed in your library search path.
+
 @end table
 
 
@@ -1204,12 +1213,15 @@ The following options apply to the build
 @table @code
 
 @item --with-gmp=@var{pathname}
+@itemx --with-mpfr=@var{pathname}
 @itemx --with-gmp-dir=@var{pathname}
-If you don't have GMP (the GNU Multiple Precision library) installed
-in a standard location and you want to build the Fortran front-end,
-you can explicitly specify the directory where GMP is installed
-(@samp{--with-gmp=gmpinstalldir}) or where you built the GMP library without
-installing (@samp{--with-gmp-dir=gmpbuilddir}).
+@itemx --with-mpfr-dir=@var{pathname}
+If you don't have GMP (the GNU Multiple Precision library) and the MPFR 
+Libraries installed in a standard location and you want to build the Fortran
+front-end, you can explicitly specify the directory where they are installed
+(@samp{--with-gmp=gmpinstalldir}, @samp{--with-mpfr=mpfrinstalldir}) or where
+you built them without installing (@samp{--with-gmp-dir=gmpbuilddir},
+@samp{--with-mpfr-dir=gmpbuilddir}).
 
 @end table
 

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