gnu: kio: Search 'smbd' on $PATH.
[jackhill/guix/guix.git] / gnu / packages / patches / clamav-system-tomsfastmath.patch
1 From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 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 --- a/configure.ac
17 +++ b/configure.ac
18 @@ -82,6 +82,7 @@ m4_include([m4/reorganization/libs/xml.m
19 m4_include([m4/reorganization/libs/openssl.m4])
20 m4_include([m4/reorganization/libs/json.m4])
21 m4_include([m4/reorganization/libs/pcre.m4])
22 +m4_include([m4/reorganization/libs/tomsfastmath.m4])
23
24 AM_MAINTAINER_MODE
25 m4_include([m4/reorganization/libs/libz.m4])
26 @@ -285,6 +286,7 @@ else
27 fi
28 CL_MSG_STATUS([yara ],[$enable_yara],[$enable_yara])
29 CL_MSG_STATUS([fts ],[yes],[$lfs_fts_msg])
30 +CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
31
32
33 # Yep, downgrading the compiler avoids the bug too:
34 --- a/libclamav/Makefile.am
35 +++ b/libclamav/Makefile.am
36 @@ -496,8 +496,10 @@ libclamav_la_SOURCES += yara_arena.c \
37 yara_clam.h
38 endif
39
40 -libclamav_la_SOURCES += bignum.h\
41 - bignum_fast.h\
42 +libclamav_la_SOURCES += bignum.h
43 +
44 +if !SYSTEM_TOMSFASTMATH
45 +libclamav_la_SOURCES += bignum_fast.h\
46 tomsfastmath/addsub/fp_add.c\
47 tomsfastmath/addsub/fp_add_d.c\
48 tomsfastmath/addsub/fp_addmod.c\
49 @@ -579,6 +581,10 @@ libclamav_la_SOURCES += bignum.h\
50 tomsfastmath/sqr/fp_sqr_comba_generic.c\
51 tomsfastmath/sqr/fp_sqr_comba_small_set.c\
52 tomsfastmath/sqr/fp_sqrmod.c
53 +else
54 +libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
55 +libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
56 +endif
57
58 .PHONY: version.h.tmp
59 version.c: version.h
60 --- a/libclamav/bignum.h
61 +++ b/libclamav/bignum.h
62 @@ -1,9 +1,13 @@
63 #ifndef BIGNUM_H_
64 #define BIGNUM_H_
65
66 +#if HAVE_SYSTEM_TOMSFASTMATH
67 +#include <tfm.h>
68 +#else
69 #define TFM_CHECK
70 -
71 #include "bignum_fast.h"
72 +#endif
73 +
74 typedef fp_int mp_int;
75 #define mp_cmp fp_cmp
76 #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
77 --- a/libclamav/xdp.c
78 +++ b/libclamav/xdp.c
79 @@ -57,7 +57,7 @@
80 #include "scanners.h"
81 #include "conv.h"
82 #include "xdp.h"
83 -#include "bignum_fast.h"
84 +#include "bignum.h"
85 #include "filetypes.h"
86
87 static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
88 --- /dev/null
89 +++ b/m4/reorganization/libs/tomsfastmath.m4
90 @@ -0,0 +1,12 @@
91 +dnl Check for system tomsfastmath
92 +PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
93 +
94 +AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
95 +
96 +if test "x$have_system_tomsfastmath" = "xyes"; then
97 + AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
98 + tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
99 +else
100 + AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
101 + tomsfastmath_msg="Internal"
102 +fi