]> git.pld-linux.org Git - packages/clamav.git/blob - clamav-add-support-for-system-tomsfastmath.patch
- package more static libs
[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 --git a/configure.ac b/configure.ac
17 index 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
36 diff --git a/libclamav/Makefile.am b/libclamav/Makefile.am
37 index 43b5154..02596b8 100644
38 --- a/libclamav/Makefile.am
39 +++ b/libclamav/Makefile.am
40 @@ -496,8 +496,10 @@ libclamav_la_SOURCES += yara_arena.c \
41         yara_clam.h
42  endif
43  
44 -libclamav_la_SOURCES += bignum.h\
45 -       bignum_fast.h\
46 +libclamav_la_SOURCES += bignum.h
47 +
48 +if !SYSTEM_TOMSFASTMATH
49 +libclamav_la_SOURCES += bignum_fast.h\
50          tomsfastmath/addsub/fp_add.c\
51          tomsfastmath/addsub/fp_add_d.c\
52          tomsfastmath/addsub/fp_addmod.c\
53 @@ -579,6 +581,10 @@ libclamav_la_SOURCES += bignum.h\
54          tomsfastmath/sqr/fp_sqr_comba_generic.c\
55          tomsfastmath/sqr/fp_sqr_comba_small_set.c\
56         tomsfastmath/sqr/fp_sqrmod.c
57 +else
58 +libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
59 +libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
60 +endif
61  
62  .PHONY: version.h.tmp
63  version.c: version.h
64 diff --git a/libclamav/bignum.h b/libclamav/bignum.h
65 index 9acb17b..56967b1 100644
66 --- a/libclamav/bignum.h
67 +++ b/libclamav/bignum.h
68 @@ -1,9 +1,13 @@
69  #ifndef BIGNUM_H_
70  #define BIGNUM_H_
71  
72 +#if HAVE_SYSTEM_TOMSFASTMATH
73 +#include <tfm.h>
74 +#else
75  #define TFM_CHECK
76 -
77  #include "bignum_fast.h"
78 +#endif
79 +
80  typedef fp_int mp_int;
81  #define mp_cmp fp_cmp
82  #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
83 diff --git a/libclamav/xdp.c b/libclamav/xdp.c
84 index 00edfa8..674dc7c 100644
85 --- a/libclamav/xdp.c
86 +++ b/libclamav/xdp.c
87 @@ -57,7 +57,7 @@
88  #include "scanners.h"
89  #include "conv.h"
90  #include "xdp.h"
91 -#include "bignum_fast.h"
92 +#include "bignum.h"
93  #include "filetypes.h"
94  
95  static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
96 diff --git a/m4/reorganization/libs/tomsfastmath.m4 b/m4/reorganization/libs/tomsfastmath.m4
97 new file mode 100644
98 index 0000000..2a821a1
99 --- /dev/null
100 +++ b/m4/reorganization/libs/tomsfastmath.m4
101 @@ -0,0 +1,12 @@
102 +dnl Check for system tomsfastmath
103 +PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
104 +
105 +AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
106 +
107 +if test "x$have_system_tomsfastmath" = "xyes"; then
108 +    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
109 +    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
110 +else
111 +    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
112 +    tomsfastmath_msg="Internal"
113 +fi
This page took 0.064411 seconds and 3 git commands to generate.