THRIFT-4295: rework the docker build images, updating them and tuning the travis builds

This closes #1340
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 77d4d6c..4441fba 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -62,7 +62,7 @@
 endif
 
 AM_CXXFLAGS = -Wall -Wextra -pedantic
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(OPENSSL_INCLUDES) -I$(srcdir)/src -D__STDC_LIMIT_MACROS
+AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(OPENSSL_INCLUDES) -I$(srcdir)/src -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
 
 # Define the source files for the module
 
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index 1a6062d..5c5ed18 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -19,6 +19,7 @@
 
 include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
 
+add_definitions("-D__STDC_FORMAT_MACROS")
 add_definitions("-D__STDC_LIMIT_MACROS")
 
 if (WITH_DYN_LINK_TEST)
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index feff930..95d9889 100755
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -389,7 +389,7 @@
 gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h: processor/proc.thrift
 	$(THRIFT) --gen cpp:templates,cob_style $<
 
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -D__STDC_LIMIT_MACROS -I.
+AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.
 AM_LDFLAGS = $(BOOST_LDFLAGS)
 AM_CXXFLAGS = -Wall -Wextra -pedantic
 
diff --git a/lib/d/Makefile.am b/lib/d/Makefile.am
index 5c529ba..2a81218 100644
--- a/lib/d/Makefile.am
+++ b/lib/d/Makefile.am
@@ -177,7 +177,7 @@
 	touch $@
 
 unittest/debug/%: src/%.d $(all_targets) unittest/emptymain.d
-	$(DMD) -gc -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
+	$(DMD) -g -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
 
 unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d
 	$(DMD) -O -release -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
diff --git a/lib/d/src/thrift/transport/http.d b/lib/d/src/thrift/transport/http.d
index c7d1f50..0e58dee 100644
--- a/lib/d/src/thrift/transport/http.d
+++ b/lib/d/src/thrift/transport/http.d
@@ -330,7 +330,7 @@
       "Host: " ~ host_ ~ "\r\n" ~
       "Content-Type: application/x-thrift\r\n" ~
       "Content-Length: " ~ to!string(dataLength) ~ "\r\n" ~
-      "Accept: application/x-thrift\r\n"
+      "Accept: application/x-thrift\r\n" ~
       "User-Agent: Thrift/" ~ VERSION ~ " (D/TClientHttpTransport)\r\n" ~
       "\r\n";
   }
diff --git a/lib/d/src/thrift/transport/socket.d b/lib/d/src/thrift/transport/socket.d
index 38b567a..228abf0 100644
--- a/lib/d/src/thrift/transport/socket.d
+++ b/lib/d/src/thrift/transport/socket.d
@@ -79,8 +79,8 @@
     version (none) assert(written <= buf.length, text("Implementation wrote " ~
       "more data than requested to?! (", written, " vs. ", buf.length, ")"));
   } body {
-    assert(0, "DMD bug? – Why would contracts work for interfaces, but not "
-      "for abstract methods? "
+    assert(0, "DMD bug? – Why would contracts work for interfaces, but not " ~
+      "for abstract methods? " ~
       "(Error: function […] in and out contracts require function body");
   }
 
diff --git a/lib/php/lib/Thrift/Transport/TSocket.php b/lib/php/lib/Thrift/Transport/TSocket.php
index dd87039..a1872b9 100644
--- a/lib/php/lib/Thrift/Transport/TSocket.php
+++ b/lib/php/lib/Thrift/Transport/TSocket.php
@@ -242,8 +242,10 @@
       throw new TException($error);
     }
 
-    $socket = socket_import_stream($this->handle_);
-    socket_set_option($socket, SOL_TCP, TCP_NODELAY, 1);
+    if (function_exists('socket_import_stream') && function_exists('socket_set_option')) {
+      $socket = socket_import_stream($this->handle_);
+      socket_set_option($socket, SOL_TCP, TCP_NODELAY, 1);
+    }
   }
 
   /**
diff --git a/lib/py/src/ext/types.h b/lib/py/src/ext/types.h
index 2fc9d9c..5cd8dda 100644
--- a/lib/py/src/ext/types.h
+++ b/lib/py/src/ext/types.h
@@ -23,6 +23,7 @@
 #include <Python.h>
 
 #ifdef _MSC_VER
+#define __STDC_FORMAT_MACROS
 #define __STDC_LIMIT_MACROS
 #endif
 #include <stdint.h>