[Libevent-users] [PATCH] Compiling on Solaris/OpenSolaris with Sun Studio 12

2007-09-06 Thread Magne Mæhre


I tried to build 1.3d and svn trunk today, and came across a couple of issues.
A patch is attached that remedies these problems, and I _think_ they won't break
anything.

1. configure.in
 a) Added AC_CHECK_LIB for  inet_ntoa in libnsl  (it's where it lives on 
Solaris)

 b) Changed the checks for __func__ and __FUNCTION__ so it no longer tries to
declare an inner function (the void foo() {}).  Inner functions are not
allowed in ISO C, so even though gcc accepts it, other compilers
(like Sun Studio) don't.

2. test/regress.c

 a) Changed references for u_int32_t  to uint32_t, since the latter is C99,
and is also what's tested for in the configure script.


--Magne


Index: test/regress.c
===
--- test/regress.c	(revision 408)
+++ test/regress.c	(working copy)
@@ -821,7 +821,7 @@
cleanup_test();
 }
 
-int decode_int(u_int32_t *pnumber, struct evbuffer *evbuf);
+int decode_int(uint32_t *pnumber, struct evbuffer *evbuf);
 
 void
 read_once_cb(int fd, short event, void *arg)
@@ -872,10 +872,10 @@
 evtag_int_test(void)
 {
 	struct evbuffer *tmp = evbuffer_new();
-	u_int32_t integers[TEST_MAX_INT] = {
+	uint32_t integers[TEST_MAX_INT] = {
 		0xaf0, 0x1000, 0x1, 0xdeadbeef, 0x00, 0xbef000
 	};
-	u_int32_t integer;
+	uint32_t integer;
 	int i;
 
 	for (i = 0; i < TEST_MAX_INT; i++) {
Index: configure.in
===
--- configure.in	(revision 408)
+++ configure.in	(working copy)
@@ -38,6 +38,7 @@
 AC_CHECK_LIB(socket, socket)
 AC_CHECK_LIB(resolv, inet_aton)
 AC_CHECK_LIB(rt, clock_gettime)
+AC_CHECK_LIB(nsl, inet_ntoa)
 
 dnl Checks for header files.
 AC_HEADER_STDC
@@ -367,12 +368,12 @@
 
 AC_MSG_CHECKING([whether our compiler supports __func__])
 AC_TRY_COMPILE([],
- [void foo() { const char *cp = __func__; }],
+ [ const char *cp = __func__; ],
  AC_MSG_RESULT([yes]),
  AC_MSG_RESULT([no])
  AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
  AC_TRY_COMPILE([],
-   [void foo() { const char *cp = __FUNCTION__; }],
+   [ const char *cp = __FUNCTION__; ],
AC_MSG_RESULT([yes])
AC_DEFINE(__func__, __FUNCTION__,
  [Define to appropriate substitue if compiler doesnt have __func__]),
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [PATCH] Compiling on Solaris/OpenSolaris with Sun Studio 12

2007-09-06 Thread Nick Mathewson
On Thu, Sep 06, 2007 at 08:15:40PM +0200, Magne M?hre wrote:
> 
> I tried to build 1.3d and svn trunk today, and came across a couple of 
> issues.
> A patch is attached that remedies these problems, and I _think_ they won't 
> break
> anything.
> 
> 1. configure.in
>  a) Added AC_CHECK_LIB for  inet_ntoa in libnsl  (it's where it lives on 
>  Solaris)
> 
>  b) Changed the checks for __func__ and __FUNCTION__ so it no longer tries 
>  to
> declare an inner function (the void foo() {}).  Inner functions are not
> allowed in ISO C, so even though gcc accepts it, other compilers
> (like Sun Studio) don't.
> 
> 2. test/regress.c
> 
>  a) Changed references for u_int32_t  to uint32_t, since the latter is C99,
> and is also what's tested for in the configure script.

Thanks for your patches; I've checked them in to the subversion
repository.  They should appear in the next release.

-- 
Nick Mathewson


pgpbrheKuGNfd.pgp
Description: PGP signature
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


Re: [Libevent-users] Re: No Date header in HTTP/1.1 response

2007-09-06 Thread Nick Mathewson
On Thu, Aug 23, 2007 at 12:14:09PM +0200, Ralph Moritz wrote:
> On 23/08/07, Jan Kneschke <[EMAIL PROTECTED]> wrote:
> > This patch will break on non C99 compilers with mixed declaration/code
> > errors. Please move the declarations up to the start of this block.
> 
> Thanks for spotting that. New patch below. Hopefully this one's
> kosher.

Thanks!  I've checked in to trunk and to the 1.3 branch, with the
following changes:
  - Now, it only adds the Date header if there is not a Date header
already.

  - On Windows, it uses gmtime() instead of gmtime_r().  (Windows has
no gmtime_r(), but that's okay since its gmtime() uses
thread-local storage to achieve thread-safety.  Hooray for
cross-platform programming, such as it is.)

Please try it out and let us know if there are any problems?

yrs,
-- 
Nick Mathewson


pgpUjulZZdrDe.pgp
Description: PGP signature
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users