THRIFT-953: Fix compilation of TransportTest.cpp on Mac (actual tests still fail) and fix boost m4 macros for Mac.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1031148 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index 1fadff3..02c26ad 100644
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -62,22 +62,35 @@
 	TMemoryBufferTest.cpp \
 	TBufferBaseTest.cpp
 
-UnitTests_LDADD = $(BOOST_LDFLAGS) libtestgencpp.la -lboost_unit_test_framework
+UnitTests_LDADD = \
+  $(BOOST_LDFLAGS) \
+  libtestgencpp.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
 
 TransportTest_SOURCES = \
 	TransportTest.cpp
 
-TransportTest_LDADD = libtestgencpp.la $(top_builddir)/lib/cpp/libthriftz.la -l:libboost_unit_test_framework.a -lz
+TransportTest_LDADD = \
+  libtestgencpp.la \
+  $(top_builddir)/lib/cpp/libthriftz.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a \
+  -lz
 
 ZlibTest_SOURCES = \
 	ZlibTest.cpp
 
-ZlibTest_LDADD = libtestgencpp.la $(top_builddir)/lib/cpp/libthriftz.la -l:libboost_unit_test_framework.a -lz
+ZlibTest_LDADD = \
+  libtestgencpp.la \
+  $(top_builddir)/lib/cpp/libthriftz.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a \
+  -lz
 
 TFileTransportTest_SOURCES = \
 	TFileTransportTest.cpp
 
-TFileTransportTest_LDADD = libtestgencpp.la -l:libboost_unit_test_framework.a
+TFileTransportTest_LDADD = \
+  libtestgencpp.la \
+  $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
 
 #
 # TFDTransportTest
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 59f2427..0762eca 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -379,7 +379,7 @@
   struct sigaction action;
   memset(&action, 0, sizeof(action));
   action.sa_handler = alarm_handler;
-  action.sa_flags = SA_ONESHOT;
+  action.sa_flags = SA_RESETHAND;
   sigemptyset(&action.sa_mask);
   sigaction(SIGALRM, &action, NULL);
 
@@ -1025,9 +1025,10 @@
 
   if (!have_seed) {
     // choose a seed now if the user didn't specify one
-    struct timespec t;
-    clock_gettime(CLOCK_REALTIME, &t);
-    options->seed = t.tv_sec + t.tv_nsec;
+    struct timeval tv;
+    struct timezone tz;
+    gettimeofday(&tv, &tz);
+    options->seed = tv.tv_sec ^ tv.tv_usec;
   }
 }
 
diff --git a/lib/cpp/test/UnitTestMain.cpp b/lib/cpp/test/UnitTestMain.cpp
index d4e1ece..f0ef1e4 100644
--- a/lib/cpp/test/UnitTestMain.cpp
+++ b/lib/cpp/test/UnitTestMain.cpp
@@ -18,6 +18,4 @@
  */
 
 #define BOOST_TEST_MODULE thrift
-#define BOOST_TEST_DYN_LINK
-#define BOOST_AUTO_TEST_MAIN
 #include <boost/test/auto_unit_test.hpp>