build: Explicitly define _GLIBCXX_USE_NANOSLEEP if gcc < 4.8 is used

Change-Id: I2f216ba8c602d1a81433a566318a49f17728a8dd
Refs: #2499
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 95d0d8a..759fcc8 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -124,6 +124,8 @@
             flags['CXXFLAGS'] += ['-std=c++0x']
         else:
             flags['CXXFLAGS'] += ['-std=c++11']
+        if version < (4, 8, 0):
+            flags['DEFINES'] += ['_GLIBCXX_USE_NANOSLEEP'] # Bug #2499
         return flags
 
     def getDebugFlags(self, conf):
diff --git a/wscript b/wscript
index ca0e461..5466d04 100644
--- a/wscript
+++ b/wscript
@@ -101,6 +101,9 @@
 
     conf.define('SYSCONFDIR', conf.env['SYSCONFDIR'])
 
+    # config file will contain all defines that were added using conf.define('xxx'...)
+    # Everything that was added directly to conf.env['DEFINES'] will not appear in the
+    # config file and will be added using compiler directives in the command line.
     conf.write_config_header('src/ndn-cxx-config.hpp', define_prefix='NDN_CXX_')
 
 def build(bld):