Fix compilation error on NetBSD

Original patch is by Jeorg Sonnenberger, thanks!
This commit is contained in:
Sergey Sharybin 2014-01-09 16:03:02 +06:00
parent 1ea5c2a8e3
commit 2d8545f87e
3 changed files with 31 additions and 27 deletions

@ -1,3 +1,14 @@
commit 0a69fadadc5aacbd339f839ac5bd12c3571278b1
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Jan 9 15:50:11 2014 +0600
Fix compilation error on NetBSD
- NetBSD doesn't provide sincos(3) in libm, so don't try to use it
- Use posix_memalign on NetBSD
Original patch is by Jeorg Sonnenberger to Blender patch tracker, thanks!
commit b0df3e291e6c85f791658be04334efafc41989f5 commit b0df3e291e6c85f791658be04334efafc41989f5
Author: Sergey Sharybin <sergey.vfx@gmail.com> Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Jan 2 15:12:18 2014 +0600 Date: Thu Jan 2 15:12:18 2014 +0600
@ -674,13 +685,3 @@ Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Apr 4 02:59:58 2013 +0600 Date: Thu Apr 4 02:59:58 2013 +0600
Suppress strict compiler warnings in glags/glog libraries Suppress strict compiler warnings in glags/glog libraries
commit 307f3449c3dc47ed0082a22c88f9ab42114c2a0f
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Apr 4 01:20:18 2013 +0600
Lint cleanup, mostly white space and line width.
Also moved own includes to the top of files.
Should be no functional changes :)

@ -33,23 +33,26 @@
#include <Eigen/QR> #include <Eigen/QR>
#include <Eigen/SVD> #include <Eigen/SVD>
#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__) #if !defined(__MINGW64__)
static void sincos(double x, double *sinx, double *cosx) { # if defined(_WIN32) || defined(__APPLE__) || \
*sinx = sin(x); defined(__FreeBSD__) || defined(__NetBSD__)
*cosx = cos(x); static void sincos(double x, double *sinx, double *cosx) {
} *sinx = sin(x);
#endif // _WIN32 || __APPLE__ *cosx = cos(x);
}
# endif
#endif // !__MINGW64__
#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__) #if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
inline long lround(double d) { inline long lround(double d) {
return (long)(d>0 ? d+0.5 : ceil(d-0.5)); return (long)(d>0 ? d+0.5 : ceil(d-0.5));
} }
#if _MSC_VER < 1800 # if _MSC_VER < 1800
inline int round(double d) { inline int round(double d) {
return (d>0) ? int(d+0.5) : int(d-0.5); return (d>0) ? int(d+0.5) : int(d-0.5);
} }
#endif # endif // _MSC_VER < 1800
typedef unsigned int uint; typedef unsigned int uint;
#endif // _WIN32 #endif // _WIN32
namespace libmv { namespace libmv {

@ -24,7 +24,7 @@
#include <emmintrin.h> #include <emmintrin.h>
#endif #endif
#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
// Needed for memalign on Linux and _aligned_alloc on Windows. // Needed for memalign on Linux and _aligned_alloc on Windows.
#ifdef FREE_WINDOWS #ifdef FREE_WINDOWS
/* make sure _aligned_malloc is included */ /* make sure _aligned_malloc is included */
@ -60,7 +60,7 @@ void *aligned_malloc(int size, int alignment) {
// they work natively with SSE types with no further work. // they work natively with SSE types with no further work.
CHECK_EQ(alignment, 16); CHECK_EQ(alignment, 16);
return malloc(size); return malloc(size);
#elif __FreeBSD__ #elif defined(__FreeBSD__) || defined(__NetBSD__)
void *result; void *result;
if (posix_memalign(&result, alignment, size)) { if (posix_memalign(&result, alignment, size)) {