Skip to content

Commit

Permalink
* configure.ac: Add "recommended" version checks for GMP/MPC.
Browse files Browse the repository at this point in the history
	Update recommended GMP/MPFR/MPC versions.
	* configure: Regenerate.
  • Loading branch information
Kaveh Ghazi committed Jan 31, 2010
1 parent 20336e4 commit a6b5846
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 20 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2010-01-31 Kaveh R. Ghazi <[email protected]>

Sync from gcc:
* configure.ac: Add "recommended" version checks for GMP/MPC.
Update recommended GMP/MPFR/MPC versions.
* configure: Regenerate.

2010-01-25 Joern Rennecke <[email protected]>

gcc PR libstdc++/36101, gcc PR libstdc++/42813
Expand Down
70 changes: 60 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5466,18 +5466,38 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
have_gmp=yes
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $gmpinc"
# Check GMP actually works
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct version of gmp.h" >&5
$as_echo_n "checking for correct version of gmp.h... " >&6; }
# Check for the recommended and required versions of GMP.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of gmp.h" >&5
$as_echo_n "checking for the correct version of gmp.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
int
main ()
{
#define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,0)
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
#include <gmp.h>
int
main ()
{
#if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 2)
#define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
choke me
#endif
Expand All @@ -5488,6 +5508,11 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: buggy but acceptable" >&5
$as_echo "buggy but acceptable" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }; have_gmp=no
Expand All @@ -5496,8 +5521,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

# If we have GMP, check the MPFR version.
if test x"$have_gmp" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct version of mpfr.h" >&5
$as_echo_n "checking for correct version of mpfr.h... " >&6; }
# Check for the recommended and required versions of MPFR.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of mpfr.h" >&5
$as_echo_n "checking for the correct version of mpfr.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <gmp.h>
Expand All @@ -5523,7 +5549,7 @@ int
main ()
{
#if MPFR_VERSION < MPFR_VERSION_NUM(2,3,2)
#if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2)
choke me
#endif
Expand All @@ -5548,6 +5574,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

# Check for the MPC header version.
if test x"$have_gmp" = xyes ; then
# Check for the recommended and required versions of MPC.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of mpc.h" >&5
$as_echo_n "checking for the correct version of mpc.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Expand All @@ -5557,7 +5584,23 @@ int
main ()
{
#if MPC_VERSION < MPC_VERSION_NUM (0,8,0)
#if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <mpc.h>
int
main ()
{
#if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
choke me
#endif
Expand All @@ -5568,6 +5611,11 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: buggy but acceptable" >&5
$as_echo "buggy but acceptable" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }; have_gmp=no
Expand Down Expand Up @@ -5624,8 +5672,10 @@ rm -f core conftest.err conftest.$ac_objext \

CFLAGS="$saved_CFLAGS"

# The library versions listed in the error message below should match
# the HARD-minimums enforced above.
if test x$have_gmp != xyes; then
as_fn_error "Building GCC requires GMP 4.2+, MPFR 2.3.2+ and MPC 0.8.0+.
as_fn_error "Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
Expand Down
37 changes: 27 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1341,26 +1341,35 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
have_gmp=yes
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $gmpinc"
# Check GMP actually works
AC_MSG_CHECKING([for correct version of gmp.h])
# Check for the recommended and required versions of GMP.
AC_MSG_CHECKING([for the correct version of gmp.h])
AC_TRY_COMPILE([#include "gmp.h"],[
#if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 2)
#define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,0)
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
], AC_TRY_COMPILE([#include <gmp.h>],[
#define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])]),
[AC_MSG_RESULT([no]); have_gmp=no])

# If we have GMP, check the MPFR version.
if test x"$have_gmp" = xyes; then
dnl MPFR 2.3.1 is acceptable, but MPFR 2.3.2 is better.
AC_MSG_CHECKING([for correct version of mpfr.h])
# Check for the recommended and required versions of MPFR.
AC_MSG_CHECKING([for the correct version of mpfr.h])
AC_TRY_COMPILE([#include <gmp.h>
#include <mpfr.h>],[
#if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
choke me
#endif
], AC_TRY_COMPILE([#include <gmp.h>
#include <mpfr.h>],[
#if MPFR_VERSION < MPFR_VERSION_NUM(2,3,2)
#if MPFR_VERSION < MPFR_VERSION_NUM(2,4,2)
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])]),
Expand All @@ -1369,12 +1378,18 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then

# Check for the MPC header version.
if test x"$have_gmp" = xyes ; then
# Check for the recommended and required versions of MPC.
AC_MSG_CHECKING([for the correct version of mpc.h])
AC_TRY_COMPILE([#include <mpc.h>],[
#if MPC_VERSION < MPC_VERSION_NUM (0,8,0)
#if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
], AC_TRY_COMPILE([#include <mpc.h>],[
#if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])]),
[AC_MSG_RESULT([no]); have_gmp=no])
fi

# Now check the MPFR library.
Expand Down Expand Up @@ -1406,8 +1421,10 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then

CFLAGS="$saved_CFLAGS"

# The library versions listed in the error message below should match
# the HARD-minimums enforced above.
if test x$have_gmp != xyes; then
AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.3.2+ and MPC 0.8.0+.
AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
Expand Down

0 comments on commit a6b5846

Please sign in to comment.