patches/mpfr/2.4.1/150-test-tmul.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
permissions -rw-r--r--
complibs/cloog: fix linking with libm

In Ubuntu 11.04 and 11.10, the default options for ld have changed.
--no-copy-dt-needed-entries and --as-needed are now enabled by default, which
causes errors like:

[EXTRA] Checking CLooG/ppl
[DEBUG] ==> Executing: 'make' '-j3' '-s' 'check'
[ALL ] Making check in .
[ALL ] config.status: creating include/cloog/cloog-config.h
[ALL ] config.status: include/cloog/cloog-config.h is unchanged
[ALL ] libtool: link: i686-build_pc-linux-gnu-gcc -Wall -fomit-frame-pointer
-pipe -o cloog cloog.o -L/<snip>/build/static/lib ./.libs/libcloog.a -lm
/<snip>/build/static/lib/libppl_c.a /<snip>/build/static/lib/libpwl.a
/<snip>/build/static/lib/libppl.a /<snip>/build/static/lib/libgmpxx.a
/<snip>/build/static/lib/libgmp.a -lstdc++
[ALL ] /usr/bin/ld: /<snip>/build/static/lib/libppl.a(MIP_Problem.o):
undefined reference to symbol 'sqrt@@GLIBC_2.0'
[ALL ] /usr/bin/ld: note: 'sqrt@@GLIBC_2.0' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so so try adding
it to the linker command line
[ALL ] /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so:
could not read symbols: Invalid operation
[ALL ] collect2: ld returned 1 exit status
[ERROR] make[2]: *** [cloog] Error 1
[ERROR] make[1]: *** [check-recursive] Error 1

See:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

This patch fixes these errors by placing '-lm' at the right place on the command
line as libppl requires libm when linking cloog.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
oron@1449
     1
diff -up ./tests/Makefile.am.orig ./tests/Makefile.am
oron@1449
     2
--- ./tests/Makefile.am.orig	2009-07-28 16:28:55.377059021 +0300
oron@1449
     3
+++ ./tests/Makefile.am	2009-07-28 16:31:01.136810734 +0300
oron@1449
     4
@@ -20,7 +20,7 @@ check_PROGRAMS = tversion tinternals tin
oron@1449
     5
 
oron@1449
     6
 EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
oron@1449
     7
 
oron@1449
     8
-tmul_CPPFLAGS = -DMPFR_SRCDIR=$(srcdir)
oron@1449
     9
+tmul_CPPFLAGS = -DMPFR_SRCDIR=\"$(srcdir)\"
oron@1449
    10
 
oron@1449
    11
 LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/libmpfr.la
oron@1449
    12
 INCLUDES = -I$(top_srcdir) -I$(top_builddir)
oron@1449
    13
diff -up ./tests/tmul.c.orig ./tests/tmul.c
oron@1449
    14
--- ./tests/tmul.c.orig	2009-07-28 16:29:03.761058919 +0300
oron@1449
    15
+++ ./tests/tmul.c	2009-07-28 16:30:46.369812215 +0300
oron@1449
    16
@@ -26,10 +26,8 @@ MA 02110-1301, USA. */
oron@1449
    17
 #include "mpfr-test.h"
oron@1449
    18
 
oron@1449
    19
 #ifndef MPFR_SRCDIR
oron@1449
    20
-#define MPFR_SRCDIR .
oron@1449
    21
+#define MPFR_SRCDIR "."
oron@1449
    22
 #endif
oron@1449
    23
-#define QUOTE(X) NAME(X)
oron@1449
    24
-#define NAME(X) #X
oron@1449
    25
 
oron@1449
    26
 #ifdef CHECK_EXTERNAL
oron@1449
    27
 static int
oron@1449
    28
@@ -482,10 +480,10 @@ check_regression (void)
oron@1449
    29
   mpfr_inits2 (6177, x, y, z, (mpfr_ptr) 0);
oron@1449
    30
   /* we read long strings from a file since ISO C90 does not support strings of
oron@1449
    31
      length > 509 */
oron@1449
    32
-  fp = fopen (QUOTE (MPFR_SRCDIR)"/tmul.dat", "r");
oron@1449
    33
+  fp = fopen (MPFR_SRCDIR "/tmul.dat", "r");
oron@1449
    34
   if (fp == NULL)
oron@1449
    35
     {
oron@1449
    36
-      fprintf (stderr, "Error, cannot open "QUOTE (MPFR_SRCDIR)"/tmul.dat\n");
oron@1449
    37
+      fprintf (stderr, "Error, cannot open " MPFR_SRCDIR "/tmul.dat\n");
oron@1449
    38
       exit (1);
oron@1449
    39
     }
oron@1449
    40
   get_string (s, fp);