From 7c519dfd4fc62493d4ed07f77f9aa4a7bb472cd6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 8 May 2010 23:29:29 -0400 Subject: [PATCH] Fix some autoconf issues on OpenBSD Issue 1: autoconf gets accept when a header works properly with cpp but not with cc. This was true of the sys/sysctl.h header on openbsd. The fix: include sys/param.h (if present) when testing for sys/sysctl.h Issue 2: Somehow, autoconf's macro generation code is messed up on some versions of openbsd (including mine, and other people's too) so that instead of SIZEOF_VOID_P, it makes SIZEOF_VOID__. evutil/util.h now works around that. --- configure.in | 7 ++++++- include/event2/util.h | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 54e0f175..52c28528 100644 --- a/configure.in +++ b/configure.in @@ -89,7 +89,12 @@ fi dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h stddef.h poll.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select.h sys/devpoll.h port.h netinet/in.h netinet/in6.h sys/socket.h sys/uio.h arpa/inet.h sys/eventfd.h sys/mman.h sys/sendfile.h netdb.h sys/sysctl.h) +AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h stddef.h poll.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select.h sys/devpoll.h port.h netinet/in.h netinet/in6.h sys/socket.h sys/uio.h arpa/inet.h sys/eventfd.h sys/mman.h sys/sendfile.h netdb.h) +AC_CHECK_HEADERS(sys/sysctl.h, [], [], [ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +]) if test "x$ac_cv_header_sys_queue_h" = "xyes"; then AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h) AC_EGREP_CPP(yes, diff --git a/include/event2/util.h b/include/event2/util.h index fd9a520a..13db8a63 100644 --- a/include/event2/util.h +++ b/include/event2/util.h @@ -137,6 +137,11 @@ extern "C" { #define ev_int8_t signed char #endif +/* Some openbsd autoconf versions get the name of this macro wrong. */ +#if defined(_EVENT_SIZEOF_VOID__) && !defined(_EVENT_SIZEOF_VOID_P) +#define _EVENT_SIZEOF_VOID_P _EVENT_SIZEOF_VOID__ +#endif + #ifdef _EVENT_HAVE_UINTPTR_T #define ev_uintptr_t uintptr_t #define ev_intptr_t intptr_t