summaryrefslogtreecommitdiffstats
path: root/package/opencv/opencv-uclibc-optional-long-double-support.patch
blob: b319849fb16bbcfd1572bf90d63ea88bbf16c2a4 (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
Upstream: https://code.ros.org/trac/opencv/ticket/1515

[PATCH] Fix compile issue in flann module on uClibc without long double support

uClibc configured without UCLIBC_HAS_LONG_DOUBLE_MATH (because of user
choice or simply that the arch doesn't provide long doubles) doesn't
provide fabsl(), breaking the build in the flann module.

Work around it by not providing the long double template specialization.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 modules/flann/include/opencv2/flann/dist.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: opencv-2.3.1a/modules/flann/include/opencv2/flann/dist.h
===================================================================
--- opencv-2.3.1a.orig/modules/flann/include/opencv2/flann/dist.h
+++ opencv-2.3.1a/modules/flann/include/opencv2/flann/dist.h
@@ -40,6 +40,7 @@
 #else
 #include <stdint.h>
 #endif
+#include <features.h>
 
 #include "defines.h"
 
@@ -59,9 +60,11 @@
 template<>
 inline double abs<double>(double x) { return fabs(x); }
 
+/* uClibc configured without long double math doesn't provide fabsl */
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_LONG_DOUBLE_MATH__))
 template<>
 inline long double abs<long double>(long double x) { return fabsl(x); }
-
+#endif
 
 template<typename T>
 struct Accumulator { typedef T Type; };
OpenPOWER on IntegriCloud