]> git.pld-linux.org Git - packages/clamav.git/blob - clamav-add-support-for-system-tomsfastmath.patch
- rediff patches
[packages/clamav.git] / clamav-add-support-for-system-tomsfastmath.patch
1 From 06669d85088f588ceb781f93367bb5428874ed27 Mon Sep 17 00:00:00 2001
2 From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 Date: Wed, 11 Mar 2015 20:03:15 +0100
4 Subject: add support for system tomsfastmath
5
6 Patch-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
16 diff -urNp -x '*.orig' clamav-0.103.0.org/configure.ac clamav-0.103.0/configure.ac
17 --- clamav-0.103.0.org/configure.ac     2021-04-06 16:40:12.175486852 +0200
18 +++ clamav-0.103.0/configure.ac 2021-04-06 16:40:12.575507635 +0200
19 @@ -94,6 +94,7 @@ m4_include([m4/reorganization/libs/opens
20  m4_include([m4/reorganization/libs/json.m4])
21  m4_include([m4/reorganization/libs/pcre.m4])
22  m4_include([m4/reorganization/libs/libmspack.m4])
23 +m4_include([m4/reorganization/libs/tomsfastmath.m4])
24  
25  if test "x$use_internal_mspack" = "xno"; then
26      mspack_msg="External, $LIBMSPACK_CFLAGS $LIBMSPACK_LIBS"
27 @@ -362,6 +363,7 @@ fi
28  CL_MSG_STATUS([yara        ],[$enable_yara],[$enable_yara])
29  CL_MSG_STATUS([fts         ],[yes],[$lfs_fts_msg])
30  
31 +CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
32  
33  # Yep, downgrading the compiler avoids the bug too:
34  # 4.0.x, and 4.1.0 are the known buggy versions
35 diff -urNp -x '*.orig' clamav-0.103.0.org/libclamav/Makefile.am clamav-0.103.0/libclamav/Makefile.am
36 --- clamav-0.103.0.org/libclamav/Makefile.am    2020-09-13 02:27:09.000000000 +0200
37 +++ clamav-0.103.0/libclamav/Makefile.am        2021-04-06 16:40:12.575507635 +0200
38 @@ -588,7 +588,10 @@ libclamav_la_SOURCES += yara_arena.c \
39         yara_clam.h
40  endif
41  
42 -libclamav_la_SOURCES += bignum.h\
43 +libclamav_la_SOURCES += bignum.h
44 +
45 +if !SYSTEM_TOMSFASTMATH
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 @@ libclamav_la_SOURCES += bignum.h\
51         tomsfastmath/sqr/fp_sqr_comba_generic.c\
52         tomsfastmath/sqr/fp_sqr_comba_small_set.c\
53         tomsfastmath/sqr/fp_sqrmod.c
54 +else
55 +libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
56 +libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
57 +endif
58  
59  .PHONY2: version.h.tmp
60  version.c: version.h
61 diff -urNp -x '*.orig' clamav-0.103.0.org/libclamav/bignum.h clamav-0.103.0/libclamav/bignum.h
62 --- clamav-0.103.0.org/libclamav/bignum.h       2020-09-13 02:27:09.000000000 +0200
63 +++ clamav-0.103.0/libclamav/bignum.h   2021-04-06 16:40:12.578841141 +0200
64 @@ -1,9 +1,13 @@
65  #ifndef BIGNUM_H_
66  #define BIGNUM_H_
67  
68 +#if HAVE_SYSTEM_TOMSFASTMATH
69 +#include <tfm.h>
70 +#else
71  #define TFM_CHECK
72 -
73  #include "bignum_fast.h"
74 +#endif
75 +
76  typedef fp_int mp_int;
77  #define mp_cmp fp_cmp
78  #define mp_toradix_n(a, b, c, d) fp_toradix_n(a, b, c, d)
79 diff -urNp -x '*.orig' clamav-0.103.0.org/libclamav/xdp.c clamav-0.103.0/libclamav/xdp.c
80 --- clamav-0.103.0.org/libclamav/xdp.c  2020-09-13 02:27:10.000000000 +0200
81 +++ clamav-0.103.0/libclamav/xdp.c      2021-04-06 16:40:12.578841141 +0200
82 @@ -52,7 +52,7 @@
83  #include "scanners.h"
84  #include "conv.h"
85  #include "xdp.h"
86 -#include "bignum_fast.h"
87 +#include "bignum.h"
88  #include "filetypes.h"
89  
90  static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
91 diff -urNp -x '*.orig' clamav-0.103.0.org/m4/reorganization/libs/tomsfastmath.m4 clamav-0.103.0/m4/reorganization/libs/tomsfastmath.m4
92 --- clamav-0.103.0.org/m4/reorganization/libs/tomsfastmath.m4   1970-01-01 01:00:00.000000000 +0100
93 +++ clamav-0.103.0/m4/reorganization/libs/tomsfastmath.m4       2021-04-06 16:40:12.578841141 +0200
94 @@ -0,0 +1,12 @@
95 +dnl Check for system tomsfastmath
96 +PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
97 +
98 +AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
99 +
100 +if test "x$have_system_tomsfastmath" = "xyes"; then
101 +    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
102 +    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
103 +else
104 +    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
105 +    tomsfastmath_msg="Internal"
106 +fi
This page took 0.085219 seconds and 4 git commands to generate.