bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for Cygwin environment


From: Makino Takaki
Subject: Patch for Cygwin environment
Date: Fri, 28 Feb 2003 13:24:56 +0900

Dear commonc++ developers,

I'd like to post a patch to make commonc++2 compilable in a latest
Cygwin environment on Windows.  It seems that the commonc++2 package
cannot be compiled via configure script on current Cygwin release.
I hope that the patch helps development of this excellent library.

The following patch is to fix the compilation error for pthread
emulation of Cygwin. It would be more efficient if I could make use of
native Win32 API, but it seems a lot of patching effort...
I confirmed the patch on Cygwin 1.3.19 and commoncpp2 1.0.8.  

The changes are:
 * Remove !defined(__CYGWIN32__) from #if surronding PosixThread class.
 * Disabled PosixThread::waitSignal when sigwait() is not available. I'm
   not sure why sigwait() is disabled on Cygwin, and I don't know
   what workaround is available for it.  Anyway it seems working happily
   without PosixThread::waitSignal member function.
 * Added some stuff for socklen_t.  Current configure script cannot find
   socklen_t in Cygwin; socklen_t is #define'd under cygwin/socket.h,
   but configure applies EGREP_HEADER to only sys/socket.h.  Though my
   patch for this problem may be too naive...

Best regards,
-- 
Makino Takaki <address@hidden>

diff -c -r commoncpp2-1.0.8/acconfig.h commoncpp2-1.0.8mak/acconfig.h
*** commoncpp2-1.0.8/acconfig.h Thu Jan 23 23:34:01 2003
--- commoncpp2-1.0.8mak/acconfig.h      Fri Feb 28 11:18:00 2003
***************
*** 40,45 ****
--- 40,46 ----
  #undef HAVE_LONG_LONG
  #undef HAVE_64_BITS
  #undef HAVE_SYS_TYPES_H
+ #undef HAVE_SIGWAIT
  #undef HAVE_SIGWAIT2
  #undef HAVE_SIGACTION
  #undef HAVE_BSD_SIGNAL_H
diff -c -r commoncpp2-1.0.8/include/cc++/thread.h 
commoncpp2-1.0.8mak/include/cc++/thread.h
*** commoncpp2-1.0.8/include/cc++/thread.h      Thu Jan  9 23:34:55 2003
--- commoncpp2-1.0.8mak/include/cc++/thread.h   Fri Feb 28 01:29:48 2003
***************
*** 1402,1408 ****
  /** @relates Thread */
  CCXX_EXPORT(void) setException(Thread::Throw mode);
  
! #if !defined(WIN32) && !defined(__CYGWIN32__)  && !defined(__MINGW32__)
  typedef       int             signo_t;
  
  class PosixThread: public Thread
--- 1402,1408 ----
  /** @relates Thread */
  CCXX_EXPORT(void) setException(Thread::Throw mode);
  
! #if !defined(WIN32) && !defined(__MINGW32__)
  typedef       int             signo_t;
  
  class PosixThread: public Thread
diff -c -r commoncpp2-1.0.8/m4/ost_signal.m4 
commoncpp2-1.0.8mak/m4/ost_signal.m4
*** commoncpp2-1.0.8/m4/ost_signal.m4   Fri Feb 22 19:11:37 2002
--- commoncpp2-1.0.8mak/m4/ost_signal.m4        Fri Feb 28 11:17:43 2003
***************
*** 23,28 ****
--- 23,29 ----
        AC_REQUIRE([OST_SYS_POSIX])
        AC_CHECK_FUNCS(sigaction)
        AC_CHECK_FUNCS(setitimer)
+       AC_CHECK_FUNCS(sigwait)
        AC_CHECK_HEADERS(bsd/signal.h)
        AC_TYPE_SIGNAL
        AC_CACHE_CHECK(whether sigwait has 2 arguments,
Only in commoncpp2-1.0.8/src: ccgnu2-config
diff -c -r commoncpp2-1.0.8/src/thread.cpp commoncpp2-1.0.8mak/src/thread.cpp
*** commoncpp2-1.0.8/src/thread.cpp     Thu Jan 23 23:33:55 2003
--- commoncpp2-1.0.8mak/src/thread.cpp  Fri Feb 28 02:39:08 2003
***************
*** 1353,1358 ****
--- 1353,1359 ----
  #endif
  }
  
+ #ifdef HAVE_SIGWAIT
  void  PosixThread::waitSignal(signo_t signo)
  {
        sigset_t        mask;
***************
*** 1365,1370 ****
--- 1366,1372 ----
        sigwait(&mask, &signo);
  #endif
  }
+ #endif
  
  void  PosixThread::setSignal(int signo, bool mode)
  {
diff -c -r commoncpp2-1.0.8/include/config.h.in 
commoncpp2-1.0.8mak/include/config.h.in
*** commoncpp2-1.0.8/include/config.h.in        Sun Jan 26 21:51:16 2003
--- commoncpp2-1.0.8mak/include/config.h.in     Fri Feb 28 11:58:15 2003
***************
*** 646,651 ****
--- 646,655 ----
  #endif
  #endif
  
+ #ifdef socklen_t  /* avoid error in CYGWIN environment */
+ #define HAVE_SOCKLEN_T
+ #endif
+ 
  #ifndef HAVE_SOCKLEN_T
  #if defined(i386) && defined(__svr4__)
  #define HAVE_SOCKLEN_U






reply via email to

[Prev in Thread] Current Thread [Next in Thread]