From ec8ddadac8b89c33151896c2a706e4be9756f79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Wed, 7 Mar 2018 14:35:54 -0300 Subject: [PATCH 1/3] Check that MPFR/MPFI versions match. MPFI >=1.5.2 only works with MPFR >=4.0.0. MPFI < 1.5.2 only works with MPFR < 4.0.0. This check is performed at CMake level, when configuring MPFI. --- Installation/cmake/modules/FindMPFI.cmake | 43 +++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/Installation/cmake/modules/FindMPFI.cmake b/Installation/cmake/modules/FindMPFI.cmake index 630227c99d5..2ddb7e7b591 100644 --- a/Installation/cmake/modules/FindMPFI.cmake +++ b/Installation/cmake/modules/FindMPFI.cmake @@ -1,6 +1,6 @@ find_package( GMP QUIET ) -if( GMP_FOUND ) +if( GMP_FOUND AND MPFR_FOUND ) if( MPFI_INCLUDE_DIR AND MPFI_LIBRARIES ) set( MPFI_FOUND TRUE ) @@ -22,23 +22,44 @@ if( GMP_FOUND ) DOC "Directory containing the MPFI library" ) - if( MPFI_LIBRARIES ) - get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE ) - endif( MPFI_LIBRARIES ) + get_dependency_version( MPFR ) + message( STATUS "MPFR version is ${MPFR_VERSION}." ) + IS_VERSION_LESS("${MPFR_VERSION}" "4.0.0" _MPFR_OLD) - if( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) - include( MPFIConfig OPTIONAL ) - endif( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) + get_dependency_version( MPFI ) + message( STATUS "MPFI version is ${MPFI_VERSION}." ) + IS_VERSION_LESS("${MPFI_VERSION}" "1.5.2" _MPFI_OLD) - include(FindPackageHandleStandardArgs) + if( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + message( + STATUS + "MPFI<1.5.2 requires MPFR<4.0.0; MPFI>=1.5.2 requires MPFR>=4.0.0" ) + set( MPFI_FOUND FALSE ) - find_package_handle_standard_args(MPFI "DEFAULT_MSG" MPFI_LIBRARIES MPFI_INCLUDE_DIR ) + else( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) -else( GMP_FOUND ) + if( MPFI_LIBRARIES ) + get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE ) + endif( MPFI_LIBRARIES ) + + if( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) + include( MPFIConfig OPTIONAL ) + endif( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) + + include(FindPackageHandleStandardArgs) + + find_package_handle_standard_args( MPFI + "DEFAULT_MSG" + MPFI_LIBRARIES + MPFI_INCLUDE_DIR ) + + endif( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + +else( GMP_FOUND AND MPFR_FOUND ) message( STATUS "MPFI needs GMP and MPFR" ) -endif( GMP_FOUND ) +endif( GMP_FOUND AND MPFR_FOUND ) if( MPFI_FOUND ) set( MPFI_USE_FILE "CGAL_UseMPFI" ) From 6200edcfafc20435e1a1c88d0d86a53ebd92fc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Wed, 7 Mar 2018 14:37:51 -0300 Subject: [PATCH 2/3] Forbid MPFR 3.1.[3456] when using RS. --- Algebraic_kernel_d/include/CGAL/RS/rs2_calls.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/RS/rs2_calls.h b/Algebraic_kernel_d/include/CGAL/RS/rs2_calls.h index d87e406e611..b45995466ac 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/rs2_calls.h +++ b/Algebraic_kernel_d/include/CGAL/RS/rs2_calls.h @@ -35,7 +35,7 @@ #define CGALRS_PTR(a) void *a #endif -// RS3 does not work with MPFR 3.1.3 to 3.1.5. In case RS3 is enabled and +// RS3 does not work with MPFR 3.1.3 to 3.1.6. In case RS3 is enabled and // the version of MPFR is one of those buggy versions, abort the compilation // and instruct the user to update MPFR or don't use RS3. #ifdef CGAL_USE_RS3 @@ -43,8 +43,8 @@ BOOST_STATIC_ASSERT_MSG( MPFR_VERSION_MAJOR!=3 || MPFR_VERSION_MINOR!=1 || - MPFR_VERSION_PATCHLEVEL<3 || MPFR_VERSION_PATCHLEVEL>5, - "RS3 does not work with MPFR versions 3.1.3 to 3.1.5. "# + MPFR_VERSION_PATCHLEVEL<3 || MPFR_VERSION_PATCHLEVEL>6, + "RS3 does not work with MPFR versions 3.1.3 to 3.1.6. " "Please update MPFR or disable RS3."); #endif // CGAL_USE_RS3 From a8c8d6f1523c541bcbb7770b3cd0de800b0dbe66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Thu, 8 Mar 2018 10:05:26 -0300 Subject: [PATCH 3/3] Fix MPFR/MPFI check when MPFI is not present. --- Installation/cmake/modules/FindMPFI.cmake | 61 ++++++++++++----------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/Installation/cmake/modules/FindMPFI.cmake b/Installation/cmake/modules/FindMPFI.cmake index 2ddb7e7b591..2b0f903ea2d 100644 --- a/Installation/cmake/modules/FindMPFI.cmake +++ b/Installation/cmake/modules/FindMPFI.cmake @@ -22,38 +22,20 @@ if( GMP_FOUND AND MPFR_FOUND ) DOC "Directory containing the MPFI library" ) - get_dependency_version( MPFR ) - message( STATUS "MPFR version is ${MPFR_VERSION}." ) - IS_VERSION_LESS("${MPFR_VERSION}" "4.0.0" _MPFR_OLD) + if( MPFI_LIBRARIES ) + get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE ) + endif( MPFI_LIBRARIES ) - get_dependency_version( MPFI ) - message( STATUS "MPFI version is ${MPFI_VERSION}." ) - IS_VERSION_LESS("${MPFI_VERSION}" "1.5.2" _MPFI_OLD) + if( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) + include( MPFIConfig OPTIONAL ) + endif( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) - if( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) - message( - STATUS - "MPFI<1.5.2 requires MPFR<4.0.0; MPFI>=1.5.2 requires MPFR>=4.0.0" ) - set( MPFI_FOUND FALSE ) + include(FindPackageHandleStandardArgs) - else( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) - - if( MPFI_LIBRARIES ) - get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE ) - endif( MPFI_LIBRARIES ) - - if( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) - include( MPFIConfig OPTIONAL ) - endif( NOT MPFI_INCLUDE_DIR OR NOT MPFI_LIBRARIES_DIR ) - - include(FindPackageHandleStandardArgs) - - find_package_handle_standard_args( MPFI - "DEFAULT_MSG" - MPFI_LIBRARIES - MPFI_INCLUDE_DIR ) - - endif( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + find_package_handle_standard_args( MPFI + "DEFAULT_MSG" + MPFI_LIBRARIES + MPFI_INCLUDE_DIR ) else( GMP_FOUND AND MPFR_FOUND ) @@ -62,5 +44,24 @@ else( GMP_FOUND AND MPFR_FOUND ) endif( GMP_FOUND AND MPFR_FOUND ) if( MPFI_FOUND ) - set( MPFI_USE_FILE "CGAL_UseMPFI" ) + get_dependency_version( MPFR ) + IS_VERSION_LESS("${MPFR_VERSION}" "4.0.0" _MPFR_OLD) + + get_dependency_version( MPFI ) + IS_VERSION_LESS("${MPFI_VERSION}" "1.5.2" _MPFI_OLD) + + if( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + + message( + STATUS + "MPFI<1.5.2 requires MPFR<4.0.0; MPFI>=1.5.2 requires MPFR>=4.0.0" ) + + set( MPFI_FOUND FALSE ) + + else( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + + set( MPFI_USE_FILE "CGAL_UseMPFI" ) + + endif( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) ) + endif( MPFI_FOUND )