From 68baf15806cf0ddd8f9b4f25688e1eb43f4a8322 Mon Sep 17 00:00:00 2001 From: Alberto Luaces Date: Tue, 31 May 2016 12:58:57 +0100 Subject: [PATCH] defines for building on Hurd and BSD kernels --- applications/present3D/Cluster.cpp | 6 ++++-- examples/osgcluster/broadcaster.cpp | 2 ++ examples/osgcluster/receiver.cpp | 2 +- src/OpenThreads/pthreads/PThread.cpp | 4 +++- src/osgDB/FileNameUtils.cpp | 4 ++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/applications/present3D/Cluster.cpp b/applications/present3D/Cluster.cpp index 5b1180fb7..4c8cd7b4a 100644 --- a/applications/present3D/Cluster.cpp +++ b/applications/present3D/Cluster.cpp @@ -33,7 +33,7 @@ #if defined(__linux) #include #include -#elif defined(__FreeBSD__) || defined(__DragonFly__) +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) #include #include #elif defined(__sgi) @@ -41,6 +41,8 @@ #include #elif defined(__CYGWIN__) #include +#elif defined (__GNU__) + #include #elif defined(__sun) #include #include @@ -338,7 +340,7 @@ void Receiver::sync( void ) } #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \ - defined(__DragonFly__) + defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__) socklen_t #else int diff --git a/examples/osgcluster/broadcaster.cpp b/examples/osgcluster/broadcaster.cpp index ead97d10b..dbf3b5318 100644 --- a/examples/osgcluster/broadcaster.cpp +++ b/examples/osgcluster/broadcaster.cpp @@ -45,6 +45,8 @@ #include #elif defined(__CYGWIN__) #include +#elif defined (__GNU__) + #include #elif defined(__sun) #include #include diff --git a/examples/osgcluster/receiver.cpp b/examples/osgcluster/receiver.cpp index 864ab7ef8..4e7e470ef 100644 --- a/examples/osgcluster/receiver.cpp +++ b/examples/osgcluster/receiver.cpp @@ -122,7 +122,7 @@ void Receiver::sync( void ) return; } -#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) +#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || defined(__FreeBSD_kernel__) || defined(__GNU__) socklen_t size; #else int size; diff --git a/src/OpenThreads/pthreads/PThread.cpp b/src/OpenThreads/pthreads/PThread.cpp index e16ed0434..ab62064b8 100644 --- a/src/OpenThreads/pthreads/PThread.cpp +++ b/src/OpenThreads/pthreads/PThread.cpp @@ -43,8 +43,10 @@ #endif #if defined (__FreeBSD__) || defined (__APPLE__) || defined (__MACH__) #include +#if !defined (__GNU__) #include #endif +#endif #if defined(__ANDROID__) #ifndef PAGE_SIZE @@ -996,7 +998,7 @@ int Thread::microSleep(unsigned int microsec) // int OpenThreads::GetNumberOfProcessors() { -#if defined(__linux__) +#if defined(__linux__) || defined(__GNU__) long ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret == -1) return 0; diff --git a/src/osgDB/FileNameUtils.cpp b/src/osgDB/FileNameUtils.cpp index cb2685cef..98234b146 100644 --- a/src/osgDB/FileNameUtils.cpp +++ b/src/osgDB/FileNameUtils.cpp @@ -30,6 +30,10 @@ using std::tolower; #endif +#if defined(__GNU__) && !defined(PATH_MAX) +#define PATH_MAX 4096 +#endif + using namespace std; static const char * const PATH_SEPARATORS = "/\\";