]> git.pld-linux.org Git - packages/clamav.git/blame - clamav-add-support-for-system-tomsfastmath.patch
- updated to 0.103.0
[packages/clamav.git] / clamav-add-support-for-system-tomsfastmath.patch
CommitLineData
7fae6205
AG
1From 06669d85088f588ceb781f93367bb5428874ed27 Mon Sep 17 00:00:00 2001
2From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3Date: Wed, 11 Mar 2015 20:03:15 +0100
4Subject: add support for system tomsfastmath
5
6Patch-Name: add-support-for-system-tomsfastmath.patch
7---
8 configure.ac | 2 ++
9 libclamav/Makefile.am | 10 ++++++++--
10 libclamav/bignum.h | 6 +++++-
11 libclamav/xdp.c | 2 +-
12 m4/reorganization/libs/tomsfastmath.m4 | 12 ++++++++++++
13 5 files changed, 28 insertions(+), 4 deletions(-)
14 create mode 100644 m4/reorganization/libs/tomsfastmath.m4
15
16diff --git a/configure.ac b/configure.ac
17index 9ef4105..a286b44 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -82,6 +82,7 @@ m4_include([m4/reorganization/libs/xml.m4])
21 m4_include([m4/reorganization/libs/json.m4])
22 m4_include([m4/reorganization/libs/pcre.m4])
23 m4_include([m4/reorganization/libs/libmspack.m4])
24+m4_include([m4/reorganization/libs/tomsfastmath.m4])
25
26 if test "x$use_internal_mspack" = "xno"; then
27 mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
28@@ -286,6 +287,7 @@ fi
29 CL_MSG_STATUS([yara ],[$enable_yara],[$enable_yara])
30 CL_MSG_STATUS([fts ],[yes],[$lfs_fts_msg])
31
32+CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
33
34 # Yep, downgrading the compiler avoids the bug too:
35 # 4.0.x, and 4.1.0 are the known buggy versions
8cdcf5e0
JB
36--- clamav-0.103.0/libclamav/Makefile.am.orig 2020-09-13 02:27:09.000000000 +0200
37+++ clamav-0.103.0/libclamav/Makefile.am 2020-11-23 06:32:13.715611447 +0100
38@@ -588,7 +588,10 @@
7fae6205
AG
39 yara_clam.h
40 endif
41
42-libclamav_la_SOURCES += bignum.h\
7fae6205
AG
43+libclamav_la_SOURCES += bignum.h
44+
45+if !SYSTEM_TOMSFASTMATH
8cdcf5e0
JB
46+libclamav_la_SOURCES += \
47 bignum_fast.h\
48 tomsfastmath/addsub/fp_add.c\
49 tomsfastmath/addsub/fp_add_d.c\
50@@ -671,6 +674,10 @@
51 tomsfastmath/sqr/fp_sqr_comba_generic.c\
52 tomsfastmath/sqr/fp_sqr_comba_small_set.c\
7fae6205
AG
53 tomsfastmath/sqr/fp_sqrmod.c
54+else
55+libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
56+libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
57+endif
58
8cdcf5e0 59 .PHONY2: version.h.tmp
7fae6205
AG
60 version.c: version.h
61diff --git a/libclamav/bignum.h b/libclamav/bignum.h
62index 9acb17b..56967b1 100644
63--- a/libclamav/bignum.h
64+++ b/libclamav/bignum.h
65@@ -1,9 +1,13 @@
66 #ifndef BIGNUM_H_
67 #define BIGNUM_H_
68
69+#if HAVE_SYSTEM_TOMSFASTMATH
70+#include <tfm.h>
71+#else
72 #define TFM_CHECK
73-
74 #include "bignum_fast.h"
75+#endif
76+
77 typedef fp_int mp_int;
78 #define mp_cmp fp_cmp
79 #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
80diff --git a/libclamav/xdp.c b/libclamav/xdp.c
81index 00edfa8..674dc7c 100644
82--- a/libclamav/xdp.c
83+++ b/libclamav/xdp.c
84@@ -57,7 +57,7 @@
85 #include "scanners.h"
86 #include "conv.h"
87 #include "xdp.h"
88-#include "bignum_fast.h"
89+#include "bignum.h"
90 #include "filetypes.h"
91
92 static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
93diff --git a/m4/reorganization/libs/tomsfastmath.m4 b/m4/reorganization/libs/tomsfastmath.m4
94new file mode 100644
95index 0000000..2a821a1
96--- /dev/null
97+++ b/m4/reorganization/libs/tomsfastmath.m4
98@@ -0,0 +1,12 @@
99+dnl Check for system tomsfastmath
100+PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
101+
102+AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
103+
104+if test "x$have_system_tomsfastmath" = "xyes"; then
105+ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
106+ tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
107+else
108+ AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
109+ tomsfastmath_msg="Internal"
110+fi
This page took 0.044718 seconds and 4 git commands to generate.