build: Enable libc++ std::this_thread::sleep_for if unavailable
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 12 May 2017 13:26:58 +0000 (15:26 +0200)
committerDave Thaler <dthaler@microsoft.com>
Mon, 15 May 2017 17:57:05 +0000 (17:57 +0000)
commit80133516ce3dc1aee7aa135aadc50d6c0dc0111d
treecacee62bb2cfc5d8decee2b6baef7424118dd038
parent8ef3aee6a22f88f64b78feee2d812e09606576a8
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: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19831
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
plugins/unittests/plugininterfacetest.cpp
resource/IPCA/samples/ElevatorClient/ElevatorClient.cpp
resource/IPCA/unittests/IPCAElevatorClient.cpp
resource/IPCA/unittests/ipcaunittests.cpp
resource/c_common/platform_features.h
resource/examples/fridgeserver.cpp
resource/src/InProcClientWrapper.cpp
resource/src/InProcServerWrapper.cpp
service/resource-container/unittests/ResourceContainerTest.cpp
service/resource-encapsulation/examples/linux/SeparateResponseServer.cpp