From 292092eb29ba6e98bde2839e0cfab2f03f9bd7a2 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Thu, 5 May 2011 15:49:38 +0200 Subject: [PATCH 1/4] Use OPENSSL_LIBS in Makefile.am --- Makefile.am | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4ed82b6f..08a7cafe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -201,7 +201,7 @@ libevent_extra_la_LDFLAGS = $(GENERIC_LDFLAGS) if OPENSSL libevent_openssl_la_SOURCES = bufferevent_openssl.c -libevent_openssl_la_LIBADD = $(MAYBE_CORE) -lssl -lcrypto +libevent_openssl_la_LIBADD = $(MAYBE_CORE) $(OPENSSL_LIBS) libevent_openssl_la_LDFLAGS = $(GENERIC_LDFLAGS) endif diff --git a/configure.in b/configure.in index cca44425..017be83f 100644 --- a/configure.in +++ b/configure.in @@ -110,7 +110,7 @@ OPENSSL_LIBS="" have_openssl=no AC_SEARCH_LIBS([SSL_new], [ssl], [have_openssl=yes - OPENSSL_LIBS="$LIBS" + OPENSSL_LIBS="$LIBS -lcrypto" AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])]) LIBS="$save_LIBS" AC_SUBST(OPENSSL_LIBS) From ceb03b90c487c5b1633ef93e2272c7cb71ff783a Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Thu, 5 May 2011 15:51:11 +0200 Subject: [PATCH 2/4] Move the win32 detection in configure.in --- configure.in | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/configure.in b/configure.in index 017be83f..abc0dbab 100644 --- a/configure.in +++ b/configure.in @@ -84,6 +84,19 @@ AC_SEARCH_LIBS([inet_aton], [resolv]) AC_SEARCH_LIBS([clock_gettime], [rt]) AC_SEARCH_LIBS([sendfile], [sendfile]) +dnl - check if the macro WIN32 is defined on this compiler. +dnl - (this is how we check for a windows version of GCC) +AC_MSG_CHECKING(for WIN32) +AC_TRY_COMPILE(, + [ +#ifndef WIN32 +die horribly +#endif + ], + bwin32=true; AC_MSG_RESULT(yes), + bwin32=false; AC_MSG_RESULT(no), +) + AC_CHECK_HEADERS([zlib.h]) if test "x$ac_cv_header_zlib_h" = "xyes"; then @@ -202,19 +215,6 @@ if test "x$ac_cv_header_sys_sysctl_h" = "xyes"; then ) fi -dnl - check if the macro WIN32 is defined on this compiler. -dnl - (this is how we check for a windows version of GCC) -AC_MSG_CHECKING(for WIN32) -AC_TRY_COMPILE(, - [ -#ifndef WIN32 -die horribly -#endif - ], - bwin32=true; AC_MSG_RESULT(yes), - bwin32=false; AC_MSG_RESULT(no), -) - AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) if test x$bwin32 = xtrue; then From 66193853fd98d6280ab25ddfab38876d6a759046 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Thu, 5 May 2011 16:27:55 +0200 Subject: [PATCH 3/4] Correctly detect openssl on windows --- configure.in | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index abc0dbab..5085edea 100644 --- a/configure.in +++ b/configure.in @@ -116,15 +116,30 @@ fi AM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"]) dnl See if we have openssl. This doesn't go in LIBS either. +if test "$bwin32" = true; then + EV_LIB_WS32=-lws2_32 + EV_LIB_GDI=-lgdi32 +else + EV_LIB_WS32= + EV_LIB_GDI= +fi +AC_SUBST(EV_LIB_WS32) +AC_SUBST(EV_LIB_GDI) + +AC_CHECK_HEADERS([openssl/bio.h]) + if test "$enable_openssl" = "yes"; then save_LIBS="$LIBS" LIBS="" OPENSSL_LIBS="" have_openssl=no AC_SEARCH_LIBS([SSL_new], [ssl], - [have_openssl=yes - OPENSSL_LIBS="$LIBS -lcrypto" - AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])]) + [have_openssl=yes + OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32" + AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])], + [have_openssl=no + AC_DEFINE(HAVE_OPENSSL, 0, [Define if the system lacks openssl])], + [-lcrypto $EV_LIB_GDI $EV_LIB_WS32]) LIBS="$save_LIBS" AC_SUBST(OPENSSL_LIBS) fi From 5786b91e2e779a9cab7292493b11ed82e057d18e Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Thu, 5 May 2011 18:02:42 +0200 Subject: [PATCH 4/4] Fix a compile warning with zlib 1.2.4 and 1.2.5 I took this fix from Tor (commit 1a52e39c22d5, author Nick Mathewson, Copyright (c) 2007-2011, The Tor Project, Inc.) and adapted it slightly for libevent. --- test/regress_zlib.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/regress_zlib.c b/test/regress_zlib.c index 12ddcca9..6dd7bf8f 100644 --- a/test/regress_zlib.c +++ b/test/regress_zlib.c @@ -46,7 +46,6 @@ #include #include -#include #include #include @@ -58,6 +57,28 @@ #include "regress.h" +/* zlib 1.2.4 and 1.2.5 do some "clever" things with macros. Instead of + saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory + that nobody will care if the compile outputs a no-such-identifier warning. + + Sorry, but we like -Werror over here, so I guess we need to define these. + I hope that zlib 1.2.6 doesn't break these too. +*/ +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE 0 +#endif +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE 0 +#endif +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif +#ifndef off64_t +#define off64_t ev_int64_t +#endif + +#include + static int infilter_calls; static int outfilter_calls; static int readcb_finished;