Update mpfr to 4.0.1 and fix compilation under gcc 7

gcc 7 deprecates the use of varargs.h in favour of stdarg.h.
mpfr already fixes it, but the fix is enabled if stdarg is available.
This patch adds the test on CMakeLists.txt and enables the fix if
needed.
This commit is contained in:
ing. Federico Fuga 2018-12-13 11:59:19 +01:00
parent e04b4ed5b5
commit a2c846338c
3 changed files with 16 additions and 4 deletions

View File

@ -255,6 +255,11 @@ if(BUILD_SHARED_LIBS)
target_compile_definitions(mpfr PRIVATE __GMP_LIBGMP_DLL)
endif()
try_compile(I_HAVE_STDARG ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/test_stdarg.c)
if (I_HAVE_STDARG)
target_compile_definitions(mpfr PRIVATE HAVE_STDARG)
endif (I_HAVE_STDARG)
target_link_libraries(mpfr ${GMP_LIBRARIES})
target_include_directories(mpfr PUBLIC ${GMP_INCLUDE_DIRS})

View File

@ -1,13 +1,14 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpfr-3.1.6)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpfr-4.0.1)
vcpkg_download_distfile(ARCHIVE
URLS "http://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.xz"
FILENAME "mpfr-3.1.6.tar.xz"
SHA512 746ee74d5026f267f74ab352d850ed30ff627d530aa840c71b24793e44875f8503946bd7399905dea2b2dd5744326254d7889337fe94cfe58d03c4066e9d8054
URLS "http://www.mpfr.org/mpfr-4.0.1/mpfr-4.0.1.tar.xz"
FILENAME "mpfr-4.0.1.tar.xz"
SHA512 137ad68bc1e33a155edc1247fcdba27f999cf48ed526773136584090ddf2cfdfc9ea79fbf74ea1943b835b4b1ff29b05087114738c6ad3b485848540f30cac4f
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/test_stdarg.c DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/gmp_printf.c DESTINATION ${SOURCE_PATH}/src)
vcpkg_configure_cmake(

6
ports/mpfr/test_stdarg.c Normal file
View File

@ -0,0 +1,6 @@
# include <stdarg.h>
int main(int argc, char *argv) {
return 0;
}