Fix build using -std=c99

In each place where POSIX/GNU functions are used, the file must declare
that it wants POSIX functionality before including any system headers.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f630edb..084da59 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -15,6 +15,11 @@
     message(FATAL_ERROR "Cannot build test suites without Perl")
 endif()
 
+# Enable definition of various functions used throughout the testsuite
+# (hostname, strdup, fileno...) even when compiling with -std=c99. Harmless
+# on non-POSIX platforms.
+add_definitions("-D_POSIX_C_SOURCE=200809L")
+
 function(add_test_suite suite_name)
     if(ARGV1)
         set(data_name ${ARGV1})