summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOron Peled <oron@actcom.co.il>2009-08-02 22:49:25 (GMT)
committerOron Peled <oron@actcom.co.il>2009-08-02 22:49:25 (GMT)
commitfccc3ab4c0b28112de5bf7cfb05dd50f1509dbf8 (patch)
tree86cb876ce5d56bcfde6d247e3d663ecd5edb4a1b
parent803599b4bd277987d49cd632b7648cfabb5ec2bf (diff)
[complib:mpfr] Fix building MPFR in some weird cases
The tmul test uses a compiled-in input file in $(srcdir). The problem is that the Makefile passes it unquoted. The C code tries to stringify it using clever macros, which may *usually* work. In my case the source directory was named: .../toolchain-powerpc-e500v2-linux-gnuspe-1.0-2.fc10/.../tests And guess what? During testing I found out the program fails because it tries to open: .../toolchain-powerpc-e500v2-1-gnuspe-1.0-2.fc10/.../tests Yes, CPP tokenized the macro before stringifying it and not surprisingly the 'linux' part was converted to 1. [on Fedora-10: cpp (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)] So the attached patch simplify the macros and pass the path as string from the Makefile. Manually backported from 1449:8ad2773e7ae3
-rw-r--r--patches/mpfr/2.4.1/150-test-tmul.patch41
-rw-r--r--scripts/build/mpfr.sh9
2 files changed, 50 insertions, 0 deletions
diff --git a/patches/mpfr/2.4.1/150-test-tmul.patch b/patches/mpfr/2.4.1/150-test-tmul.patch
new file mode 100644
index 0000000..0ea970a
--- /dev/null
+++ b/patches/mpfr/2.4.1/150-test-tmul.patch
@@ -0,0 +1,41 @@
+diff -up ./tests/Makefile.am.orig ./tests/Makefile.am
+--- ./tests/Makefile.am.orig 2009-07-28 16:28:55.377059021 +0300
++++ ./tests/Makefile.am 2009-07-28 16:31:01.136810734 +0300
+@@ -20,7 +20,7 @@ check_PROGRAMS = tversion tinternals tin
+
+ EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
+
+-tmul_CPPFLAGS = -DMPFR_SRCDIR=$(srcdir)
++tmul_CPPFLAGS = -DMPFR_SRCDIR=\"$(srcdir)\"
+
+ LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/libmpfr.la
+ INCLUDES = -I$(top_srcdir) -I$(top_builddir)
+diff -up ./tests/tmul.c.orig ./tests/tmul.c
+--- ./tests/tmul.c.orig 2009-07-28 16:29:03.761058919 +0300
++++ ./tests/tmul.c 2009-07-28 16:30:46.369812215 +0300
+@@ -26,10 +26,8 @@ MA 02110-1301, USA. */
+ #include "mpfr-test.h"
+
+ #ifndef MPFR_SRCDIR
+-#define MPFR_SRCDIR .
++#define MPFR_SRCDIR "."
+ #endif
+-#define QUOTE(X) NAME(X)
+-#define NAME(X) #X
+
+ #ifdef CHECK_EXTERNAL
+ static int
+@@ -482,10 +480,10 @@ check_regression (void)
+ mpfr_inits2 (6177, x, y, z, (mpfr_ptr) 0);
+ /* we read long strings from a file since ISO C90 does not support strings of
+ length > 509 */
+- fp = fopen (QUOTE (MPFR_SRCDIR)"/tmul.dat", "r");
++ fp = fopen (MPFR_SRCDIR "/tmul.dat", "r");
+ if (fp == NULL)
+ {
+- fprintf (stderr, "Error, cannot open "QUOTE (MPFR_SRCDIR)"/tmul.dat\n");
++ fprintf (stderr, "Error, cannot open " MPFR_SRCDIR "/tmul.dat\n");
+ exit (1);
+ }
+ get_string (s, fp);
+
diff --git a/scripts/build/mpfr.sh b/scripts/build/mpfr.sh
index e302ff7..19fcb81 100644
--- a/scripts/build/mpfr.sh
+++ b/scripts/build/mpfr.sh
@@ -30,6 +30,15 @@ do_mpfr_extract() {
# do that in the future...
# It seems that MPFR >= 2.4.0 do not need this...
case "${CT_MPFR_VERSION}" in
+ 2.4.1)
+ CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
+ if [ ! -f .autoreconf.ct-ng ]; then
+ CT_DoLog DEBUG "Running autoreconf"
+ CT_DoExecLog ALL autoreconf
+ touch .autoreconf.ct-ng
+ fi
+ CT_Popd
+ ;;
1.*|2.0.*|2.1.*|2.2.*|2.3.*)
CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
if [ ! -f .autotools.ct-ng ]; then