X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=mpfr%2Ftests%2Ftversion.c;fp=mpfr%2Ftests%2Ftversion.c;h=e9497a5ca9c71ce50cae93353e0a1954d1aedd1e;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/mpfr/tests/tversion.c b/mpfr/tests/tversion.c new file mode 100644 index 00000000..e9497a5c --- /dev/null +++ b/mpfr/tests/tversion.c @@ -0,0 +1,63 @@ +/* Test file for mpfr_version. + +Copyright 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +Contributed by the Arenaire and Cacao projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +MA 02110-1301, USA. */ + +#include +#include +#include + +#include "mpfr-test.h" + +int +main (void) +{ + char buffer[256]; + + /* Test the MPFR version. */ + test_version (); + + sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, + __GNU_MP_VERSION_PATCHLEVEL); + if (strcmp (buffer, gmp_version) == 0) + return 0; + if (__GNU_MP_VERSION_PATCHLEVEL == 0) + { + sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); + if (strcmp (buffer, gmp_version) == 0) + return 0; + } + + /* In some cases, it may be acceptable to have different versions for + the header and the library, in particular when shared libraries are + used (e.g., after a bug-fix upgrade of the library). Versioning takes + care of that, as long as the user has a correct configuration (which + is not always the case, hence the following warning). Moreover MPFR + uses GMP internals, which may lead to incompatibilities even though + GMP's public interface has not changed (the following warning is + useful in that case too). */ + printf ("WARNING! The versions of gmp.h (%s) and libgmp (%s) do not " + "match.\nThis may lead to errors, in particular with MPFR. " + "If some tests fail,\nplease check that first. As we are not " + "sure, we do not regard this as\nan error.\n", + buffer, gmp_version); + + return 0; +}