yann@466: # This file adds the functions to build the MPFR library yann@466: # Copyright 2008 Yann E. MORIN yann@466: # Licensed under the GPL v2. See COPYING in the root of this package yann@466: yann@602: do_mpfr_get() { :; } yann@602: do_mpfr_extract() { :; } yann@2927: do_mpfr_for_host() { :; } yann@602: yann@602: # Overide function depending on configuration yann@2099: if [ "${CT_MPFR}" = "y" ]; then yann@468: yann@466: # Download MPFR yann@466: do_mpfr_get() { yann@1119: CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/ \ yann@522: http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/ yann@466: } yann@466: yann@466: # Extract MPFR yann@466: do_mpfr_extract() { yann@1126: CT_Extract "mpfr-${CT_MPFR_VERSION}" yann@1901: CT_Patch "mpfr" "${CT_MPFR_VERSION}" yann@466: yann@584: # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the yann@584: # same version number. Unfortunately, some tarballs of MPFR are not yann@584: # built sanely, and thus ./configure fails on Gentoo. yann@584: # See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html yann@584: # and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html yann@598: # This hack is not bad per se, but the MPFR guys would be better not to yann@584: # do that in the future... yann@1251: # It seems that MPFR >= 2.4.0 do not need this... yann@1251: case "${CT_MPFR_VERSION}" in yann@1889: 2.4.*) oron@1449: CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}" oron@1449: if [ ! -f .autoreconf.ct-ng ]; then oron@1449: CT_DoLog DEBUG "Running autoreconf" yann@1904: CT_DoExecLog ALL autoreconf oron@1449: touch .autoreconf.ct-ng oron@1449: fi oron@1449: CT_Popd oron@1449: ;; yann@1251: 1.*|2.0.*|2.1.*|2.2.*|2.3.*) yann@1251: CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}" yann@1251: if [ ! -f .autotools.ct-ng ]; then yann@1251: CT_DoLog DEBUG "Re-building autotools files" yann@1251: CT_DoExecLog ALL autoreconf -fi yann@1251: # Starting with libtool-1.9f, config.{guess,sub} are no longer yann@1251: # installed without -i, but starting with libtool-2.2.6, they yann@1251: # are no longer removed without -i. Sight... Just use -i with yann@1251: # libtool >=2 yann@1251: # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html yann@1251: # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html yann@1251: libtoolize_opt= yann@1299: case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in yann@1251: 0.*) ;; yann@1251: 1.*) ;; yann@1251: *) libtoolize_opt=-i;; yann@1251: esac yann@1251: CT_DoExecLog ALL libtoolize -f ${libtoolize_opt} yann@1251: touch .autotools.ct-ng yann@1251: fi yann@1251: CT_Popd yann@1251: ;; yann@1251: esac yann@595: } yann@595: yann@2927: # Build MPFR for running on host yann@2927: do_mpfr_for_host() { yann@2927: local -a mpfr_opts yann@595: yann@2927: CT_DoStep INFO "Installing MPFR for host" yann@2927: CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpfr-host-${CT_HOST}" yann@2927: yann@2927: mpfr_opts+=( "host=${CT_HOST}" ) yann@2927: mpfr_opts+=( "prefix=${CT_COMPLIBS_DIR}" ) yann@2927: mpfr_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) yann@2927: do_mpfr_backend "${mpfr_opts[@]}" yann@2927: yann@2927: CT_Popd yann@2927: CT_EndStep yann@2927: } yann@2927: yann@2927: # Build MPFR yann@2927: # Parameter : description : type : default yann@2927: # host : machine to run on : tuple : (none) yann@2927: # prefix : prefix to install into : dir : (none) yann@2927: # cflags : host cflags to use : string : (empty) yann@2927: do_mpfr_backend() { yann@2927: local host yann@2927: local prefix yann@2927: local cflags yann@2927: local arg yann@2927: yann@2927: for arg in "$@"; do yann@2927: eval "${arg// /\\ }" yann@2927: done yann@584: yann@1251: # Under Cygwin, we can't build a thread-safe library yann@1205: case "${CT_HOST}" in yann@1892: *cygwin*) mpfr_opts+=( --disable-thread-safe );; yann@1892: *mingw*) mpfr_opts+=( --disable-thread-safe );; yann@1892: *darwin*) mpfr_opts+=( --disable-thread-safe );; yann@1892: *) mpfr_opts+=( --enable-thread-safe );; yann@1205: esac yann@1205: yann@466: CT_DoLog EXTRA "Configuring MPFR" yann@2347: CT_DoExecLog CFG \ yann@2927: CC="${host}-gcc" \ yann@1119: CFLAGS="${CT_CFLAGS_FOR_HOST}" \ yann@1119: "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \ yann@1119: --build=${CT_BUILD} \ yann@2927: --host=${host} \ yann@2927: --prefix="${prefix}" \ yann@2927: --with-gmp="${prefix}" \ yann@2381: --disable-shared \ yann@2381: --enable-static yann@466: yann@466: CT_DoLog EXTRA "Building MPFR" yann@2275: CT_DoExecLog ALL make ${JOBSFLAGS} yann@466: yann@1890: if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then yann@466: CT_DoLog EXTRA "Checking MPFR" yann@2275: CT_DoExecLog ALL make ${JOBSFLAGS} -s check yann@466: fi yann@466: yann@466: CT_DoLog EXTRA "Installing MPFR" yann@656: CT_DoExecLog ALL make install yann@466: } yann@468: yann@1810: fi # CT_MPFR