summaryrefslogtreecommitdiff
path: root/sci-libs/m4ri/files/m4ri-20200115-libm_underlinking.patch
blob: 8d9d2738c087d26157a211eaa03864bf18cf6fbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From be6c249e7838bd838174db5c2bb98bf63b026b83 Mon Sep 17 00:00:00 2001
From: François Bissey <frp.bissey@gmail.com>
Date: Tue, 21 Jan 2020 11:24:50 +1300
Subject: [PATCH] Detect and use LIBM to link libm4ri in all cases.

---
 Makefile.am       | 2 +-
 configure.ac      | 6 +++++-
 m4ri.pc.in        | 2 +-
 tests/Makefile.am | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e317d06..416d9f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,7 +58,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = m4ri.pc
 
 libm4ri_la_LDFLAGS = -release 0.0.$(RELEASE) -no-undefined
-libm4ri_la_LIBADD = $(LIBPNG_LIBADD)
+libm4ri_la_LIBADD = $(LIBPNG_LIBADD) $(LIBM)
 
 SUBDIRS = . tests
 DIST_SUBDIRS = $(SUBDIRS) bench
diff --git a/configure.ac b/configure.ac
index 39de702..520154d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@ AC_CONFIG_MACRO_DIR([m4])
 dnl Compiling with per-target flags (test_elimination.c) requires AM_PROG_CC_C_O.
 AM_PROG_CC_C_O
 
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_INSTALL
 
@@ -26,6 +26,10 @@ if test "$ac_cv_prog_cc_c99" = "no"; then
   AC_MSG_ERROR([C99 support is required but not found.])
 fi
 
+# Find and set LIBM on the platform.
+LT_LIB_M
+AC_SUBST(LIBM)
+
 # SSE2 support
 AC_ARG_ENABLE([sse2],
         AS_HELP_STRING([--disable-sse2], [don't use SSE2 instruction set.]),
diff --git a/m4ri.pc.in b/m4ri.pc.in
index 5044de7..07597bd 100644
--- a/m4ri.pc.in
+++ b/m4ri.pc.in
@@ -7,5 +7,5 @@ Name: M4RI
 Description: Dense linear algebra over GF(2).
 Version: @PACKAGE_VERSION@
 Requires: @M4RI_USE_PNG_PC@
-Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ -lm
+Libs: -L${libdir} -lm4ri @RAW_LIBPNG@ @LIBM@
 Cflags: -I${includedir} @SIMD_CFLAGS@ @OPENMP_CFLAGS@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c9839a2..069e360 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,7 @@ DEFINES =
 AM_CFLAGS = -I$(TOPSRCDIR) -I$(TOPBUILDDIR) -D_XOPEN_SOURCE=600 $(DEFINES) @OPENMP_CFLAGS@ @PAPI_CFLAGS@
 
 STAGEDIR := $(realpath -s $(TOPBUILDDIR)/.libs)
-AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri -lm @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install
+AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lm4ri $(LIBM) @PAPI_LDFLAGS@ @PAPI_LIBS@ -no-install
 
 test_smallops_SOURCES = test_smallops.c testing.c testing.h
 
-- 
2.10.5