You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by rg...@apache.org on 2015/05/18 09:38:37 UTC

svn commit: r1679953 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/c/Makefile.am src/c/configure.ac src/c/src/zk_log.c src/c/tests/LibCMocks.cc src/c/tests/wrappers.opt

Author: rgs
Date: Mon May 18 07:38:36 2015
New Revision: 1679953

URL: http://svn.apache.org/r1679953
Log:
ZOOKEEPER-1077: C client lib doesn't build on Solaris (Chris Nauroth via rgs)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/c/Makefile.am
    zookeeper/branches/branch-3.4/src/c/configure.ac
    zookeeper/branches/branch-3.4/src/c/src/zk_log.c
    zookeeper/branches/branch-3.4/src/c/tests/LibCMocks.cc
    zookeeper/branches/branch-3.4/src/c/tests/wrappers.opt

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Mon May 18 07:38:36 2015
@@ -74,6 +74,8 @@ BUGFIXES:
   if the test method is annotated with an expected exception (Chris Nauroth
   via rgs)
 
+  ZOOKEEPER-1077: C client lib doesn't build on Solaris (Chris Nauroth via rgs)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1575. adding .gitattributes to prevent CRLF and LF mismatches for

Modified: zookeeper/branches/branch-3.4/src/c/Makefile.am
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/Makefile.am?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/Makefile.am (original)
+++ zookeeper/branches/branch-3.4/src/c/Makefile.am Mon May 18 07:38:36 2015
@@ -1,11 +1,15 @@
 # need this for Doxygen integration
 include $(top_srcdir)/aminclude.am
 
-AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated
+if SOLARIS
+  SOLARIS_CPPFLAGS = -D_POSIX_PTHREAD_SEMANTICS
+  SOLARIS_LIB_LDFLAGS = -lnsl -lsocket
+endif
+AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated $(SOLARIS_CPPFLAGS)
 AM_CFLAGS = -Wall -Werror 
 AM_CXXFLAGS = -Wall $(USEIPV6)
 
-LIB_LDFLAGS = -no-undefined -version-info 2
+LIB_LDFLAGS = -no-undefined -version-info 2 $(SOLARIS_LIB_LDFLAGS)
 
 pkginclude_HEADERS = include/zookeeper.h include/zookeeper_version.h include/zookeeper_log.h include/proto.h include/recordio.h generated/zookeeper.jute.h
 EXTRA_DIST=LICENSE
@@ -78,21 +82,31 @@ TEST_SOURCES = tests/TestDriver.cc tests
     tests/TestMulti.cc tests/TestWatchers.cc
 
 
-SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
+if SOLARIS
+  SHELL_SYMBOL_WRAPPERS = cat ${srcdir}/tests/wrappers.opt
+  SYMBOL_WRAPPERS=$(SHELL_SYMBOL_WRAPPERS:sh)
+else
+  SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
+endif
 
 check_PROGRAMS = zktest-st
 nodist_zktest_st_SOURCES = $(TEST_SOURCES)
 zktest_st_LDADD = libzkst.la libhashtable.la $(CPPUNIT_LIBS)
-zktest_st_CXXFLAGS = -DUSE_STATIC_LIB $(CPPUNIT_CFLAGS) $(USEIPV6)
-zktest_st_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS)
+zktest_st_CXXFLAGS = -DUSE_STATIC_LIB $(CPPUNIT_CFLAGS) $(USEIPV6) $(SOLARIS_CPPFLAGS)
+zktest_st_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS) $(SOLARIS_LIB_LDFLAGS)
 
 if WANT_SYNCAPI
   check_PROGRAMS += zktest-mt
   nodist_zktest_mt_SOURCES = $(TEST_SOURCES) tests/PthreadMocks.cc
   zktest_mt_LDADD = libzkmt.la libhashtable.la -lpthread $(CPPUNIT_LIBS)
   zktest_mt_CXXFLAGS = -DUSE_STATIC_LIB -DTHREADED $(CPPUNIT_CFLAGS) $(USEIPV6)
+if SOLARIS
+  SHELL_SYMBOL_WRAPPERS_MT = cat ${srcdir}/tests/wrappers-mt.opt
+  SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(SHELL_SYMBOL_WRAPPERS_MT:sh)
+else
   SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(shell cat ${srcdir}/tests/wrappers-mt.opt)
-  zktest_mt_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS_MT)
+endif
+  zktest_mt_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS_MT) $(SOLARIS_LIB_LDFLAGS)
 endif
 
 run-check: check

Modified: zookeeper/branches/branch-3.4/src/c/configure.ac
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/configure.ac?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/configure.ac (original)
+++ zookeeper/branches/branch-3.4/src/c/configure.ac Mon May 18 07:38:36 2015
@@ -146,4 +146,14 @@ fi
 AC_CHECK_FUNCS([getcwd gethostbyname gethostname getlogin getpwuid_r gettimeofday getuid memmove memset poll socket strchr strdup strerror strtol])
 
 AC_CONFIG_FILES([Makefile])
+AC_CANONICAL_HOST
+AM_CONDITIONAL([SOLARIS],[
+  case "$host_os" in
+  *solaris*)
+    true
+    ;;
+  *)
+    false
+    ;;
+  esac ])
 AC_OUTPUT

Modified: zookeeper/branches/branch-3.4/src/c/src/zk_log.c
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/src/zk_log.c?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/src/zk_log.c (original)
+++ zookeeper/branches/branch-3.4/src/c/src/zk_log.c Mon May 18 07:38:36 2015
@@ -133,7 +133,8 @@ void log_message(ZooLogLevel curLevel,in
 #endif
     if(pid==0)pid=getpid();
 #ifndef THREADED
-    fprintf(LOGSTREAM, "%s:%d:%s@%s@%d: %s\n", time_now(get_time_buffer()),pid,
+    // pid_t is long on Solaris
+    fprintf(LOGSTREAM, "%s:%ld:%s@%s@%d: %s\n", time_now(get_time_buffer()),(long)pid,
             dbgLevelStr[curLevel],funcName,line,message);
 #else
 #ifdef WIN32
@@ -141,7 +142,7 @@ void log_message(ZooLogLevel curLevel,in
             (unsigned long int)(pthread_self().thread_id),
             dbgLevelStr[curLevel],funcName,line,message);      
 #else
-    fprintf(LOGSTREAM, "%s:%d(0x%lx):%s@%s@%d: %s\n", time_now(get_time_buffer()),pid,
+    fprintf(LOGSTREAM, "%s:%ld(0x%lx):%s@%s@%d: %s\n", time_now(get_time_buffer()),(long)pid,
             (unsigned long int)pthread_self(),
             dbgLevelStr[curLevel],funcName,line,message);      
 #endif

Modified: zookeeper/branches/branch-3.4/src/c/tests/LibCMocks.cc
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/tests/LibCMocks.cc?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/tests/LibCMocks.cc (original)
+++ zookeeper/branches/branch-3.4/src/c/tests/LibCMocks.cc Mon May 18 07:38:36 2015
@@ -147,7 +147,7 @@ Mock_calloc* Mock_calloc::mock_=0;
 // realloc
 
 #ifndef USING_DUMA
-void* realloc(void* p, size_t s){
+DECLARE_WRAPPER(void*,realloc,(void* p, size_t s)){
     if(!Mock_realloc::mock_)
         return LIBC_SYMBOLS.realloc(p,s);
     return Mock_realloc::mock_->call(p,s);

Modified: zookeeper/branches/branch-3.4/src/c/tests/wrappers.opt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/tests/wrappers.opt?rev=1679953&r1=1679952&r2=1679953&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/tests/wrappers.opt (original)
+++ zookeeper/branches/branch-3.4/src/c/tests/wrappers.opt Mon May 18 07:38:36 2015
@@ -4,3 +4,4 @@
 -Wl,--wrap -Wl,get_xid
 -Wl,--wrap -Wl,deliverWatchers
 -Wl,--wrap -Wl,activateWatcher
+-Wl,--wrap -Wl,realloc