Commit 80133516 authored by Philippe Coval's avatar Philippe Coval Committed by Dave Thaler

build: Enable libc++ std::this_thread::sleep_for if unavailable

This was needed to support gcc-4.{6..7} on GNU/Linux Ubuntu 14

So I defined _GLIBCXX_USE_NANOSLEEP if not enabled at configure time,

To avoid messing up configurations it is only set for 4.7 and earlier,
but can extended to other versions if needed (4.8 seems OK).

Also config file is inserted before any header when it was needed.

Observed issue on Ubuntu 14.04.5 x86_64 with g++-4.7 package
(g++ (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3) is:

  resource/src/InProcClientWrapper.cpp: \
  In member function 'void OC::InProcClientWrapper::listeningFunc()': \
  resource/src/InProcClientWrapper.cpp:107:13: \
  error: 'sleep_for' is not a member of 'std::this_thread'

Bug: https://jira.iotivity.org/browse/IOT-2158
Change-Id: Ib63aa289e91cc5926946786ae2ce03525d83a37c
Signed-off-by: default avatarPhilippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19831Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarDave Thaler <dthaler@microsoft.com>
parent 8ef3aee6
......@@ -18,6 +18,7 @@
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "iotivity_config.h"
#include "plugininterface.h"
#include "gtest/gtest.h"
......
......@@ -17,6 +17,8 @@
*
******************************************************************/
#include "iotivity_config.h"
#include <mutex>
#include <array>
#include <string>
......@@ -28,7 +30,6 @@
#include <condition_variable>
#include <climits>
#include "iotivity_config.h"
#include "ipca.h"
#include "OCFDevice.h"
......
......@@ -17,13 +17,14 @@
*
******************************************************************/
#include "iotivity_config.h"
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
#include "gtest/gtest.h"
#include "iotivity_config.h"
#include "ocrandom.h"
#include "octypes.h"
#include "oic_time.h"
......
......@@ -17,6 +17,8 @@
*
******************************************************************/
#include "iotivity_config.h"
#include <thread>
#include <chrono>
#include <mutex>
......
......@@ -45,6 +45,11 @@
typedef int OC_CAT(StaticAssertTemp, __LINE__)[2 * !!(condition) - 1]
#endif
#if !(defined _GLIBCXX_USE_NANOSLEEP) \
&& defined(__GNUC__) && (4 == __GNUC__) && (7 >= __GNUC_MINOR__)
# define _GLIBCXX_USE_NANOSLEEP 1
#endif
#ifndef INLINE_API
# if defined(__cplusplus)
# define INLINE_API inline
......
......@@ -24,6 +24,8 @@
/// demonstrate using std::bind to attach to instances of a class as well as using
/// constructResourceObject
#include "iotivity_config.h"
#include <chrono>
#include <iostream>
#include <thread>
......
......@@ -18,6 +18,8 @@
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "iotivity_config.h"
#include "InProcClientWrapper.h"
#include "ocstack.h"
......
......@@ -18,6 +18,8 @@
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "iotivity_config.h"
#include <random>
#include <cstring>
#include <cstdlib>
......
......@@ -18,6 +18,8 @@
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "iotivity_config.h"
#if defined(__linux__)
#include <unistd.h>
#endif
......
......@@ -18,6 +18,8 @@
*
******************************************************************/
#include "iotivity_config.h"
#include "RCSResourceObject.h"
#include "RCSRequest.h"
#include "RCSSeparateResponse.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment