changeset 890:816dccaeb7cf

Support of kFreeBSD
author jodogne
date Mon, 16 Jun 2014 15:39:16 +0200
parents 50106e80555a
children 517e28b420af 703bef350e89
files CMakeLists.txt Core/MultiThreading/Mutex.cpp Core/Toolbox.cpp NEWS OrthancServer/DicomProtocol/DicomServer.cpp OrthancServer/DicomProtocol/DicomUserConnection.cpp Resources/CMake/BoostConfiguration.cmake Resources/CMake/Compiler.cmake Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/GoogleLogConfiguration.cmake Resources/CMake/LibCurlConfiguration.cmake Resources/CMake/MongooseConfiguration.cmake UnitTestsSources/UnitTestsMain.cpp
diffstat 13 files changed, 36 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Sat Jun 14 15:50:02 2014 +0200
+++ b/CMakeLists.txt	Mon Jun 16 15:39:16 2014 +0200
@@ -394,7 +394,8 @@
     ${GOOGLE_LOG_SOURCES}
     )
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     set_target_properties(OrthancClient
       PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${ORTHANC_ROOT}/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map"
       )
--- a/Core/MultiThreading/Mutex.cpp	Sat Jun 14 15:50:02 2014 +0200
+++ b/Core/MultiThreading/Mutex.cpp	Mon Jun 16 15:39:16 2014 +0200
@@ -37,7 +37,7 @@
 
 #if defined(_WIN32)
 #include <windows.h>
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
 #include <pthread.h>
 #else
 #error Support your platform here
@@ -75,7 +75,7 @@
   }
 
 
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
 
   struct Mutex::PImpl
   {
--- a/Core/Toolbox.cpp	Sat Jun 14 15:50:02 2014 +0200
+++ b/Core/Toolbox.cpp	Mon Jun 16 15:39:16 2014 +0200
@@ -54,7 +54,7 @@
 #include <limits.h>      /* PATH_MAX */
 #endif
 
-#if defined(__linux)
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 #include <limits.h>      /* PATH_MAX */
 #include <signal.h>
 #include <unistd.h>
@@ -162,7 +162,7 @@
   {
 #if defined(_WIN32)
     ::Sleep(static_cast<DWORD>(microSeconds / static_cast<uint64_t>(1000)));
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
     usleep(microSeconds);
 #else
 #error Support your platform here
@@ -515,7 +515,7 @@
     return std::string(&buffer[0]);
   }
 
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
   std::string Toolbox::GetPathToExecutable()
   {
     std::vector<char> buffer(PATH_MAX + 1);
--- a/NEWS	Sat Jun 14 15:50:02 2014 +0200
+++ b/NEWS	Mon Jun 16 15:39:16 2014 +0200
@@ -1,6 +1,7 @@
 Pending changes in the mainline
 ===============================
 
+* Support of kFreeBSD
 
 
 Version 0.7.6 (2014/06/11)
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Sat Jun 14 15:50:02 2014 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Mon Jun 16 15:39:16 2014 +0200
@@ -116,7 +116,7 @@
     LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_DICOM);
     LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_PRIVATE);
 
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
     std::string path = DCMTK_DICTIONARY_DIR;
 
     const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE);
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Sat Jun 14 15:50:02 2014 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Jun 16 15:39:16 2014 +0200
@@ -107,6 +107,18 @@
 #endif 
 
 
+#if defined(__FreeBSD_kernel__)
+/**
+ * TO IMPROVE: "_POSIX_HOST_NAME_MAX is only the minimum value that
+ * HOST_NAME_MAX can ever have [...] Therefore you cannot allocate an
+ * array of size _POSIX_HOST_NAME_MAX, invoke gethostname() and expect
+ * that the result will fit."
+ * http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00128.html
+ **/
+#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
+#endif
+
+
 static const char* DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax;
 
 /**
--- a/Resources/CMake/BoostConfiguration.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/BoostConfiguration.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -53,7 +53,8 @@
     )
 
   set(BOOST_SOURCES)
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
--- a/Resources/CMake/Compiler.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/Compiler.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -37,7 +37,8 @@
 endif()
 
 
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
   if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include")
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive")
--- a/Resources/CMake/DcmtkConfiguration.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -87,7 +87,8 @@
 
   # Source for the logging facility of DCMTK
   AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     list(REMOVE_ITEM DCMTK_SOURCES 
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -28,7 +28,8 @@
   set(ac_google_start_namespace "namespace google {")
   set(ac_google_end_namespace "}")
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     set(ac_cv_have_unistd_h 1)
     set(ac_cv_have_stdint_h 1)
     set(ac_cv_have_systypes_h 0)
@@ -83,7 +84,8 @@
       )
   endif()
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
       # Install the specific configuration for LSB SDK
       configure_file(
--- a/Resources/CMake/LibCurlConfiguration.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/LibCurlConfiguration.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -40,7 +40,8 @@
       )
   endif()
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
     if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
       SET(TMP_OS "x86_64")
     else()
--- a/Resources/CMake/MongooseConfiguration.cmake	Sat Jun 14 15:50:02 2014 +0200
+++ b/Resources/CMake/MongooseConfiguration.cmake	Mon Jun 16 15:39:16 2014 +0200
@@ -24,7 +24,8 @@
     add_definitions(
       -DNO_SSL_DL=1
       )
-    if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+    if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+        ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
       link_libraries(dl)
     endif()
 
--- a/UnitTestsSources/UnitTestsMain.cpp	Sat Jun 14 15:50:02 2014 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Mon Jun 16 15:39:16 2014 +0200
@@ -595,7 +595,7 @@
 #if defined(_WIN32)
   ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness());
 
-#elif defined(__linux)
+#elif defined(__linux) || defined(__FreeBSD_kernel__)
 
 #if !defined(__BYTE_ORDER)
 #  error Support your platform here