2012-02-10 17:29:53 -05:00
|
|
|
dnl Copyright 2000-2007 Niels Provos
|
|
|
|
dnl Copyright 2007-2012 Niels Provos and Nick Mathewson
|
|
|
|
dnl
|
|
|
|
dnl See LICENSE for copying information.
|
|
|
|
dnl
|
|
|
|
dnl Original version Dug Song <dugsong@monkey.org>
|
|
|
|
|
2021-06-15 13:41:05 +08:00
|
|
|
AC_PREREQ([2.67])
|
2017-01-29 18:13:07 +03:00
|
|
|
AC_INIT(libevent,2.2.0-alpha-dev)
|
2012-08-28 15:09:49 -04:00
|
|
|
AC_CONFIG_SRCDIR(event.c)
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2009-01-22 02:47:35 +00:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2020-07-03 16:02:09 +08:00
|
|
|
|
|
|
|
dnl Automake setup
|
|
|
|
dnl 'foreign' means that GNU package rules are not strictly enforced.
|
|
|
|
AM_INIT_AUTOMAKE([1.13 foreign subdir-objects])
|
|
|
|
|
|
|
|
dnl make compilation quiet unless V=1 is used
|
2019-08-30 10:21:07 +08:00
|
|
|
AM_SILENT_RULES([yes])
|
2020-07-03 16:02:09 +08:00
|
|
|
|
2013-02-08 13:03:29 -05:00
|
|
|
AC_CONFIG_HEADERS(config.h evconfig-private.h:evconfig-private.h.in)
|
2017-01-29 18:13:07 +03:00
|
|
|
AC_DEFINE(NUMERIC_VERSION, 0x02020001, [Numeric representation of the version])
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2010-12-22 22:11:26 -07:00
|
|
|
dnl Try and get a full POSIX environment on obscure systems
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
|
2011-02-13 02:00:10 -05:00
|
|
|
dnl the 'build' machine is where we run configure and compile
|
|
|
|
dnl the 'host' machine is where the resulting stuff runs.
|
2020-07-03 15:47:10 +08:00
|
|
|
AC_CANONICAL_BUILD
|
|
|
|
AC_CANONICAL_HOST
|
2011-02-13 02:00:10 -05:00
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
dnl Checks for programs.
|
2011-05-25 10:56:32 +02:00
|
|
|
AM_PROG_CC_C_O
|
2002-04-09 15:14:06 +00:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_PROG_SED
|
2010-05-08 22:21:52 -04:00
|
|
|
|
2021-06-15 14:34:46 +08:00
|
|
|
AC_ARG_ENABLE([gcc-warnings],
|
|
|
|
AS_HELP_STRING([--disable-gcc-warnings, disable verbose warnings with GCC]))
|
2011-03-20 04:24:33 +01:00
|
|
|
|
2021-06-15 14:34:46 +08:00
|
|
|
AC_ARG_ENABLE([gcc-hardening],
|
|
|
|
AS_HELP_STRING([--enable-gcc-hardening, enable compiler security checks]),
|
2011-04-10 18:25:05 +02:00
|
|
|
[if test x$enableval = xyes; then
|
|
|
|
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
|
|
|
|
CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
|
|
|
|
CFLAGS="$CFLAGS --param ssp-buffer-size=1"
|
|
|
|
fi])
|
2011-03-20 04:24:33 +01:00
|
|
|
|
2021-06-15 14:34:46 +08:00
|
|
|
AC_ARG_ENABLE([thread-support],
|
|
|
|
AS_HELP_STRING([--disable-thread-support, disable support for threading]),
|
2008-03-02 21:18:33 +00:00
|
|
|
[], [enable_thread_support=yes])
|
2021-06-15 14:34:46 +08:00
|
|
|
AC_ARG_ENABLE([malloc-replacement],
|
|
|
|
AS_HELP_STRING([--disable-malloc-replacement, disable support for replacing the memory mgt functions]),
|
|
|
|
[], [enable_malloc_replacement=yes])
|
|
|
|
AC_ARG_ENABLE([openssl],
|
|
|
|
AS_HELP_STRING([--disable-openssl, disable support for openssl encryption]),
|
|
|
|
[], [enable_openssl=yes])
|
|
|
|
AC_ARG_ENABLE([mbedtls],
|
|
|
|
AS_HELP_STRING([--disable-mbedtls, disable support for mbedtls encryption]),
|
|
|
|
[], [enable_mbedtls=yes])
|
|
|
|
AC_ARG_ENABLE([debug-mode],
|
|
|
|
AS_HELP_STRING([--disable-debug-mode, disable support for running in debug mode]),
|
|
|
|
[], [enable_debug_mode=yes])
|
2011-02-13 02:05:04 -05:00
|
|
|
AC_ARG_ENABLE([libevent-install],
|
|
|
|
AS_HELP_STRING([--disable-libevent-install, disable installation of libevent]),
|
2011-02-22 16:14:16 -05:00
|
|
|
[], [enable_libevent_install=yes])
|
2011-02-13 02:05:04 -05:00
|
|
|
AC_ARG_ENABLE([libevent-regress],
|
2011-02-22 16:20:42 -05:00
|
|
|
AS_HELP_STRING([--disable-libevent-regress, skip regress in make check]),
|
2011-02-22 16:14:16 -05:00
|
|
|
[], [enable_libevent_regress=yes])
|
2014-06-13 17:07:50 -04:00
|
|
|
AC_ARG_ENABLE([samples],
|
|
|
|
AS_HELP_STRING([--disable-samples, skip building of sample programs]),
|
|
|
|
[], [enable_samples=yes])
|
2011-02-22 16:20:42 -05:00
|
|
|
AC_ARG_ENABLE([function-sections],
|
|
|
|
AS_HELP_STRING([--enable-function-sections, make static library allow smaller binaries with --gc-sections]),
|
|
|
|
[], [enable_function_sections=no])
|
2011-08-31 11:58:40 -04:00
|
|
|
AC_ARG_ENABLE([verbose-debug],
|
2011-08-06 01:32:40 -04:00
|
|
|
AS_HELP_STRING([--enable-verbose-debug, verbose debug logging]),
|
|
|
|
[], [enable_verbose_debug=no])
|
2016-09-29 18:31:53 -04:00
|
|
|
AC_ARG_ENABLE([clock-gettime],
|
2021-06-15 14:34:46 +08:00
|
|
|
AS_HELP_STRING([--disable-clock-gettime, do not use clock_gettime even if it is available]),
|
2016-09-29 18:31:53 -04:00
|
|
|
[], [enable_clock_gettime=yes])
|
2011-02-22 16:20:42 -05:00
|
|
|
|
2009-07-28 04:03:57 +00:00
|
|
|
|
2019-08-08 21:48:21 +08:00
|
|
|
LT_PREREQ([2.4.2])
|
|
|
|
LT_INIT
|
2005-04-23 02:48:49 +00:00
|
|
|
|
|
|
|
AC_SUBST(LIBTOOL_DEPS)
|
2004-07-19 06:18:10 +00:00
|
|
|
|
2014-06-13 17:07:50 -04:00
|
|
|
AM_CONDITIONAL([BUILD_SAMPLES], [test "$enable_samples" = "yes"])
|
2011-02-13 02:05:04 -05:00
|
|
|
AM_CONDITIONAL([BUILD_REGRESS], [test "$enable_libevent_regress" = "yes"])
|
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
dnl Checks for libraries.
|
2009-07-10 19:38:16 +00:00
|
|
|
AC_SEARCH_LIBS([inet_ntoa], [nsl])
|
|
|
|
AC_SEARCH_LIBS([socket], [socket])
|
|
|
|
AC_SEARCH_LIBS([inet_aton], [resolv])
|
2016-09-29 18:31:53 -04:00
|
|
|
if test "x$enable_clock_gettime" = "xyes"; then
|
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
|
|
|
AC_CHECK_FUNCS([clock_gettime])
|
|
|
|
fi
|
2009-08-16 16:40:42 +00:00
|
|
|
AC_SEARCH_LIBS([sendfile], [sendfile])
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2011-05-25 19:54:33 -04:00
|
|
|
dnl - check if the macro _WIN32 is defined on this compiler.
|
|
|
|
dnl - (this is how we check for a windows compiler)
|
2011-05-05 15:51:11 +02:00
|
|
|
AC_MSG_CHECKING(for WIN32)
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([],
|
|
|
|
[
|
2011-05-25 19:54:33 -04:00
|
|
|
#ifndef _WIN32
|
2011-05-05 15:51:11 +02:00
|
|
|
die horribly
|
|
|
|
#endif
|
2019-08-30 10:21:07 +08:00
|
|
|
]
|
|
|
|
)],
|
|
|
|
[bwin32=true; AC_MSG_RESULT(yes)],
|
|
|
|
[bwin32=false; AC_MSG_RESULT(no)]
|
2011-05-05 15:51:11 +02:00
|
|
|
)
|
|
|
|
|
2017-08-15 05:11:05 +02:00
|
|
|
dnl - check if the macro __midipix__ is defined on this compiler.
|
|
|
|
dnl - (this is how we check for a midipix version of GCC)
|
|
|
|
AC_MSG_CHECKING(for MIDIPIX)
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([],
|
|
|
|
[
|
2017-08-15 05:11:05 +02:00
|
|
|
#ifndef __midipix__
|
|
|
|
die horribly
|
|
|
|
#endif
|
2019-08-30 10:21:07 +08:00
|
|
|
]
|
|
|
|
)],
|
|
|
|
[midipix=true; AC_MSG_RESULT(yes)],
|
|
|
|
[midipix=false; AC_MSG_RESULT(no)]
|
2017-08-15 05:11:05 +02:00
|
|
|
)
|
|
|
|
|
2011-06-01 13:48:02 -04:00
|
|
|
dnl - check if the macro __CYGWIN__ is defined on this compiler.
|
|
|
|
dnl - (this is how we check for a cygwin version of GCC)
|
|
|
|
AC_MSG_CHECKING(for CYGWIN)
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([],
|
|
|
|
[
|
2011-06-01 13:48:02 -04:00
|
|
|
#ifndef __CYGWIN__
|
|
|
|
die horribly
|
|
|
|
#endif
|
2019-08-30 10:21:07 +08:00
|
|
|
]
|
|
|
|
)],
|
|
|
|
[cygwin=true; AC_MSG_RESULT(yes)],
|
|
|
|
[cygwin=false; AC_MSG_RESULT(no)]
|
2011-06-01 13:48:02 -04:00
|
|
|
)
|
|
|
|
|
2011-02-13 01:34:40 -05:00
|
|
|
AC_CHECK_HEADERS([zlib.h])
|
|
|
|
|
|
|
|
if test "x$ac_cv_header_zlib_h" = "xyes"; then
|
2008-04-30 04:31:10 +00:00
|
|
|
dnl Determine if we have zlib for regression tests
|
2009-07-10 19:38:16 +00:00
|
|
|
dnl Don't put this one in LIBS
|
|
|
|
save_LIBS="$LIBS"
|
|
|
|
LIBS=""
|
2008-04-30 04:31:10 +00:00
|
|
|
ZLIB_LIBS=""
|
2009-07-10 19:38:16 +00:00
|
|
|
have_zlib=no
|
|
|
|
AC_SEARCH_LIBS([inflateEnd], [z],
|
2008-04-30 04:31:10 +00:00
|
|
|
[have_zlib=yes
|
2009-07-10 19:38:16 +00:00
|
|
|
ZLIB_LIBS="$LIBS"
|
|
|
|
AC_DEFINE(HAVE_LIBZ, 1, [Define if the system has zlib])])
|
|
|
|
LIBS="$save_LIBS"
|
2008-04-30 04:31:10 +00:00
|
|
|
AC_SUBST(ZLIB_LIBS)
|
2011-02-13 01:34:40 -05:00
|
|
|
fi
|
2009-07-10 19:38:16 +00:00
|
|
|
AM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"])
|
2008-04-30 04:31:10 +00:00
|
|
|
|
2009-07-28 04:03:57 +00:00
|
|
|
dnl See if we have openssl. This doesn't go in LIBS either.
|
2011-05-05 16:27:55 +02:00
|
|
|
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)
|
2012-02-14 15:37:58 -05:00
|
|
|
AC_SUBST(OPENSSL_LIBADD)
|
2011-05-05 16:27:55 +02:00
|
|
|
|
2011-09-12 14:53:39 -04:00
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
2011-08-28 14:30:52 -04:00
|
|
|
LIBEVENT_OPENSSL
|
2020-05-28 17:14:46 +08:00
|
|
|
LIBEVENT_MBEDTLS
|
2009-07-28 04:03:57 +00:00
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
dnl Checks for header files.
|
2021-04-27 21:15:03 +03:00
|
|
|
AC_CHECK_HEADERS([arpa/inet.h fcntl.h ifaddrs.h mach/mach_time.h mach/mach.h netdb.h netinet/in.h netinet/in6.h netinet/tcp.h sys/un.h poll.h port.h stdarg.h stddef.h sys/devpoll.h sys/epoll.h sys/event.h sys/eventfd.h sys/ioctl.h sys/mman.h sys/param.h sys/queue.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/stat.h sys/time.h sys/timerfd.h sys/uio.h sys/wait.h sys/random.h errno.h afunix.h])
|
2012-07-26 10:09:13 -04:00
|
|
|
|
2019-10-16 01:11:51 +03:00
|
|
|
case "${host_os}" in
|
|
|
|
linux*) ;;
|
|
|
|
*)
|
|
|
|
AC_CHECK_HEADERS(sys/sysctl.h, [], [], [
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
])
|
|
|
|
esac
|
2019-09-03 00:34:35 +03:00
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
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,
|
|
|
|
[
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#ifdef TAILQ_FOREACH
|
|
|
|
yes
|
|
|
|
#endif
|
|
|
|
], [AC_MSG_RESULT(yes)
|
2003-02-28 22:38:30 +00:00
|
|
|
AC_DEFINE(HAVE_TAILQFOREACH, 1,
|
|
|
|
[Define if TAILQ_FOREACH is defined in <sys/queue.h>])],
|
|
|
|
AC_MSG_RESULT(no)
|
2002-04-09 15:14:06 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2021-06-16 15:29:30 +08:00
|
|
|
dnl if we have sys/time.h, check for timer* macros
|
2002-04-09 15:14:06 +00:00
|
|
|
if test "x$ac_cv_header_sys_time_h" = "xyes"; then
|
2021-06-16 15:29:30 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(for timeradd in sys/time.h)
|
|
|
|
AC_EGREP_CPP(yes, [
|
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef timeradd
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERADD, 1, [Define if timeradd is defined in <sys/time.h>])],
|
|
|
|
[AC_MSG_RESULT(no)]
|
2002-04-09 15:14:06 +00:00
|
|
|
)
|
|
|
|
|
2021-06-16 15:29:30 +08:00
|
|
|
AC_MSG_CHECKING(for timercmp in sys/time.h)
|
|
|
|
AC_EGREP_CPP(yes, [
|
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef timercmp
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERCMP, 1,[Define if timercmp is defined in <sys/time.h>])],
|
|
|
|
[AC_MSG_RESULT(no)]
|
2005-02-22 16:12:34 +00:00
|
|
|
)
|
|
|
|
|
2021-06-16 15:29:30 +08:00
|
|
|
AC_MSG_CHECKING(for timerclear in sys/time.h)
|
|
|
|
AC_EGREP_CPP(yes, [
|
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef timerclear
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERCLEAR, 1, [Define if timerclear is defined in <sys/time.h>])],
|
|
|
|
[AC_MSG_RESULT(no)]
|
2005-02-22 16:12:34 +00:00
|
|
|
)
|
|
|
|
|
2021-06-16 15:29:30 +08:00
|
|
|
AC_MSG_CHECKING(for timerisset in sys/time.h)
|
|
|
|
AC_EGREP_CPP(yes, [
|
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef timerisset
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMERISSET, 1, [Define if timerisset is defined in <sys/time.h>])],
|
|
|
|
[AC_MSG_RESULT(no)]
|
2005-02-22 16:12:34 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2010-03-04 01:13:51 -05:00
|
|
|
if test "x$ac_cv_header_sys_sysctl_h" = "xyes"; then
|
2019-09-03 00:34:35 +03:00
|
|
|
AC_CHECK_DECLS([CTL_KERN, KERN_ARND], [], [],
|
2010-04-23 16:08:09 -04:00
|
|
|
[[#include <sys/types.h>
|
|
|
|
#include <sys/sysctl.h>]]
|
2010-03-04 01:13:51 -05:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2006-09-27 03:07:38 +00:00
|
|
|
AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
|
2011-06-01 13:48:02 -04:00
|
|
|
AM_CONDITIONAL(BUILD_CYGWIN, test x$cygwin = xtrue)
|
2017-08-15 05:11:05 +02:00
|
|
|
AM_CONDITIONAL(BUILD_MIDIPIX, test x$midipix = xtrue)
|
|
|
|
AM_CONDITIONAL(BUILD_WITH_NO_UNDEFINED, test x$bwin32 = xtrue || test x$cygwin = xtrue || test x$midipix = xtrue)
|
2006-09-27 03:07:38 +00:00
|
|
|
|
2009-11-16 22:25:46 +00:00
|
|
|
if test x$bwin32 = xtrue; then
|
2021-03-23 09:52:14 +08:00
|
|
|
AC_CHECK_LIB([ws2_32], [main])
|
2009-11-16 22:25:46 +00:00
|
|
|
fi
|
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
2004-07-19 06:18:10 +00:00
|
|
|
AC_C_INLINE
|
2002-04-09 15:14:06 +00:00
|
|
|
|
|
|
|
dnl Checks for library functions.
|
2021-04-27 21:15:03 +03:00
|
|
|
AC_CHECK_FUNCS([accept4 arc4random arc4random_buf arc4random_addrandom eventfd epoll_create1 fcntl getegid geteuid getifaddrs gettimeofday issetugid mach_absolute_time mmap nanosleep pipe pipe2 putenv sendfile setenv setrlimit sigaction signal strsignal strlcpy strsep strtok_r strtoll sysctl timerfd_create umask unsetenv usleep getrandom ])
|
2019-09-19 15:24:51 +08:00
|
|
|
|
2020-03-14 11:13:38 +08:00
|
|
|
AS_IF([test x$bwin32 = xtrue],
|
|
|
|
AC_CHECK_FUNCS(_gmtime64_s, , [AC_CHECK_FUNCS(_gmtime64)])
|
|
|
|
)
|
2019-09-19 15:24:51 +08:00
|
|
|
|
2013-03-31 14:05:26 -04:00
|
|
|
AM_CONDITIONAL(STRLCPY_IMPL, [test x"$ac_cv_func_strlcpy" = xno])
|
2011-02-13 01:39:10 -05:00
|
|
|
|
2020-03-14 11:13:38 +08:00
|
|
|
m4_define([funcstochk],
|
|
|
|
[getnameinfo
|
|
|
|
getprotobynumber
|
|
|
|
getservbyname
|
|
|
|
inet_ntop
|
|
|
|
inet_pton]
|
|
|
|
)
|
|
|
|
|
|
|
|
AS_IF([test x$bwin32 = xtrue],
|
|
|
|
[AX_CHECK_DECLS_EX([funcstochk getaddrinfo],
|
|
|
|
[#ifdef _WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#endif])],
|
|
|
|
[AC_CHECK_FUNCS(m4_normalize(funcstochk))]
|
|
|
|
)
|
|
|
|
|
|
|
|
m4_undefine([funcstochk])
|
|
|
|
|
|
|
|
dnl check getaddrinfo and gethostbyname_r for non-windows
|
|
|
|
AS_IF([test x$bwin32 = xfalse], [
|
2011-02-13 01:39:10 -05:00
|
|
|
AC_CACHE_CHECK(
|
|
|
|
[for getaddrinfo],
|
|
|
|
[libevent_cv_getaddrinfo],
|
|
|
|
[AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
|
|
|
]],
|
|
|
|
[[
|
|
|
|
getaddrinfo;
|
|
|
|
]]
|
|
|
|
)],
|
|
|
|
[libevent_cv_getaddrinfo=yes],
|
|
|
|
[libevent_cv_getaddrinfo=no]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
if test "$libevent_cv_getaddrinfo" = "yes" ; then
|
|
|
|
AC_DEFINE([HAVE_GETADDRINFO], [1], [Do we have getaddrinfo()?])
|
|
|
|
else
|
2011-01-31 17:36:49 -05:00
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl Check for gethostbyname_r in all its glorious incompatible versions.
|
|
|
|
dnl (This is cut-and-pasted from Tor, which based its logic on
|
|
|
|
dnl Python's configure.in.)
|
2009-11-16 22:25:46 +00:00
|
|
|
AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
|
|
|
|
[Define this if you have any gethostbyname_r()])
|
|
|
|
|
|
|
|
AC_CHECK_FUNC(gethostbyname_r, [
|
|
|
|
AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
|
|
|
|
OLD_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
|
2010-10-14 20:15:04 +02:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
2009-11-16 22:25:46 +00:00
|
|
|
#include <netdb.h>
|
|
|
|
], [[
|
|
|
|
char *cp1, *cp2;
|
|
|
|
struct hostent *h1, *h2;
|
|
|
|
int i1, i2;
|
|
|
|
(void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
|
2010-10-14 20:15:04 +02:00
|
|
|
]])],[
|
2009-11-16 22:25:46 +00:00
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
|
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
|
|
|
|
[Define this if gethostbyname_r takes 6 arguments])
|
|
|
|
AC_MSG_RESULT(6)
|
|
|
|
], [
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
2009-11-16 22:25:46 +00:00
|
|
|
#include <netdb.h>
|
|
|
|
], [
|
|
|
|
char *cp1, *cp2;
|
|
|
|
struct hostent *h1;
|
|
|
|
int i1, i2;
|
|
|
|
(void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
|
2019-08-30 10:21:07 +08:00
|
|
|
])], [
|
2009-11-16 22:25:46 +00:00
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
|
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
|
|
|
|
[Define this if gethostbyname_r takes 5 arguments])
|
|
|
|
AC_MSG_RESULT(5)
|
2019-08-30 10:21:07 +08:00
|
|
|
], [
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
2009-11-16 22:25:46 +00:00
|
|
|
#include <netdb.h>
|
|
|
|
], [
|
|
|
|
char *cp1;
|
|
|
|
struct hostent *h1;
|
|
|
|
struct hostent_data hd;
|
|
|
|
(void) gethostbyname_r(cp1,h1,&hd);
|
2019-08-30 10:21:07 +08:00
|
|
|
])], [
|
2009-11-16 22:25:46 +00:00
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
|
|
|
|
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
|
|
|
|
[Define this if gethostbyname_r takes 3 arguments])
|
|
|
|
AC_MSG_RESULT(3)
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(0)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
CFLAGS=$OLD_CFLAGS
|
|
|
|
])
|
|
|
|
|
2011-01-31 17:36:49 -05:00
|
|
|
fi
|
2020-03-14 11:13:38 +08:00
|
|
|
]) dnl end of checking getaddrinfo and gethostbyname_r
|
2008-02-16 20:49:47 +00:00
|
|
|
|
2004-08-10 18:29:37 +00:00
|
|
|
AC_MSG_CHECKING(for F_SETFD in fcntl.h)
|
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[
|
2019-02-25 11:59:15 -08:00
|
|
|
#define _GNU_SOURCE 1
|
2004-08-10 18:29:37 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#ifdef F_SETFD
|
|
|
|
yes
|
|
|
|
#endif
|
|
|
|
], [ AC_DEFINE(HAVE_SETFD, 1,
|
|
|
|
[Define if F_SETFD is defined in <fcntl.h>])
|
|
|
|
AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no))
|
|
|
|
|
2003-02-28 22:38:30 +00:00
|
|
|
needsignal=no
|
2002-04-09 19:30:22 +00:00
|
|
|
haveselect=no
|
2010-03-23 13:27:10 -04:00
|
|
|
if test x$bwin32 != xtrue; then
|
|
|
|
AC_CHECK_FUNCS(select, [haveselect=yes], )
|
|
|
|
if test "x$haveselect" = "xyes" ; then
|
|
|
|
needsignal=yes
|
|
|
|
fi
|
2002-04-09 15:14:06 +00:00
|
|
|
fi
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(SELECT_BACKEND, [test "x$haveselect" = "xyes"])
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2003-02-28 22:38:30 +00:00
|
|
|
havepoll=no
|
|
|
|
AC_CHECK_FUNCS(poll, [havepoll=yes], )
|
|
|
|
if test "x$havepoll" = "xyes" ; then
|
2003-03-07 23:21:01 +00:00
|
|
|
needsignal=yes
|
2003-02-28 22:38:30 +00:00
|
|
|
fi
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(POLL_BACKEND, [test "x$havepoll" = "xyes"])
|
2003-02-28 22:38:30 +00:00
|
|
|
|
2004-07-30 04:57:21 +00:00
|
|
|
havedevpoll=no
|
|
|
|
if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then
|
|
|
|
AC_DEFINE(HAVE_DEVPOLL, 1,
|
|
|
|
[Define if /dev/poll is available])
|
|
|
|
fi
|
2010-05-08 18:09:27 -04:00
|
|
|
AM_CONDITIONAL(DEVPOLL_BACKEND, [test "x$ac_cv_header_sys_devpoll_h" = "xyes"])
|
2004-07-30 04:57:21 +00:00
|
|
|
|
2002-04-09 15:14:06 +00:00
|
|
|
havekqueue=no
|
|
|
|
if test "x$ac_cv_header_sys_event_h" = "xyes"; then
|
|
|
|
AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
|
|
|
|
if test "x$havekqueue" = "xyes" ; then
|
|
|
|
AC_MSG_CHECKING(for working kqueue)
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_RUN_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([
|
2017-08-19 16:01:46 -07:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
2002-04-09 15:14:06 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/event.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
2019-08-30 10:21:07 +08:00
|
|
|
], [[
|
2002-04-09 15:14:06 +00:00
|
|
|
int kq;
|
|
|
|
int n;
|
2019-08-30 10:21:07 +08:00
|
|
|
int fd[2];
|
2002-04-09 15:14:06 +00:00
|
|
|
struct kevent ev;
|
|
|
|
struct timespec ts;
|
2019-08-30 10:21:07 +08:00
|
|
|
char buf[80000];
|
2002-04-09 15:14:06 +00:00
|
|
|
|
|
|
|
if (pipe(fd) == -1)
|
2019-08-30 10:21:07 +08:00
|
|
|
return 1;
|
|
|
|
if (fcntl(fd[1], F_SETFL, O_NONBLOCK) == -1)
|
|
|
|
return 1;
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2019-08-30 10:21:07 +08:00
|
|
|
while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf))
|
2002-04-09 15:14:06 +00:00
|
|
|
;
|
|
|
|
|
2019-08-30 10:21:07 +08:00
|
|
|
if ((kq = kqueue()) == -1)
|
|
|
|
return 1;
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2010-08-19 09:38:44 -04:00
|
|
|
memset(&ev, 0, sizeof(ev));
|
2019-08-30 10:21:07 +08:00
|
|
|
ev.ident = fd[1];
|
2002-04-09 15:14:06 +00:00
|
|
|
ev.filter = EVFILT_WRITE;
|
|
|
|
ev.flags = EV_ADD | EV_ENABLE;
|
|
|
|
n = kevent(kq, &ev, 1, NULL, 0, NULL);
|
|
|
|
if (n == -1)
|
2019-08-30 10:21:07 +08:00
|
|
|
return 1;
|
2010-08-19 09:38:44 -04:00
|
|
|
|
2019-08-30 10:21:07 +08:00
|
|
|
read(fd[0], buf, sizeof(buf));
|
2002-04-09 15:14:06 +00:00
|
|
|
|
|
|
|
ts.tv_sec = 0;
|
|
|
|
ts.tv_nsec = 0;
|
|
|
|
n = kevent(kq, NULL, 0, &ev, 1, &ts);
|
|
|
|
if (n == -1 || n == 0)
|
2019-08-30 10:21:07 +08:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
]]
|
|
|
|
)],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
|
|
|
|
[Define if kqueue works correctly with pipes])
|
|
|
|
havekqueue=yes
|
|
|
|
], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)]
|
|
|
|
)
|
2002-04-09 15:14:06 +00:00
|
|
|
fi
|
|
|
|
fi
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"])
|
2002-04-09 15:14:06 +00:00
|
|
|
|
2003-03-07 23:21:01 +00:00
|
|
|
haveepollsyscall=no
|
2010-03-12 14:16:30 -05:00
|
|
|
haveepoll=no
|
|
|
|
AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
|
|
|
|
if test "x$haveepoll" = "xyes" ; then
|
|
|
|
AC_DEFINE(HAVE_EPOLL, 1,
|
|
|
|
[Define if your system supports the epoll system calls])
|
|
|
|
needsignal=yes
|
|
|
|
fi
|
2003-03-07 23:21:01 +00:00
|
|
|
if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
|
|
|
|
if test "x$haveepoll" = "xno" ; then
|
|
|
|
AC_MSG_CHECKING(for epoll system call)
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_RUN_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[
|
2003-03-07 23:21:01 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <sys/epoll.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
epoll_create(int size)
|
|
|
|
{
|
|
|
|
return (syscall(__NR_epoll_create, size));
|
|
|
|
}
|
2019-08-30 10:21:07 +08:00
|
|
|
]],[[
|
2003-03-07 23:21:01 +00:00
|
|
|
int epfd;
|
|
|
|
|
|
|
|
epfd = epoll_create(256);
|
2019-08-30 10:21:07 +08:00
|
|
|
return (epfd == -1 ? 1 : 0);
|
|
|
|
]]
|
|
|
|
)],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_EPOLL, 1,
|
|
|
|
[Define if your system supports the epoll system calls])
|
|
|
|
needsignal=yes
|
|
|
|
have_epoll=yes
|
|
|
|
AC_LIBOBJ(epoll_sub)
|
|
|
|
], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)]
|
|
|
|
)
|
2003-03-07 23:21:01 +00:00
|
|
|
fi
|
|
|
|
fi
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"])
|
2003-03-07 23:21:01 +00:00
|
|
|
|
2006-07-15 02:55:57 +00:00
|
|
|
haveeventports=no
|
|
|
|
AC_CHECK_FUNCS(port_create, [haveeventports=yes], )
|
|
|
|
if test "x$haveeventports" = "xyes" ; then
|
|
|
|
AC_DEFINE(HAVE_EVENT_PORTS, 1,
|
|
|
|
[Define if your system supports event ports])
|
2007-09-20 18:26:46 +00:00
|
|
|
needsignal=yes
|
|
|
|
fi
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(EVPORT_BACKEND, [test "x$haveeventports" = "xyes"])
|
|
|
|
|
2020-04-22 19:44:45 -07:00
|
|
|
havewepoll=no
|
2007-09-20 18:26:46 +00:00
|
|
|
if test "x$bwin32" = "xtrue"; then
|
|
|
|
needsignal=yes
|
2020-04-22 19:44:45 -07:00
|
|
|
if test "x$cygwin" = "xfalse"; then
|
|
|
|
havewepoll=yes
|
|
|
|
AC_DEFINE(HAVE_WEPOLL, 1,
|
|
|
|
[Define if your system supports the wepoll module])
|
|
|
|
fi
|
2007-09-20 18:26:46 +00:00
|
|
|
fi
|
2020-04-22 19:44:45 -07:00
|
|
|
AM_CONDITIONAL(WEPOLL_BACKEND, [test "x$havewepoll" = "xyes"])
|
2010-03-12 14:16:30 -05:00
|
|
|
AM_CONDITIONAL(SIGNAL_SUPPORT, [test "x$needsignal" = "xyes"])
|
2003-03-07 23:21:01 +00:00
|
|
|
|
2003-02-28 22:38:30 +00:00
|
|
|
AC_TYPE_PID_T
|
|
|
|
AC_TYPE_SIZE_T
|
2009-04-30 23:56:53 +00:00
|
|
|
AC_TYPE_SSIZE_T
|
2008-02-18 20:04:01 +00:00
|
|
|
|
2010-01-26 12:06:41 -05:00
|
|
|
AC_CHECK_TYPES([uint64_t, uint32_t, uint16_t, uint8_t, uintptr_t], , ,
|
2008-02-18 20:04:01 +00:00
|
|
|
[#ifdef HAVE_STDINT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#elif defined(HAVE_INTTYPES_H)
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif])
|
|
|
|
|
2009-09-23 23:51:26 +00:00
|
|
|
AC_CHECK_TYPES([fd_mask], , ,
|
|
|
|
[#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
2010-11-22 20:44:10 -07:00
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
2009-09-23 23:51:26 +00:00
|
|
|
#endif])
|
|
|
|
|
2008-02-18 20:04:01 +00:00
|
|
|
AC_CHECK_SIZEOF(long long)
|
|
|
|
AC_CHECK_SIZEOF(long)
|
|
|
|
AC_CHECK_SIZEOF(int)
|
|
|
|
AC_CHECK_SIZEOF(short)
|
2009-11-04 20:17:32 +00:00
|
|
|
AC_CHECK_SIZEOF(size_t)
|
2010-01-26 12:06:41 -05:00
|
|
|
AC_CHECK_SIZEOF(void *)
|
2011-09-12 14:53:39 -04:00
|
|
|
AC_CHECK_SIZEOF(off_t)
|
2017-09-01 15:50:36 -07:00
|
|
|
AC_CHECK_SIZEOF(time_t)
|
2008-02-18 20:04:01 +00:00
|
|
|
|
2019-05-12 16:12:06 +03:00
|
|
|
AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, struct sockaddr_un, sa_family_t, struct addrinfo, struct sockaddr_storage], , ,
|
2019-02-25 11:59:15 -08:00
|
|
|
[#define _GNU_SOURCE 1
|
2009-11-16 22:25:46 +00:00
|
|
|
#include <sys/types.h>
|
2009-01-02 21:21:58 +00:00
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2007-01-27 04:22:36 +00:00
|
|
|
#include <netinet/in.h>
|
2009-01-02 21:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN6_H
|
|
|
|
#include <netinet/in6.h>
|
|
|
|
#endif
|
2019-05-12 16:12:06 +03:00
|
|
|
#ifdef HAVE_SYS_UN_H
|
|
|
|
#include <sys/un.h>
|
|
|
|
#endif
|
2009-01-02 21:21:58 +00:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
2007-01-27 04:22:36 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
2009-11-16 22:25:46 +00:00
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
2011-05-25 19:54:33 -04:00
|
|
|
#ifdef _WIN32
|
2009-01-02 21:21:58 +00:00
|
|
|
#define WIN32_WINNT 0x400
|
|
|
|
#define _WIN32_WINNT 0x400
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
|
|
|
#include <winsock.h>
|
|
|
|
#else
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
])
|
2010-11-23 19:09:08 -07:00
|
|
|
AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16, struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len, struct sockaddr_storage.ss_family, struct sockaddr_storage.__ss_family], , ,
|
2009-01-02 21:21:58 +00:00
|
|
|
[#include <sys/types.h>
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif
|
2007-01-27 04:22:36 +00:00
|
|
|
#ifdef HAVE_NETINET_IN6_H
|
|
|
|
#include <netinet/in6.h>
|
2009-01-02 21:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
2011-05-25 19:54:33 -04:00
|
|
|
#ifdef _WIN32
|
2009-01-02 21:21:58 +00:00
|
|
|
#define WIN32_WINNT 0x400
|
|
|
|
#define _WIN32_WINNT 0x400
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
|
|
|
#include <winsock.h>
|
|
|
|
#else
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
])
|
2003-02-28 22:38:30 +00:00
|
|
|
|
2017-01-28 16:17:07 +00:00
|
|
|
AC_CHECK_TYPES([struct linger],,,
|
2013-02-03 19:08:37 +00:00
|
|
|
[
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
2020-03-14 11:13:38 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#endif
|
2013-02-03 19:08:37 +00:00
|
|
|
])
|
|
|
|
|
2003-02-28 22:38:30 +00:00
|
|
|
AC_MSG_CHECKING([for socklen_t])
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([
|
2003-02-28 22:38:30 +00:00
|
|
|
#include <sys/types.h>
|
2018-08-01 00:58:02 +03:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#else
|
|
|
|
#include <sys/socket.h>
|
2019-08-30 10:21:07 +08:00
|
|
|
#endif
|
|
|
|
],[socklen_t x;]
|
|
|
|
)],
|
|
|
|
[AC_MSG_RESULT([yes])],
|
2003-02-28 22:38:30 +00:00
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
AC_DEFINE(socklen_t, unsigned int,
|
2019-08-30 10:21:07 +08:00
|
|
|
[Define to unsigned int if you dont have it])]
|
2003-02-28 22:38:30 +00:00
|
|
|
)
|
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl __func__/__FUNCTION__ is not a macros in general
|
2005-02-22 16:12:34 +00:00
|
|
|
AC_MSG_CHECKING([whether our compiler supports __func__])
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([],
|
|
|
|
[ const char *cp = __func__; ]
|
|
|
|
)],
|
|
|
|
[ AC_DEFINE(HAVE___func__, 1, [Define to 1 if compiler have __func__])
|
2018-06-19 10:15:08 +03:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],
|
2019-08-30 10:21:07 +08:00
|
|
|
[AC_MSG_RESULT([no])]
|
2018-06-19 10:15:08 +03:00
|
|
|
)
|
|
|
|
AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
|
2019-08-30 10:21:07 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([],
|
|
|
|
[ const char *cp = __FUNCTION__; ]
|
|
|
|
)],
|
|
|
|
[ AC_DEFINE(HAVE___FUNCTION__, 1, [Define to 1 if compiler have __FUNCTION__])
|
2018-06-19 10:15:08 +03:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
],
|
2019-08-30 10:21:07 +08:00
|
|
|
[AC_MSG_RESULT([no])]
|
2018-06-19 10:15:08 +03:00
|
|
|
)
|
2006-07-15 02:55:57 +00:00
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl check if we can compile with pthreads
|
2008-03-02 21:18:33 +00:00
|
|
|
have_pthreads=no
|
2010-05-08 22:21:52 -04:00
|
|
|
if test x$bwin32 != xtrue && test "$enable_thread_support" != "no"; then
|
2009-12-30 11:58:36 -05:00
|
|
|
ACX_PTHREAD([
|
2008-03-02 21:18:33 +00:00
|
|
|
AC_DEFINE(HAVE_PTHREADS, 1,
|
|
|
|
[Define if we have pthreads on this system])
|
|
|
|
have_pthreads=yes])
|
2010-05-08 22:21:52 -04:00
|
|
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
2010-10-26 12:09:20 -04:00
|
|
|
AC_CHECK_SIZEOF(pthread_t, ,
|
|
|
|
[AC_INCLUDES_DEFAULT()
|
|
|
|
#include <pthread.h> ]
|
|
|
|
)
|
2020-08-29 01:15:20 +03:00
|
|
|
|
|
|
|
AC_CHECK_FUNCS([pthread_mutexattr_setprotocol])
|
2009-12-30 11:58:36 -05:00
|
|
|
fi
|
2016-08-07 22:19:39 +03:00
|
|
|
AM_CONDITIONAL(THREADS, [test "$enable_thread_support" != "no"])
|
2009-07-17 21:47:45 +00:00
|
|
|
AM_CONDITIONAL(PTHREADS, [test "$have_pthreads" != "no" && test "$enable_thread_support" != "no"])
|
2008-03-02 21:18:33 +00:00
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl check if we should compile locking into the library
|
2008-03-02 21:18:33 +00:00
|
|
|
if test x$enable_thread_support = xno; then
|
|
|
|
AC_DEFINE(DISABLE_THREAD_SUPPORT, 1,
|
|
|
|
[Define if libevent should not be compiled with thread support])
|
|
|
|
fi
|
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl check if we should hard-code the mm functions.
|
2009-04-17 06:56:57 +00:00
|
|
|
if test x$enable_malloc_replacement = xno; then
|
|
|
|
AC_DEFINE(DISABLE_MM_REPLACEMENT, 1,
|
|
|
|
[Define if libevent should not allow replacing the mm functions])
|
|
|
|
fi
|
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl check if we should hard-code debugging out
|
2010-01-22 00:34:37 -05:00
|
|
|
if test x$enable_debug_mode = xno; then
|
|
|
|
AC_DEFINE(DISABLE_DEBUG_MODE, 1,
|
|
|
|
[Define if libevent should build without support for a debug mode])
|
|
|
|
fi
|
2019-08-30 10:21:07 +08:00
|
|
|
|
2020-05-28 17:14:46 +08:00
|
|
|
dnl check if we should enable verbose debugging
|
2011-08-06 01:32:40 -04:00
|
|
|
if test x$enable_verbose_debug = xyes; then
|
2011-08-02 17:23:52 -04:00
|
|
|
CFLAGS="$CFLAGS -DUSE_DEBUG"
|
|
|
|
fi
|
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
dnl check if we have and should use OpenSSL
|
2009-07-28 04:03:57 +00:00
|
|
|
AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"])
|
|
|
|
|
2020-05-28 17:14:46 +08:00
|
|
|
# check if we have and should use mbedtls
|
|
|
|
AM_CONDITIONAL(MBEDTLS, [test "$enable_mbedtls" != "no" && test "$have_mbedtls" = "yes"])
|
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
dnl enable some warnings by default
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"],[],[-Werror])
|
2007-11-26 19:18:49 +00:00
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
dnl Disable the strict-aliasing optimization, since it breaks
|
|
|
|
dnl our sockaddr-handling code in strange ways.
|
|
|
|
dnl See 52eb4951302554dd696d6a0120ad5d3f6cffb7bb.
|
|
|
|
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],[],[-Werror])
|
2007-11-26 19:18:49 +00:00
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
dnl Add warnings which we use in development but not for releases.
|
|
|
|
if test x$enable_gcc_warnings != xno && test "$GCC" = "yes"; then
|
2011-04-10 17:23:11 +02:00
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl -W is the same as -Wextra
|
2020-06-26 14:33:43 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-W], [CFLAGS="$CFLAGS -W"],[],[-Werror])
|
|
|
|
|
|
|
|
dnl The AX_CHECK_COMPILE_FLAG macro ignores warnings, so -Werror is used
|
|
|
|
dnl to convert warnings into errors and prevent the addition of unknown flags.
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Waddress],[CFLAGS="$CFLAGS -Waddress"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wbad-function-cast],[CFLAGS="$CFLAGS -Wbad-function-cast"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wdeclaration-after-statement],[CFLAGS="$CFLAGS -Wdeclaration-after-statement"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wfloat-equal],[CFLAGS="$CFLAGS -Wfloat-equal"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Winit-self],[CFLAGS="$CFLAGS -Winit-self"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wlogical-op],[CFLAGS="$CFLAGS -Wlogical-op"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],[CFLAGS="$CFLAGS -Wmissing-declarations"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wmissing-field-initializers],[CFLAGS="$CFLAGS -Wmissing-field-initializers"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],[CFLAGS="$CFLAGS -Wmissing-prototypes"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wnested-externs],[CFLAGS="$CFLAGS -Wnested-externs"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wnormalized=id],[CFLAGS="$CFLAGS -Wnormalized=id"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Woverride-init],[CFLAGS="$CFLAGS -Woverride-init"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wpointer-arith],[CFLAGS="$CFLAGS -Wpointer-arith"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[CFLAGS="$CFLAGS -Wredundant-decls"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[CFLAGS="$CFLAGS -Wstrict-prototypes"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wundef],[CFLAGS="$CFLAGS -Wundef"],[],[-Werror])
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wwrite-strings],[CFLAGS="$CFLAGS -Wwrite-strings"],[],[-Werror])
|
|
|
|
|
|
|
|
dnl Convert warnings into errors
|
2011-03-20 04:24:33 +01:00
|
|
|
if test x$enable_gcc_warnings = xyes; then
|
2020-06-26 14:33:43 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
|
2011-03-20 04:24:33 +01:00
|
|
|
fi
|
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
dnl Disable warnings for unused paramaters
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter], [CFLAGS="$CFLAGS -Wno-unused-parameter"],[],[-Werror])
|
2011-04-10 17:23:11 +02:00
|
|
|
|
2020-06-26 14:33:43 +08:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
|
|
|
|
#if !defined(__clang__)
|
|
|
|
#error
|
|
|
|
#endif])], have_clang=yes, have_clang=no)
|
2011-04-10 17:23:11 +02:00
|
|
|
|
|
|
|
if test x$have_clang = xyes; then
|
2020-06-28 18:40:26 +08:00
|
|
|
dnl Disable unused-function warnings. These trigger for minheap-internal.h.
|
2020-06-26 14:33:43 +08:00
|
|
|
AX_CHECK_COMPILE_FLAG([-Wno-unused-function], [CFLAGS="$CFLAGS -Wno-unused-function"],[],[-Werror])
|
2014-02-19 06:49:31 +01:00
|
|
|
|
|
|
|
case "$host_os" in
|
2020-06-26 14:33:43 +08:00
|
|
|
darwin*)
|
|
|
|
dnl Clang on macOS emits warnings for each directory specified which
|
|
|
|
dnl isn't "used", generating a lot of build noise.
|
|
|
|
AX_CHECK_COMPILE_FLAG([-Qunused-arguments], [CFLAGS="$CFLAGS -Qunused-arguments"],[],[-Werror])
|
2014-02-19 06:49:31 +01:00
|
|
|
esac
|
2011-04-10 17:23:11 +02:00
|
|
|
fi
|
2007-11-26 19:18:49 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-13 01:50:40 -05:00
|
|
|
LIBEVENT_GC_SECTIONS=
|
2011-02-22 16:20:42 -05:00
|
|
|
if test "$GCC" = yes && test "$enable_function_sections" = yes ; then
|
2011-02-13 01:50:40 -05:00
|
|
|
AC_CACHE_CHECK(
|
|
|
|
[if linker supports omitting unused code and data],
|
2011-03-23 16:22:57 -04:00
|
|
|
[libevent_cv_gc_sections_runs],
|
2011-02-13 01:50:40 -05:00
|
|
|
[
|
2011-03-23 16:22:57 -04:00
|
|
|
dnl NetBSD will link but likely not run with --gc-sections
|
|
|
|
dnl http://bugs.ntp.org/1844
|
|
|
|
dnl http://gnats.netbsd.org/40401
|
|
|
|
dnl --gc-sections causes attempt to load as linux elf, with
|
|
|
|
dnl wrong syscalls in place. Test a little gauntlet of
|
|
|
|
dnl simple stdio read code checking for errors, expecting
|
|
|
|
dnl enough syscall differences that the NetBSD code will
|
|
|
|
dnl fail even with Linux emulation working as designed.
|
|
|
|
dnl A shorter test could be refined by someone with access
|
|
|
|
dnl to a NetBSD host with Linux emulation working.
|
2011-02-13 01:50:40 -05:00
|
|
|
origCFLAGS="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -Wl,--gc-sections"
|
|
|
|
AC_LINK_IFELSE(
|
2011-03-23 16:22:57 -04:00
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[[
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
]],
|
|
|
|
[[
|
|
|
|
FILE * fpC;
|
|
|
|
char buf[32];
|
|
|
|
size_t cch;
|
|
|
|
int read_success_once;
|
|
|
|
|
|
|
|
fpC = fopen("conftest.c", "r");
|
|
|
|
if (NULL == fpC)
|
|
|
|
exit(1);
|
|
|
|
do {
|
|
|
|
cch = fread(buf, sizeof(buf), 1, fpC);
|
|
|
|
read_success_once |= (0 != cch);
|
|
|
|
} while (0 != cch);
|
|
|
|
if (!read_success_once)
|
|
|
|
exit(2);
|
|
|
|
if (!feof(fpC))
|
|
|
|
exit(3);
|
|
|
|
if (0 != fclose(fpC))
|
|
|
|
exit(4);
|
|
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
]]
|
|
|
|
)],
|
2011-02-13 01:50:40 -05:00
|
|
|
[
|
2011-03-23 16:32:42 -04:00
|
|
|
dnl We have to do this invocation manually so that we can
|
|
|
|
dnl get the output of conftest.err to make sure it doesn't
|
|
|
|
dnl mention gc-sections.
|
2011-03-23 16:22:57 -04:00
|
|
|
if test "X$cross_compiling" = "Xyes" || grep gc-sections conftest.err ; then
|
|
|
|
libevent_cv_gc_sections_runs=no
|
2011-02-13 01:50:40 -05:00
|
|
|
else
|
2011-03-23 16:22:57 -04:00
|
|
|
libevent_cv_gc_sections_runs=no
|
|
|
|
./conftest >/dev/null 2>&1 && libevent_cv_gc_sections_runs=yes
|
2011-02-13 01:50:40 -05:00
|
|
|
fi
|
|
|
|
],
|
2011-03-23 16:22:57 -04:00
|
|
|
[libevent_cv_gc_sections_runs=no]
|
2011-02-13 01:50:40 -05:00
|
|
|
)
|
|
|
|
CFLAGS="$origCFLAGS"
|
|
|
|
AS_UNSET([origCFLAGS])
|
|
|
|
]
|
|
|
|
)
|
2011-03-23 16:22:57 -04:00
|
|
|
case "$libevent_cv_gc_sections_runs" in
|
2011-02-13 01:50:40 -05:00
|
|
|
yes)
|
|
|
|
CFLAGS="-ffunction-sections -fdata-sections $CFLAGS"
|
|
|
|
LIBEVENT_GC_SECTIONS="-Wl,--gc-sections"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
AC_SUBST([LIBEVENT_GC_SECTIONS])
|
|
|
|
|
2011-02-13 02:05:04 -05:00
|
|
|
AM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"])
|
|
|
|
|
2020-06-28 18:30:54 +08:00
|
|
|
dnl Doxygen support
|
2019-08-23 22:31:28 +08:00
|
|
|
DX_HTML_FEATURE(ON)
|
|
|
|
DX_MAN_FEATURE(OFF)
|
|
|
|
DX_RTF_FEATURE(OFF)
|
|
|
|
DX_XML_FEATURE(OFF)
|
|
|
|
DX_PDF_FEATURE(OFF)
|
|
|
|
DX_PS_FEATURE(OFF)
|
|
|
|
DX_CHM_FEATURE(OFF)
|
|
|
|
DX_CHI_FEATURE(OFF)
|
|
|
|
DX_INIT_DOXYGEN([libevent], [${top_srcdir}/Doxyfile], [doxygen])
|
|
|
|
|
|
|
|
AM_CONDITIONAL([ENABLE_DOXYGEN], [test "$DX_FLAG_doc" = "1"])
|
|
|
|
AM_CONDITIONAL([ENABLE_DOXYGEN_MAN], [test "$DX_FLAG_man" = "1"])
|
|
|
|
|
2021-06-15 15:22:20 +08:00
|
|
|
AC_CONFIG_FILES([Makefile libevent.pc libevent_mbedtls.pc libevent_openssl.pc libevent_pthreads.pc libevent_core.pc libevent_extra.pc] )
|
|
|
|
AC_OUTPUT
|