Add mpfr package

This commit is contained in:
Alexpux
2013-11-01 06:57:36 +04:00
parent e9bc1511dd
commit 7ed00ff5f9
4 changed files with 1792 additions and 0 deletions

53
mpfr/PKGBUILD Normal file
View File

@@ -0,0 +1,53 @@
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
pkgname=('mpfr' 'mpfr-devel')
_pkgver=3.1.2
_patchlevel=p3
pkgver=${_pkgver}.${_patchlevel}
#pkgver=${_pkgver}
pkgrel=1
pkgdesc="Multiple-precision floating-point library"
groups=('libraries')
arch=('i686' 'x86_64')
url="http://www.mpfr.org/"
license=('LGPL')
depends=('gmp>=5.0')
install=mpfr.install
source=(http://www.mpfr.org/mpfr-current/mpfr-${_pkgver}.tar.xz{,.asc}
mpfr-${_pkgver}-${_patchlevel}.patch
mpfr-3.1.2-msys2.patch)
md5sums=('e3d203d188b8fe60bb6578dd3152e05c'
'SKIP'
'd22c975afc8599b06dd0d6c1128ac078'
'9d4b7cf1a9ac9d6e06568850d8073448')
build() {
cd "${srcdir}/${pkgname}-${_pkgver}"
patch -p1 -i $srcdir/mpfr-${_pkgver}-${_patchlevel}.patch
patch -p1 -i $srcdir/mpfr-3.1.2-msys2.patch
./configure --prefix=/usr --enable-shared --disable-static
make
make DESTDIR="${srcdir}/dest" install
}
check() {
cd "${srcdir}/${pkgname}-${_pkgver}"
make check
}
package_mpfr() {
mkdir -p ${pkgdir}/usr
cp -rf $srcdir/dest/usr/bin ${pkgdir}/usr/
cp -rf $srcdir/dest/usr/share ${pkgdir}/usr/
}
package_mpfr-devel() {
groups=('development')
options=(staticlibs)
pkgdesc="MPFR headers and libraries"
mkdir -p ${pkgdir}/usr
cp -rf $srcdir/dest/usr/include ${pkgdir}/usr/
cp -rf $srcdir/dest/usr/lib ${pkgdir}/usr/
}

940
mpfr/mpfr-3.1.2-msys2.patch Normal file
View File

@@ -0,0 +1,940 @@
diff -Naur mpfr-3.1.2/acinclude.m4 mpfr-3.1.2-p/acinclude.m4
--- mpfr-3.1.2/acinclude.m4 2013-03-13 19:37:46.000000000 +0400
+++ mpfr-3.1.2-p/acinclude.m4 2013-03-18 07:13:02.093333305 +0400
@@ -783,7 +783,7 @@
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_SUBST(MPFR_LIBM,'')
case $host in
- *-*-beos* | *-*-cygwin* | *-*-pw32*)
+ *-*-beos* | *-*-cygwin* | *-*-msys* | *-*-pw32*)
# According to libtool AC CHECK LIBM, these systems don't have libm
;;
*-*-solaris*)
diff -Naur mpfr-3.1.2/compile mpfr-3.1.2-p/compile
--- mpfr-3.1.2/compile 2013-03-13 19:38:21.000000000 +0400
+++ mpfr-3.1.2-p/compile 2013-03-18 07:13:02.103333233 +0400
@@ -54,7 +54,7 @@
MINGW*)
file_conv=mingw
;;
- CYGWIN*)
+ CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
diff -Naur mpfr-3.1.2/config.guess mpfr-3.1.2-p/config.guess
--- mpfr-3.1.2/config.guess 2013-03-13 19:38:21.000000000 +0400
+++ mpfr-3.1.2-p/config.guess 2013-03-18 07:13:02.103333233 +0400
@@ -844,6 +844,9 @@
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
+ amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+ echo x86_64-unknown-msys
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
diff -Naur mpfr-3.1.2/configure mpfr-3.1.2-p/configure
--- mpfr-3.1.2/configure 2013-03-13 19:38:20.000000000 +0400
+++ mpfr-3.1.2-p/configure 2013-03-18 07:13:02.149999846 +0400
@@ -2420,7 +2420,7 @@
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
done
@@ -2645,11 +2645,11 @@
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
esac
# Do `set' in a subshell so we don't clobber the current shell's
@@ -3059,7 +3059,7 @@
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -3092,7 +3092,7 @@
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -3338,7 +3338,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Do not use --with-gmp and --with-gmp-include/--with-gmp-lib options simultaneously.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
fi
@@ -3370,7 +3370,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Do not use --with-gmp-build and other --with-gmp options simultaneously.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
fi
@@ -3394,7 +3394,7 @@
$as_echo "#define WANT_GMP_INTERNALS 1" >>confdefs.h
;;
no) ;;
- *) as_fn_error $? "bad value for --enable-gmp-internals: yes or no" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-gmp-internals: yes or no" "$LINENO" 5 ;;
esac
fi
@@ -3409,7 +3409,7 @@
full)
$as_echo "#define WANT_ASSERT 2" >>confdefs.h
;;
- *) as_fn_error $? "bad value for --enable-assert: yes, no or full" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-assert: yes, no or full" "$LINENO" 5 ;;
esac
fi
@@ -3420,7 +3420,7 @@
$as_echo "#define MPFR_USE_LOGGING 1" >>confdefs.h
;;
no) ;;
- *) as_fn_error $? "bad value for --enable-logging: yes or no" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-logging: yes or no" "$LINENO" 5 ;;
esac
fi
@@ -3429,7 +3429,7 @@
enableval=$enable_thread_safe; case $enableval in
yes) ;;
no) ;;
- *) as_fn_error $? "bad value for --enable-thread-safe: yes or no" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-thread-safe: yes or no" "$LINENO" 5 ;;
esac
fi
@@ -3440,7 +3440,7 @@
$as_echo "#define MPFR_USE_WARNINGS 1" >>confdefs.h
;;
no) ;;
- *) as_fn_error $? "bad value for --enable-warnings: yes or no" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-warnings: yes or no" "$LINENO" 5 ;;
esac
fi
@@ -3458,7 +3458,7 @@
#define MPFR_TESTS_TIMEOUT $enableval
_ACEOF
;;
- *) as_fn_error $? "bad value for --enable-tests-timeout" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-tests-timeout" "$LINENO" 5 ;;
esac
fi
@@ -3827,7 +3827,7 @@
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3942,7 +3942,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -3985,7 +3985,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -4044,7 +4044,7 @@
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
fi
fi
@@ -4096,7 +4096,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -4634,7 +4634,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
ac_ext=c
@@ -4738,7 +4738,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "neither DPD nor BID
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: BID" >&5
$as_echo "BID" >&6; }
@@ -4749,7 +4749,7 @@
;;
no) ;;
- *) as_fn_error $? "bad value for --enable-decimal-float: yes or no" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value for --enable-decimal-float: yes or no" "$LINENO" 5 ;;
esac
fi
@@ -5069,7 +5069,7 @@
MPFR_LIBM=''
case $host in
- *-*-beos* | *-*-cygwin* | *-*-pw32*)
+ *-*-beos* | *-*-cygwin* | *-*-msys* | *-*-pw32*)
# According to libtool AC CHECK LIBM, these systems don't have libm
;;
*-*-solaris*)
@@ -6968,7 +6968,7 @@
enable_win32_dll=yes
case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+*-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
@@ -7269,7 +7269,7 @@
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLL/static GMP" >&5
$as_echo_n "checking for DLL/static GMP... " >&6; }
if test "$enable_shared" = yes; then
@@ -7946,7 +7946,7 @@
lt_cv_sys_max_cmd_len=-1;
;;
- cygwin* | mingw* | cegcc*)
+ cygwin* | msys* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -8136,7 +8136,7 @@
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys* )
lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
;;
* ) # otherwise, assume *nix
@@ -8144,12 +8144,12 @@
;;
esac
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys*)
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
* ) # otherwise, assume *nix
@@ -8215,7 +8215,7 @@
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
if test "$GCC" != yes; then
reload_cmds=false
fi
@@ -8370,7 +8370,7 @@
lt_cv_file_magic_test_file=/shlib/libc.so
;;
-cygwin*)
+cygwin* | msys*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
@@ -8684,7 +8684,7 @@
lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh
# decide which to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
@@ -9176,7 +9176,7 @@
aix*)
symcode='[BCDT]'
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
symcode='[ABCDGISTW]'
;;
hpux*)
@@ -11004,7 +11004,7 @@
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -11088,7 +11088,7 @@
fi
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -11587,7 +11587,7 @@
extract_expsyms_cmds=
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -11705,7 +11705,7 @@
fi
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@@ -12163,7 +12163,7 @@
export_dynamic_flag_spec=-rdynamic
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -13116,7 +13116,7 @@
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
@@ -13148,6 +13148,12 @@
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
+ msys*)
+ # Msys DLLs use 'msys-' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/msys-/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
@@ -13182,7 +13188,7 @@
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
;;
- cygwin*)
+ cygwin* | msys*)
# Convert to unix form, then to dos form, then back to unix form
# but this time dos style (no spaces!) so that the unix form looks
# like /cygdrive/c/PROGRA~1:/cygdr...
@@ -13844,7 +13850,7 @@
lt_cv_dlopen_libs=
;;
- cygwin*)
+ cygwin* | msys*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
@@ -14683,7 +14689,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14738,7 +14744,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14787,7 +14793,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14836,7 +14842,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14885,7 +14891,7 @@
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16031,7 +16037,7 @@
"tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;;
"src/mparam.h") CONFIG_FILES="$CONFIG_FILES src/mparam.h:src/mparam_h.in" ;;
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
esac
done
@@ -16240,7 +16246,7 @@
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -16268,7 +16274,7 @@
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -16295,7 +16301,7 @@
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
diff -Naur mpfr-3.1.2/configure.ac mpfr-3.1.2-p/configure.ac
--- mpfr-3.1.2/configure.ac 2013-03-13 19:37:46.000000000 +0400
+++ mpfr-3.1.2-p/configure.ac 2013-03-18 07:13:02.149999846 +0400
@@ -359,7 +359,7 @@
AC_SUBST(LIBMPFR_LDFLAGS)
AC_LIBTOOL_WIN32_DLL
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2*)
AC_MSG_CHECKING(for DLL/static GMP)
if test "$enable_shared" = yes; then
MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
diff -Naur mpfr-3.1.2/ltmain.sh mpfr-3.1.2-p/ltmain.sh
--- mpfr-3.1.2/ltmain.sh 2013-03-13 19:38:16.000000000 +0400
+++ mpfr-3.1.2-p/ltmain.sh 2013-03-18 07:13:02.149999846 +0400
@@ -1180,7 +1180,7 @@
test "$opt_debug" = : || func_append preserve_args " --debug"
case $host in
- *cygwin* | *mingw* | *pw32* | *cegcc*)
+ *cygwin* | *msys* | *mingw* | *pw32* | *cegcc*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
@@ -2123,7 +2123,7 @@
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
- cygwin* | mingw* | pw32* | os2* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
@@ -2992,7 +2992,7 @@
'exit $?'
tstripme="$stripme"
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=""
@@ -3098,7 +3098,7 @@
# Do a test to see if this is really a libtool program.
case $host in
- *cygwin* | *mingw*)
+ *cygwin* | *msys* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
@@ -3173,7 +3173,7 @@
# remove .exe since cygwin /usr/bin/install will append another
# one anyway
case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
+ */usr/bin/install*,*cygwin*,*msys*)
case $file:$destfile in
*.exe:*.exe)
# this is ok
@@ -3323,7 +3323,7 @@
$RM $export_symbols
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin* | *msys* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
@@ -3335,7 +3335,7 @@
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin* | *msys* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
@@ -3349,7 +3349,7 @@
func_basename "$dlprefile"
name="$func_basename_result"
case $host in
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin* | *msys* | *mingw* | *cegcc* )
# if an import library, we need to obtain dlname
if func_win32_import_lib_p "$dlprefile"; then
func_tr_sh "$dlprefile"
@@ -3502,7 +3502,7 @@
# Transform the symbol file into the correct name.
symfileobj="$output_objdir/${my_outputname}S.$objext"
case $host in
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin* | *msys* | *mingw* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
@@ -4375,7 +4375,7 @@
{
EOF
case "$host" in
- *mingw* | *cygwin* )
+ *mingw* | *msys* | *cygwin* )
# make stdout use "unix" line endings
echo " setmode(1,_O_BINARY);"
;;
@@ -5094,7 +5094,7 @@
{
$opt_debug
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
@@ -5581,7 +5581,7 @@
;;
esac
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
@@ -5601,7 +5601,7 @@
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
# These systems don't actually have a C or math library (as such)
continue
;;
@@ -5679,7 +5679,7 @@
-no-install)
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "\`-no-install' is ignored for $host"
@@ -6548,7 +6548,7 @@
fi
case "$host" in
# special handling for platforms with PE-DLLs.
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin* | *msys* | *mingw* | *cegcc* )
# Linker will automatically link against shared library if both
# static and shared are present. Therefore, ensure we extract
# symbols from the import library if a shared library is present
@@ -6692,7 +6692,7 @@
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
case $host in
- *cygwin* | *mingw* | *cegcc*)
+ *cygwin* | *msys* | *mingw* | *cegcc*)
# No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib"
need_relink=no
@@ -6762,7 +6762,7 @@
elif test -n "$soname_spec"; then
# bleh windows
case $host in
- *cygwin* | mingw* | *cegcc*)
+ *cygwin* | *msys* | mingw* | *cegcc*)
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
@@ -7626,7 +7626,7 @@
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
@@ -8140,7 +8140,7 @@
orig_export_symbols=
case $host_os in
- cygwin* | mingw* | cegcc*)
+ cygwin* | msys* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
@@ -8696,7 +8696,7 @@
prog)
case $host in
- *cygwin*) func_stripname '' '.exe' "$output"
+ *cygwin* | *msys*) func_stripname '' '.exe' "$output"
output=$func_stripname_result.exe;;
esac
test -n "$vinfo" && \
@@ -8809,7 +8809,7 @@
esac
fi
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
@@ -8887,7 +8887,7 @@
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
wrappers_required=no
;;
- *cygwin* | *mingw* )
+ *cygwin* | *msys* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
@@ -9034,14 +9034,14 @@
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
- *cygwin*)
+ *cygwin* | *msys*)
exeext=.exe
func_stripname '' '.exe' "$outputname"
outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
- *cygwin* | *mingw* )
+ *cygwin* | *msys* | *mingw* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
@@ -9371,7 +9371,7 @@
# tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ *cygwin*,*lai,yes,no,*.dll | *msys*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
# If a -bindir argument was supplied, place the dll there.
if test "x$bindir" != x ;
then
diff -Naur mpfr-3.1.2/m4/libtool.m4 mpfr-3.1.2-p/m4/libtool.m4
--- mpfr-3.1.2/m4/libtool.m4 2013-03-13 19:38:16.000000000 +0400
+++ mpfr-3.1.2-p/m4/libtool.m4 2013-03-18 07:13:02.156666515 +0400
@@ -1623,7 +1623,7 @@
lt_cv_sys_max_cmd_len=-1;
;;
- cygwin* | mingw* | cegcc*)
+ cygwin* | msys* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1871,7 +1871,7 @@
lt_cv_dlopen_libs=
;;
- cygwin*)
+ cygwin* | msys*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
@@ -2342,7 +2342,7 @@
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
@@ -2374,6 +2374,12 @@
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
;;
+ msys*)
+ # Msys DLLs use 'msys-' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/msys-/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
@@ -2408,7 +2414,7 @@
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
;;
- cygwin*)
+ cygwin* | msys*)
# Convert to unix form, then to dos form, then back to unix form
# but this time dos style (no spaces!) so that the unix form looks
# like /cygdrive/c/PROGRA~1:/cygdr...
@@ -3149,7 +3155,7 @@
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
if test "$GCC" != yes; then
reload_cmds=false
fi
@@ -3205,7 +3211,7 @@
lt_cv_file_magic_test_file=/shlib/libc.so
;;
-cygwin*)
+cygwin* | msys*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
@@ -3511,7 +3517,7 @@
[lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh
# decide which to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
@@ -3566,7 +3572,7 @@
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-msys* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
# These system don't have libm, or don't need it
;;
*-ncr-sysv4.3*)
@@ -3641,7 +3647,7 @@
aix*)
symcode='[[BCDT]]'
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | msys* | mingw* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
@@ -3909,7 +3915,7 @@
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | os2* | pw32* | cegcc*)
+ mingw* | msys* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3980,7 +3986,7 @@
;;
esac
;;
- mingw* | cygwin* | os2* | pw32* | cegcc*)
+ mingw* | cygwin* | msys* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
@@ -4227,7 +4233,7 @@
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -4312,7 +4318,7 @@
fi
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
@@ -4580,7 +4586,7 @@
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
- cygwin* | mingw* | cegcc*)
+ cygwin* | msys* | mingw* | cegcc*)
case $cc_basename in
cl*)
_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
@@ -4641,7 +4647,7 @@
extract_expsyms_cmds=
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -4759,7 +4765,7 @@
fi
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -5133,7 +5139,7 @@
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -6134,7 +6140,7 @@
esac
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
case $GXX,$cc_basename in
,cl* | no,cl*)
# Native MSVC
@@ -7947,7 +7953,7 @@
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys* )
lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
;;
* ) # otherwise, assume *nix
@@ -7955,12 +7961,12 @@
;;
esac
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
- *-*-cygwin* )
+ *-*-cygwin* | *-*-msys*)
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
* ) # otherwise, assume *nix
diff -Naur mpfr-3.1.2/m4/ltoptions.m4 mpfr-3.1.2-p/m4/ltoptions.m4
--- mpfr-3.1.2/m4/ltoptions.m4 2013-03-13 19:38:16.000000000 +0400
+++ mpfr-3.1.2-p/m4/ltoptions.m4 2013-03-18 07:13:02.156666515 +0400
@@ -126,7 +126,7 @@
[enable_win32_dll=yes
case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+*-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)

779
mpfr/mpfr-3.1.2-p3.patch Normal file
View File

@@ -0,0 +1,779 @@
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
--- mpfr-3.1.2-a/PATCHES 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:52:52.000000000 +0000
@@ -0,0 +1 @@
+exp_2
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
--- mpfr-3.1.2-a/VERSION 2013-03-13 15:37:28.000000000 +0000
+++ mpfr-3.1.2-b/VERSION 2013-09-26 10:52:52.000000000 +0000
@@ -1 +1 @@
-3.1.2
+3.1.2-p1
diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c
--- mpfr-3.1.2-a/src/exp_2.c 2013-03-13 15:37:28.000000000 +0000
+++ mpfr-3.1.2-b/src/exp_2.c 2013-09-26 10:52:52.000000000 +0000
@@ -204,7 +204,7 @@
for (k = 0; k < K; k++)
{
mpz_mul (ss, ss, ss);
- exps <<= 1;
+ exps *= 2;
exps += mpz_normalize (ss, ss, q);
}
mpfr_set_z (s, ss, MPFR_RNDN);
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
--- mpfr-3.1.2-a/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000
+++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 2
-#define MPFR_VERSION_STRING "3.1.2"
+#define MPFR_VERSION_STRING "3.1.2-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
--- mpfr-3.1.2-a/src/version.c 2013-03-13 15:37:34.000000000 +0000
+++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:52:52.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.2";
+ return "3.1.2-p1";
}
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
--- mpfr-3.1.2-a/PATCHES 2013-09-26 10:56:55.000000000 +0000
+++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:56:55.000000000 +0000
@@ -0,0 +1 @@
+fits-smallneg
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
--- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/VERSION 2013-09-26 10:56:55.000000000 +0000
@@ -1 +1 @@
-3.1.2-p1
+3.1.2-p2
diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h
--- mpfr-3.1.2-a/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000
+++ mpfr-3.1.2-b/src/fits_u.h 2013-09-26 10:56:55.000000000 +0000
@@ -32,17 +32,20 @@
int res;
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
- /* Zero always fit */
- return MPFR_IS_ZERO (f) ? 1 : 0;
- else if (MPFR_IS_NEG (f))
- /* Negative numbers don't fit */
- return 0;
- /* now it fits if
- (a) f <= MAXIMUM
- (b) round(f, prec(slong), rnd) <= MAXIMUM */
+ return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */
e = MPFR_GET_EXP (f);
+ if (MPFR_IS_NEG (f))
+ return e >= 1 ? 0 /* f <= -1 does not fit */
+ : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */
+ : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */
+ : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */
+
+ /* Now it fits if
+ (a) f <= MAXIMUM
+ (b) round(f, prec(slong), rnd) <= MAXIMUM */
+
/* first compute prec(MAXIMUM); fits in an int */
for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++);
diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c
--- mpfr-3.1.2-a/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +0000
+++ mpfr-3.1.2-b/src/fits_uintmax.c 2013-09-26 10:56:55.000000000 +0000
@@ -27,51 +27,19 @@
#include "mpfr-intmax.h"
#include "mpfr-impl.h"
-#ifdef _MPFR_H_HAVE_INTMAX_T
-
-/* We can't use fits_u.h <= mpfr_cmp_ui */
-int
-mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
-{
- mpfr_exp_t e;
- int prec;
- uintmax_t s;
- mpfr_t x;
- int res;
-
- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
- /* Zero always fit */
- return MPFR_IS_ZERO (f) ? 1 : 0;
- else if (MPFR_IS_NEG (f))
- /* Negative numbers don't fit */
- return 0;
- /* now it fits if
- (a) f <= MAXIMUM
- (b) round(f, prec(slong), rnd) <= MAXIMUM */
-
- e = MPFR_GET_EXP (f);
-
- /* first compute prec(MAXIMUM); fits in an int */
- for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++);
-
- /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */
-
- /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */
- if (e <= prec - 1)
- return 1;
+/* Note: though mpfr-impl.h is included in fits_u.h, we also include it
+ above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not
+ defined; this is necessary to avoid an empty translation unit, which
+ is forbidden by ISO C. Without this, a failing test can be reproduced
+ by creating an invalid stdint.h somewhere in the default include path
+ and by compiling MPFR with "gcc -ansi -pedantic-errors". */
- /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */
- if (e >= prec + 1)
- return 0;
+#ifdef _MPFR_H_HAVE_INTMAX_T
- MPFR_ASSERTD (e == prec);
+#define FUNCTION mpfr_fits_uintmax_p
+#define MAXIMUM MPFR_UINTMAX_MAX
+#define TYPE uintmax_t
- /* hard case: first round to prec bits, then check */
- mpfr_init2 (x, prec);
- mpfr_set (x, f, rnd);
- res = MPFR_GET_EXP (x) == e;
- mpfr_clear (x);
- return res;
-}
+#include "fits_u.h"
#endif
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
--- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:56:55.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 2
-#define MPFR_VERSION_STRING "3.1.2-p1"
+#define MPFR_VERSION_STRING "3.1.2-p2"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
--- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:56:55.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.2-p1";
+ return "3.1.2-p2";
}
diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c
--- mpfr-3.1.2-a/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000
+++ mpfr-3.1.2-b/tests/tfits.c 2013-09-26 10:56:55.000000000 +0000
@@ -33,155 +33,176 @@
#include "mpfr-intmax.h"
#include "mpfr-test.h"
-#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); }
-#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); }
+#define ERROR1(N) \
+ do \
+ { \
+ printf("Error %d for rnd = %s and x = ", N, \
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \
+ mpfr_dump(x); \
+ exit(1); \
+ } \
+ while (0)
static void check_intmax (void);
int
main (void)
{
- mpfr_t x;
+ mpfr_t x, y;
+ int i, r;
tests_start_mpfr ();
mpfr_init2 (x, 256);
+ mpfr_init2 (y, 8);
- /* Check NAN */
- mpfr_set_nan (x);
- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR1;
+ RND_LOOP (r)
+ {
- /* Check INF */
- mpfr_set_inf (x, 1);
- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check NAN */
+ mpfr_set_nan (x);
+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (1);
+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (2);
+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (3);
+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (4);
+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (5);
+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (6);
- /* Check Zero */
- MPFR_SET_ZERO (x);
- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check INF */
+ mpfr_set_inf (x, 1);
+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (7);
+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (8);
+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (9);
+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (10);
+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (11);
+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (12);
- /* Check small op */
- mpfr_set_str1 (x, "1@-1");
- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check Zero */
+ MPFR_SET_ZERO (x);
+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (13);
+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (14);
+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (15);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (16);
+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (17);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (18);
- /* Check 17 */
- mpfr_set_ui (x, 17, MPFR_RNDN);
- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check small positive op */
+ mpfr_set_str1 (x, "1@-1");
+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (19);
+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (20);
+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (21);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (22);
+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (23);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (24);
- /* Check all other values */
- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
- mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR1;
- mpfr_mul_2exp (x, x, 40, MPFR_RNDN);
- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check 17 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (25);
+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (26);
+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (27);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (28);
+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (29);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (30);
- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);
- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);
- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_ui (x, INT_MAX, MPFR_RNDN);
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);
- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check all other values */
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (31);
+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (32);
+ mpfr_mul_2exp (x, x, 40, MPFR_RNDN);
+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (33);
+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (34);
+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (35);
+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (36);
+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (37);
- mpfr_set_si (x, 1, MPFR_RNDN);
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (38);
+ mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);
+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (39);
+ mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (40);
+ mpfr_set_ui (x, INT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (41);
+ mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (42);
+ mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (43);
- /* Check negative value */
- mpfr_set_si (x, -1, MPFR_RNDN);
- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
- ERROR2;
- if (mpfr_fits_uint_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
- ERROR1;
+ mpfr_set_si (x, 1, MPFR_RNDN);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (44);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (45);
+
+ /* Check negative op */
+ for (i = 1; i <= 4; i++)
+ {
+ int inv;
+
+ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN);
+ mpfr_rint (y, x, (mpfr_rnd_t) r);
+ inv = MPFR_NOTZERO (y);
+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv)
+ ERROR1 (46);
+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
+ ERROR1 (47);
+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv)
+ ERROR1 (48);
+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
+ ERROR1 (49);
+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv)
+ ERROR1 (50);
+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
+ ERROR1 (51);
+ }
+ }
mpfr_clear (x);
+ mpfr_clear (y);
check_intmax ();
@@ -189,85 +210,98 @@
return 0;
}
-static void check_intmax (void)
+static void
+check_intmax (void)
{
#ifdef _MPFR_H_HAVE_INTMAX_T
- mpfr_t x;
+ mpfr_t x, y;
+ int i, r;
- mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT);
+ mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT);
+ mpfr_init2 (y, 8);
- /* Check NAN */
- mpfr_set_nan (x);
- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR1;
+ RND_LOOP (r)
+ {
+ /* Check NAN */
+ mpfr_set_nan (x);
+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (52);
+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (53);
- /* Check INF */
- mpfr_set_inf (x, 1);
- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check INF */
+ mpfr_set_inf (x, 1);
+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (54);
+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (55);
- /* Check Zero */
- MPFR_SET_ZERO (x);
- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check Zero */
+ MPFR_SET_ZERO (x);
+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (56);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (57);
- /* Check small op */
- mpfr_set_str1 (x, "1@-1");
- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check positive small op */
+ mpfr_set_str1 (x, "1@-1");
+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (58);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (59);
- /* Check 17 */
- mpfr_set_ui (x, 17, MPFR_RNDN);
- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR2;
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
+ /* Check 17 */
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (60);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (61);
- /* Check hugest */
- mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR1;
- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check hugest */
+ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (62);
+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (63);
- /* Check all other values */
- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
- mpfr_add_ui (x, x, 1, MPFR_RNDN);
- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR1;
- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
- mpfr_add_ui (x, x, 1, MPFR_RNDN);
- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR1;
- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
- mpfr_sub_ui (x, x, 1, MPFR_RNDN);
- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check all other values */
+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (64);
+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (65);
+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (66);
+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (67);
+ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (68);
+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (69);
- /* Check negative value */
- mpfr_set_si (x, -1, MPFR_RNDN);
- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
- ERROR2;
- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
- ERROR1;
+ /* Check negative op */
+ for (i = 1; i <= 4; i++)
+ {
+ int inv;
+
+ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN);
+ mpfr_rint (y, x, (mpfr_rnd_t) r);
+ inv = MPFR_NOTZERO (y);
+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv)
+ ERROR1 (70);
+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
+ ERROR1 (71);
+ }
+ }
mpfr_clear (x);
+ mpfr_clear (y);
#endif
}
-
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
--- mpfr-3.1.2-a/PATCHES 2013-10-09 13:34:21.000000000 +0000
+++ mpfr-3.1.2-b/PATCHES 2013-10-09 13:34:21.000000000 +0000
@@ -0,0 +1 @@
+clang-divby0
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
--- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/VERSION 2013-10-09 13:34:21.000000000 +0000
@@ -1 +1 @@
-3.1.2-p2
+3.1.2-p3
diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h
--- mpfr-3.1.2-a/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000
+++ mpfr-3.1.2-b/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000
@@ -468,8 +468,16 @@
#define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1)
/* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0
- at compile time. */
-#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)
+ at compile time.
+ Clang with -fsanitize=undefined is a bit similar due to a bug:
+ http://llvm.org/bugs/show_bug.cgi?id=17381
+ but even without its sanitizer, it may be better to use the
+ double_zero version until IEEE 754 division by zero is properly
+ supported:
+ http://llvm.org/bugs/show_bug.cgi?id=17000
+*/
+#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \
+ defined(__clang__)
static double double_zero = 0.0;
# define DBL_NAN (double_zero/double_zero)
# define DBL_POS_INF ((double) 1.0/double_zero)
@@ -501,6 +509,8 @@
(with Xcode 2.4.1, i.e. the latest one). */
#define LVALUE(x) (&(x) == &(x) || &(x) != &(x))
#define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX))
+/* The DOUBLE_ISNAN(x) macro is also valid on long double x
+ (assuming that the compiler isn't too broken). */
#ifdef MPFR_NANISNAN
/* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations.
The + must not be replaced by a ||. With gcc -ffast-math, NaN is
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
--- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/src/mpfr.h 2013-10-09 13:34:21.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 2
-#define MPFR_VERSION_STRING "3.1.2-p2"
+#define MPFR_VERSION_STRING "3.1.2-p3"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
--- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000
+++ mpfr-3.1.2-b/src/version.c 2013-10-09 13:34:21.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.2-p2";
+ return "3.1.2-p3";
}
diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c
--- mpfr-3.1.2-a/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000
+++ mpfr-3.1.2-b/tests/tget_flt.c 2013-10-09 13:34:21.000000000 +0000
@@ -28,9 +28,17 @@
main (void)
{
mpfr_t x, y;
- float f, g, infp;
+ float f, g;
int i;
+#if !defined(MPFR_ERRDIVZERO)
+ float infp;
+#endif
+
+ tests_start_mpfr ();
+#if !defined(MPFR_ERRDIVZERO)
+ /* The definition of DBL_POS_INF involves a division by 0. This makes
+ "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */
infp = (float) DBL_POS_INF;
if (infp * 0.5 != infp)
{
@@ -38,8 +46,7 @@
fprintf (stderr, "(this is probably a compiler bug, please report)\n");
exit (1);
}
-
- tests_start_mpfr ();
+#endif
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
@@ -353,6 +360,7 @@
printf ("expected %.8e, got %.8e\n", g, f);
exit (1);
}
+#if !defined(MPFR_ERRDIVZERO)
f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule),
thus we should get +Inf */
g = infp;
@@ -376,6 +384,7 @@
printf ("expected %.8e, got %.8e\n", g, f);
exit (1);
}
+#endif
mpfr_clear (x);
mpfr_clear (y);
diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c
--- mpfr-3.1.2-a/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000
+++ mpfr-3.1.2-b/tests/tset_ld.c 2013-10-09 13:34:21.000000000 +0000
@@ -47,8 +47,11 @@
static int
Isnan_ld (long double d)
{
- double e = (double) d;
- if (DOUBLE_ISNAN (e))
+ /* Do not convert d to double as this can give an overflow, which
+ may confuse compilers without IEEE 754 support (such as clang
+ -fsanitize=undefined), or trigger a trap if enabled.
+ The DOUBLE_ISNAN macro should work fine on long double. */
+ if (DOUBLE_ISNAN (d))
return 1;
LONGDOUBLE_NAN_ACTION (d, goto yes);
return 0;

20
mpfr/mpfr.install Normal file
View File

@@ -0,0 +1,20 @@
info_dir=usr/share/info
info_files=(mpfr.info)
post_install() {
[ -x usr/bin/install-info ]
for f in ${info_files[@]}; do
install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ]
for f in ${info_files[@]}; do
install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}