1290001Sglebiusdnl Copyright 2000-2007 Niels Provos 2290001Sglebiusdnl Copyright 2007-2012 Niels Provos and Nick Mathewson 3290001Sglebiusdnl 4290001Sglebiusdnl See LICENSE for copying information. 5290001Sglebiusdnl 6290001Sglebiusdnl Original version Dug Song <dugsong@monkey.org> 7290001Sglebius 8290001SglebiusAC_INIT(libevent,2.1.5-beta) 9290001SglebiusAC_PREREQ(2.59) 10290001SglebiusAC_CONFIG_SRCDIR(event.c) 11290001Sglebius 12290001SglebiusAC_CONFIG_MACRO_DIR([m4]) 13290001SglebiusAC_CONFIG_AUX_DIR([build-aux]) 14290001SglebiusAM_INIT_AUTOMAKE 15290001Sglebiusdnl AM_SILENT_RULES req. automake 1.11. [no] defaults V=1 16290001Sglebiusm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 17290001SglebiusAC_CONFIG_HEADERS(config.h evconfig-private.h:evconfig-private.h.in) 18290001SglebiusAC_DEFINE(NUMERIC_VERSION, 0x02010500, [Numeric representation of the version]) 19290001Sglebius 20290001Sglebiusdnl Initialize prefix. 21290001Sglebiusif test "$prefix" = "NONE"; then 22290001Sglebius prefix="/usr/local" 23290001Sglebiusfi 24290001Sglebius 25290001Sglebiusdnl Try and get a full POSIX environment on obscure systems 26290001Sglebiusifdef([AC_USE_SYSTEM_EXTENSIONS], [ 27290001SglebiusAC_USE_SYSTEM_EXTENSIONS 28290001Sglebius], [ 29290001SglebiusAC_AIX 30290001SglebiusAC_GNU_SOURCE 31290001SglebiusAC_MINIX 32290001Sglebius]) 33290001Sglebius 34290001SglebiusAC_CANONICAL_BUILD 35290001SglebiusAC_CANONICAL_HOST 36290001Sglebiusdnl the 'build' machine is where we run configure and compile 37290001Sglebiusdnl the 'host' machine is where the resulting stuff runs. 38290001Sglebius 39290001Sglebius#case "$host_os" in 40290001Sglebius# 41290001Sglebius# osf5*) 42290001Sglebius# CFLAGS="$CFLAGS -D_OSF_SOURCE" 43290001Sglebius# ;; 44290001Sglebius#esac 45290001Sglebius 46290001Sglebiusdnl Checks for programs. 47290001SglebiusAM_PROG_CC_C_O 48290001SglebiusAC_PROG_INSTALL 49290001SglebiusAC_PROG_LN_S 50290001Sglebius# AC_PROG_MKDIR_P - $(MKDIR_P) should be defined by AM_INIT_AUTOMAKE 51290001Sglebius 52290001Sglebius# AC_PROG_SED is only available in Autoconf >= 2.59b; workaround for older 53290001Sglebius# versions 54290001Sglebiusifdef([AC_PROG_SED], [AC_PROG_SED], [ 55290001SglebiusAC_CHECK_PROGS(SED, [gsed sed]) 56290001Sglebius]) 57290001Sglebius 58290001SglebiusAC_PROG_GCC_TRADITIONAL 59290001Sglebius 60290001Sglebius# We need to test for at least gcc 2.95 here, because older versions don't 61290001Sglebius# have -fno-strict-aliasing 62290001SglebiusAC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ 63290001Sglebius#if !defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95) 64290001Sglebius#error 65290001Sglebius#endif])], have_gcc295=yes, have_gcc295=no) 66290001Sglebius 67290001Sglebiusif test "$GCC" = "yes" ; then 68290001Sglebius # Enable many gcc warnings by default... 69290001Sglebius CFLAGS="$CFLAGS -Wall" 70290001Sglebius # And disable the strict-aliasing optimization, since it breaks 71290001Sglebius # our sockaddr-handling code in strange ways. 72290001Sglebius if test x$have_gcc295 = xyes; then 73290001Sglebius CFLAGS="$CFLAGS -fno-strict-aliasing" 74290001Sglebius fi 75290001Sglebiusfi 76290001Sglebius 77290001Sglebius# OS X Lion started deprecating the system openssl. Let's just disable 78290001Sglebius# all deprecation warnings on OS X. 79290001Sglebiuscase "$host_os" in 80290001Sglebius 81290001Sglebius darwin*) 82290001Sglebius CFLAGS="$CFLAGS -Wno-deprecated-declarations" 83290001Sglebius ;; 84290001Sglebiusesac 85290001Sglebius 86290001SglebiusAC_ARG_ENABLE(gcc-warnings, 87290001Sglebius AS_HELP_STRING(--disable-gcc-warnings, disable verbose warnings with GCC)) 88290001Sglebius 89290001SglebiusAC_ARG_ENABLE(gcc-hardening, 90290001Sglebius AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), 91290001Sglebius[if test x$enableval = xyes; then 92290001Sglebius CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all" 93290001Sglebius CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 94290001Sglebius CFLAGS="$CFLAGS --param ssp-buffer-size=1" 95290001Sglebiusfi]) 96290001Sglebius 97290001SglebiusAC_ARG_ENABLE(thread-support, 98290001Sglebius AS_HELP_STRING(--disable-thread-support, disable support for threading), 99290001Sglebius [], [enable_thread_support=yes]) 100290001SglebiusAC_ARG_ENABLE(malloc-replacement, 101290001Sglebius AS_HELP_STRING(--disable-malloc-replacement, disable support for replacing the memory mgt functions), 102290001Sglebius [], [enable_malloc_replacement=yes]) 103290001SglebiusAC_ARG_ENABLE(openssl, 104290001Sglebius AS_HELP_STRING(--disable-openssl, disable support for openssl encryption), 105290001Sglebius [], [enable_openssl=yes]) 106290001SglebiusAC_ARG_ENABLE(debug-mode, 107290001Sglebius AS_HELP_STRING(--disable-debug-mode, disable support for running in debug mode), 108290001Sglebius [], [enable_debug_mode=yes]) 109290001SglebiusAC_ARG_ENABLE([libevent-install], 110290001Sglebius AS_HELP_STRING([--disable-libevent-install, disable installation of libevent]), 111290001Sglebius [], [enable_libevent_install=yes]) 112290001SglebiusAC_ARG_ENABLE([libevent-regress], 113290001Sglebius AS_HELP_STRING([--disable-libevent-regress, skip regress in make check]), 114290001Sglebius [], [enable_libevent_regress=yes]) 115290001SglebiusAC_ARG_ENABLE([samples], 116290001Sglebius AS_HELP_STRING([--disable-samples, skip building of sample programs]), 117290001Sglebius [], [enable_samples=yes]) 118290001SglebiusAC_ARG_ENABLE([function-sections], 119290001Sglebius AS_HELP_STRING([--enable-function-sections, make static library allow smaller binaries with --gc-sections]), 120290001Sglebius [], [enable_function_sections=no]) 121290001SglebiusAC_ARG_ENABLE([verbose-debug], 122290001Sglebius AS_HELP_STRING([--enable-verbose-debug, verbose debug logging]), 123290001Sglebius [], [enable_verbose_debug=no]) 124290001Sglebius 125290001Sglebius 126290001SglebiusAC_PROG_LIBTOOL 127290001Sglebius 128290001Sglebiusdnl Uncomment "AC_DISABLE_SHARED" to make shared libraries not get 129290001Sglebiusdnl built by default. You can also turn shared libs on and off from 130290001Sglebiusdnl the command line with --enable-shared and --disable-shared. 131290001Sglebiusdnl AC_DISABLE_SHARED 132290001SglebiusAC_SUBST(LIBTOOL_DEPS) 133290001Sglebius 134290001SglebiusAM_CONDITIONAL([BUILD_SAMPLES], [test "$enable_samples" = "yes"]) 135290001SglebiusAM_CONDITIONAL([BUILD_REGRESS], [test "$enable_libevent_regress" = "yes"]) 136290001Sglebius 137290001Sglebiusdnl Checks for libraries. 138290001SglebiusAC_SEARCH_LIBS([inet_ntoa], [nsl]) 139290001SglebiusAC_SEARCH_LIBS([socket], [socket]) 140290001SglebiusAC_SEARCH_LIBS([inet_aton], [resolv]) 141290001SglebiusAC_SEARCH_LIBS([clock_gettime], [rt]) 142290001SglebiusAC_SEARCH_LIBS([sendfile], [sendfile]) 143290001Sglebius 144290001Sglebiusdnl - check if the macro _WIN32 is defined on this compiler. 145290001Sglebiusdnl - (this is how we check for a windows compiler) 146290001SglebiusAC_MSG_CHECKING(for WIN32) 147290001SglebiusAC_TRY_COMPILE(, 148290001Sglebius [ 149290001Sglebius#ifndef _WIN32 150290001Sglebiusdie horribly 151290001Sglebius#endif 152290001Sglebius ], 153290001Sglebius bwin32=true; AC_MSG_RESULT(yes), 154290001Sglebius bwin32=false; AC_MSG_RESULT(no), 155290001Sglebius) 156290001Sglebius 157290001Sglebiusdnl - check if the macro __CYGWIN__ is defined on this compiler. 158290001Sglebiusdnl - (this is how we check for a cygwin version of GCC) 159290001SglebiusAC_MSG_CHECKING(for CYGWIN) 160290001SglebiusAC_TRY_COMPILE(, 161290001Sglebius [ 162290001Sglebius#ifndef __CYGWIN__ 163290001Sglebiusdie horribly 164290001Sglebius#endif 165290001Sglebius ], 166290001Sglebius cygwin=true; AC_MSG_RESULT(yes), 167290001Sglebius cygwin=false; AC_MSG_RESULT(no), 168290001Sglebius) 169290001Sglebius 170290001SglebiusAC_CHECK_HEADERS([zlib.h]) 171290001Sglebius 172290001Sglebiusif test "x$ac_cv_header_zlib_h" = "xyes"; then 173290001Sglebiusdnl Determine if we have zlib for regression tests 174290001Sglebiusdnl Don't put this one in LIBS 175290001Sglebiussave_LIBS="$LIBS" 176290001SglebiusLIBS="" 177290001SglebiusZLIB_LIBS="" 178290001Sglebiushave_zlib=no 179290001SglebiusAC_SEARCH_LIBS([inflateEnd], [z], 180290001Sglebius [have_zlib=yes 181290001Sglebius ZLIB_LIBS="$LIBS" 182290001Sglebius AC_DEFINE(HAVE_LIBZ, 1, [Define if the system has zlib])]) 183290001SglebiusLIBS="$save_LIBS" 184290001SglebiusAC_SUBST(ZLIB_LIBS) 185290001Sglebiusfi 186290001SglebiusAM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"]) 187290001Sglebius 188290001Sglebiusdnl See if we have openssl. This doesn't go in LIBS either. 189290001Sglebiusif test "$bwin32" = true; then 190290001Sglebius EV_LIB_WS32=-lws2_32 191290001Sglebius EV_LIB_GDI=-lgdi32 192290001Sglebiuselse 193290001Sglebius EV_LIB_WS32= 194290001Sglebius EV_LIB_GDI= 195290001Sglebiusfi 196290001SglebiusAC_SUBST(EV_LIB_WS32) 197290001SglebiusAC_SUBST(EV_LIB_GDI) 198290001SglebiusAC_SUBST(OPENSSL_LIBADD) 199290001Sglebius 200290001SglebiusAC_SYS_LARGEFILE 201290001Sglebius 202290001SglebiusLIBEVENT_OPENSSL 203290001Sglebius 204290001Sglebiusdnl Checks for header files. 205290001SglebiusAC_CHECK_HEADERS([ \ 206290001Sglebius arpa/inet.h \ 207290001Sglebius fcntl.h \ 208290001Sglebius ifaddrs.h \ 209290001Sglebius mach/mach_time.h \ 210290001Sglebius netdb.h \ 211290001Sglebius netinet/in.h \ 212290001Sglebius netinet/in6.h \ 213290001Sglebius netinet/tcp.h \ 214290001Sglebius poll.h \ 215290001Sglebius port.h \ 216290001Sglebius stdarg.h \ 217290001Sglebius stddef.h \ 218290001Sglebius sys/devpoll.h \ 219290001Sglebius sys/epoll.h \ 220290001Sglebius sys/event.h \ 221290001Sglebius sys/eventfd.h \ 222290001Sglebius sys/ioctl.h \ 223290001Sglebius sys/mman.h \ 224290001Sglebius sys/param.h \ 225290001Sglebius sys/queue.h \ 226290001Sglebius sys/resource.h \ 227290001Sglebius sys/select.h \ 228290001Sglebius sys/sendfile.h \ 229290001Sglebius sys/socket.h \ 230290001Sglebius sys/stat.h \ 231290001Sglebius sys/time.h \ 232290001Sglebius sys/timerfd.h \ 233290001Sglebius sys/uio.h \ 234290001Sglebius sys/wait.h \ 235290001Sglebius]) 236290001Sglebius 237290001SglebiusAC_CHECK_HEADERS(sys/sysctl.h, [], [], [ 238290001Sglebius#ifdef HAVE_SYS_PARAM_H 239290001Sglebius#include <sys/param.h> 240290001Sglebius#endif 241290001Sglebius]) 242290001Sglebiusif test "x$ac_cv_header_sys_queue_h" = "xyes"; then 243290001Sglebius AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h) 244290001Sglebius AC_EGREP_CPP(yes, 245290001Sglebius[ 246290001Sglebius#include <sys/queue.h> 247290001Sglebius#ifdef TAILQ_FOREACH 248290001Sglebius yes 249290001Sglebius#endif 250290001Sglebius], [AC_MSG_RESULT(yes) 251290001Sglebius AC_DEFINE(HAVE_TAILQFOREACH, 1, 252290001Sglebius [Define if TAILQ_FOREACH is defined in <sys/queue.h>])], 253290001Sglebius AC_MSG_RESULT(no) 254290001Sglebius ) 255290001Sglebiusfi 256290001Sglebius 257290001Sglebiusif test "x$ac_cv_header_sys_time_h" = "xyes"; then 258290001Sglebius AC_MSG_CHECKING(for timeradd in sys/time.h) 259290001Sglebius AC_EGREP_CPP(yes, 260290001Sglebius[ 261290001Sglebius#include <sys/time.h> 262290001Sglebius#ifdef timeradd 263290001Sglebius yes 264290001Sglebius#endif 265290001Sglebius], [ AC_DEFINE(HAVE_TIMERADD, 1, 266290001Sglebius [Define if timeradd is defined in <sys/time.h>]) 267290001Sglebius AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) 268290001Sglebius) 269290001Sglebiusfi 270290001Sglebius 271290001Sglebiusif test "x$ac_cv_header_sys_time_h" = "xyes"; then 272290001Sglebius AC_MSG_CHECKING(for timercmp in sys/time.h) 273290001Sglebius AC_EGREP_CPP(yes, 274290001Sglebius[ 275290001Sglebius#include <sys/time.h> 276290001Sglebius#ifdef timercmp 277290001Sglebius yes 278290001Sglebius#endif 279290001Sglebius], [ AC_DEFINE(HAVE_TIMERCMP, 1, 280290001Sglebius [Define if timercmp is defined in <sys/time.h>]) 281290001Sglebius AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) 282290001Sglebius) 283290001Sglebiusfi 284290001Sglebius 285290001Sglebiusif test "x$ac_cv_header_sys_time_h" = "xyes"; then 286290001Sglebius AC_MSG_CHECKING(for timerclear in sys/time.h) 287290001Sglebius AC_EGREP_CPP(yes, 288290001Sglebius[ 289290001Sglebius#include <sys/time.h> 290290001Sglebius#ifdef timerclear 291290001Sglebius yes 292290001Sglebius#endif 293290001Sglebius], [ AC_DEFINE(HAVE_TIMERCLEAR, 1, 294290001Sglebius [Define if timerclear is defined in <sys/time.h>]) 295290001Sglebius AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) 296290001Sglebius) 297290001Sglebiusfi 298290001Sglebius 299290001Sglebiusif test "x$ac_cv_header_sys_time_h" = "xyes"; then 300290001Sglebius AC_MSG_CHECKING(for timerisset in sys/time.h) 301290001Sglebius AC_EGREP_CPP(yes, 302290001Sglebius[ 303290001Sglebius#include <sys/time.h> 304290001Sglebius#ifdef timerisset 305290001Sglebius yes 306290001Sglebius#endif 307290001Sglebius], [ AC_DEFINE(HAVE_TIMERISSET, 1, 308290001Sglebius [Define if timerisset is defined in <sys/time.h>]) 309290001Sglebius AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) 310290001Sglebius) 311290001Sglebiusfi 312290001Sglebius 313290001Sglebiusif test "x$ac_cv_header_sys_sysctl_h" = "xyes"; then 314290001Sglebius AC_CHECK_DECLS([CTL_KERN, KERN_RANDOM, RANDOM_UUID, KERN_ARND], [], [], 315290001Sglebius [[#include <sys/types.h> 316290001Sglebius #include <sys/sysctl.h>]] 317290001Sglebius ) 318290001Sglebiusfi 319290001Sglebius 320290001SglebiusAM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) 321290001SglebiusAM_CONDITIONAL(BUILD_CYGWIN, test x$cygwin = xtrue) 322290001SglebiusAM_CONDITIONAL(BUILD_WITH_NO_UNDEFINED, test x$bwin32 = xtrue || test x$cygwin = xtrue) 323290001Sglebius 324290001Sglebiusif test x$bwin32 = xtrue; then 325290001Sglebius AC_SEARCH_LIBS([getservbyname],[ws2_32]) 326290001Sglebiusfi 327290001Sglebius 328290001Sglebiusdnl Checks for typedefs, structures, and compiler characteristics. 329290001SglebiusAC_C_CONST 330290001SglebiusAC_C_INLINE 331290001SglebiusAC_HEADER_TIME 332290001Sglebius 333290001Sglebiusdnl Checks for library functions. 334290001SglebiusAC_CHECK_FUNCS([ \ 335290001Sglebius accept4 \ 336290001Sglebius arc4random \ 337290001Sglebius arc4random_buf \ 338290001Sglebius clock_gettime \ 339290001Sglebius eventfd \ 340290001Sglebius epoll_create1 \ 341290001Sglebius fcntl \ 342290001Sglebius getegid \ 343290001Sglebius geteuid \ 344290001Sglebius getifaddrs \ 345290001Sglebius getnameinfo \ 346290001Sglebius getprotobynumber \ 347290001Sglebius gettimeofday \ 348290001Sglebius inet_ntop \ 349290001Sglebius inet_pton \ 350290001Sglebius issetugid \ 351290001Sglebius mach_absolute_time \ 352290001Sglebius mmap \ 353290001Sglebius nanosleep \ 354290001Sglebius pipe \ 355290001Sglebius pipe2 \ 356290001Sglebius putenv \ 357290001Sglebius sendfile \ 358290001Sglebius setenv \ 359290001Sglebius setrlimit \ 360290001Sglebius sigaction \ 361290001Sglebius signal \ 362290001Sglebius splice \ 363290001Sglebius strlcpy \ 364290001Sglebius strsep \ 365290001Sglebius strtok_r \ 366290001Sglebius strtoll \ 367290001Sglebius sysctl \ 368290001Sglebius timerfd_create \ 369290001Sglebius umask \ 370290001Sglebius unsetenv \ 371290001Sglebius usleep \ 372290001Sglebius vasprintf \ 373290001Sglebius]) 374290001SglebiusAM_CONDITIONAL(STRLCPY_IMPL, [test x"$ac_cv_func_strlcpy" = xno]) 375290001Sglebius 376290001SglebiusAC_CACHE_CHECK( 377290001Sglebius [for getaddrinfo], 378290001Sglebius [libevent_cv_getaddrinfo], 379290001Sglebius [AC_LINK_IFELSE( 380290001Sglebius [AC_LANG_PROGRAM( 381290001Sglebius [[ 382290001Sglebius #ifdef HAVE_NETDB_H 383290001Sglebius #include <netdb.h> 384290001Sglebius #endif 385290001Sglebius ]], 386290001Sglebius [[ 387290001Sglebius getaddrinfo; 388290001Sglebius ]] 389290001Sglebius )], 390290001Sglebius [libevent_cv_getaddrinfo=yes], 391290001Sglebius [libevent_cv_getaddrinfo=no] 392290001Sglebius )] 393290001Sglebius) 394290001Sglebiusif test "$libevent_cv_getaddrinfo" = "yes" ; then 395290001Sglebius AC_DEFINE([HAVE_GETADDRINFO], [1], [Do we have getaddrinfo()?]) 396290001Sglebiuselse 397290001Sglebius 398290001SglebiusAC_CHECK_FUNCS([getservbyname]) 399290001Sglebius# Check for gethostbyname_r in all its glorious incompatible versions. 400290001Sglebius# (This is cut-and-pasted from Tor, which based its logic on 401290001Sglebius# Python's configure.in.) 402290001SglebiusAH_TEMPLATE(HAVE_GETHOSTBYNAME_R, 403290001Sglebius [Define this if you have any gethostbyname_r()]) 404290001Sglebius 405290001SglebiusAC_CHECK_FUNC(gethostbyname_r, [ 406290001Sglebius AC_MSG_CHECKING([how many arguments gethostbyname_r() wants]) 407290001Sglebius OLD_CFLAGS=$CFLAGS 408290001Sglebius CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" 409290001Sglebius AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 410290001Sglebius#include <netdb.h> 411290001Sglebius ], [[ 412290001Sglebius char *cp1, *cp2; 413290001Sglebius struct hostent *h1, *h2; 414290001Sglebius int i1, i2; 415290001Sglebius (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2); 416290001Sglebius ]])],[ 417290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R) 418290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, 419290001Sglebius [Define this if gethostbyname_r takes 6 arguments]) 420290001Sglebius AC_MSG_RESULT(6) 421290001Sglebius ], [ 422290001Sglebius AC_TRY_COMPILE([ 423290001Sglebius#include <netdb.h> 424290001Sglebius ], [ 425290001Sglebius char *cp1, *cp2; 426290001Sglebius struct hostent *h1; 427290001Sglebius int i1, i2; 428290001Sglebius (void)gethostbyname_r(cp1,h1,cp2,i1,&i2); 429290001Sglebius ], [ 430290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R) 431290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, 432290001Sglebius [Define this if gethostbyname_r takes 5 arguments]) 433290001Sglebius AC_MSG_RESULT(5) 434290001Sglebius ], [ 435290001Sglebius AC_TRY_COMPILE([ 436290001Sglebius#include <netdb.h> 437290001Sglebius ], [ 438290001Sglebius char *cp1; 439290001Sglebius struct hostent *h1; 440290001Sglebius struct hostent_data hd; 441290001Sglebius (void) gethostbyname_r(cp1,h1,&hd); 442290001Sglebius ], [ 443290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R) 444290001Sglebius AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, 445290001Sglebius [Define this if gethostbyname_r takes 3 arguments]) 446290001Sglebius AC_MSG_RESULT(3) 447290001Sglebius ], [ 448290001Sglebius AC_MSG_RESULT(0) 449290001Sglebius ]) 450290001Sglebius ]) 451290001Sglebius ]) 452290001Sglebius CFLAGS=$OLD_CFLAGS 453290001Sglebius]) 454290001Sglebius 455290001Sglebiusfi 456290001Sglebius 457290001SglebiusAC_MSG_CHECKING(for F_SETFD in fcntl.h) 458290001SglebiusAC_EGREP_CPP(yes, 459290001Sglebius[ 460290001Sglebius#define _GNU_SOURCE 461290001Sglebius#include <fcntl.h> 462290001Sglebius#ifdef F_SETFD 463290001Sglebiusyes 464290001Sglebius#endif 465290001Sglebius], [ AC_DEFINE(HAVE_SETFD, 1, 466290001Sglebius [Define if F_SETFD is defined in <fcntl.h>]) 467290001Sglebius AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no)) 468290001Sglebius 469290001Sglebiusneedsignal=no 470290001Sglebiushaveselect=no 471290001Sglebiusif test x$bwin32 != xtrue; then 472290001Sglebius AC_CHECK_FUNCS(select, [haveselect=yes], ) 473290001Sglebius if test "x$haveselect" = "xyes" ; then 474290001Sglebius needsignal=yes 475290001Sglebius fi 476290001Sglebiusfi 477290001SglebiusAM_CONDITIONAL(SELECT_BACKEND, [test "x$haveselect" = "xyes"]) 478290001Sglebius 479290001Sglebiushavepoll=no 480290001SglebiusAC_CHECK_FUNCS(poll, [havepoll=yes], ) 481290001Sglebiusif test "x$havepoll" = "xyes" ; then 482290001Sglebius needsignal=yes 483290001Sglebiusfi 484290001SglebiusAM_CONDITIONAL(POLL_BACKEND, [test "x$havepoll" = "xyes"]) 485290001Sglebius 486290001Sglebiushavedevpoll=no 487290001Sglebiusif test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then 488290001Sglebius AC_DEFINE(HAVE_DEVPOLL, 1, 489290001Sglebius [Define if /dev/poll is available]) 490290001Sglebiusfi 491290001SglebiusAM_CONDITIONAL(DEVPOLL_BACKEND, [test "x$ac_cv_header_sys_devpoll_h" = "xyes"]) 492290001Sglebius 493290001Sglebiushavekqueue=no 494290001Sglebiusif test "x$ac_cv_header_sys_event_h" = "xyes"; then 495290001Sglebius AC_CHECK_FUNCS(kqueue, [havekqueue=yes], ) 496290001Sglebius if test "x$havekqueue" = "xyes" ; then 497290001Sglebius AC_MSG_CHECKING(for working kqueue) 498290001Sglebius AC_TRY_RUN( 499290001Sglebius#include <sys/types.h> 500290001Sglebius#include <sys/time.h> 501290001Sglebius#include <sys/event.h> 502290001Sglebius#include <stdio.h> 503290001Sglebius#include <unistd.h> 504290001Sglebius#include <fcntl.h> 505290001Sglebius 506290001Sglebiusint 507290001Sglebiusmain(int argc, char **argv) 508290001Sglebius{ 509290001Sglebius int kq; 510290001Sglebius int n; 511290001Sglebius int fd[[2]]; 512290001Sglebius struct kevent ev; 513290001Sglebius struct timespec ts; 514290001Sglebius char buf[[8000]]; 515290001Sglebius 516290001Sglebius if (pipe(fd) == -1) 517290001Sglebius exit(1); 518290001Sglebius if (fcntl(fd[[1]], F_SETFL, O_NONBLOCK) == -1) 519290001Sglebius exit(1); 520290001Sglebius 521290001Sglebius while ((n = write(fd[[1]], buf, sizeof(buf))) == sizeof(buf)) 522290001Sglebius ; 523290001Sglebius 524290001Sglebius if ((kq = kqueue()) == -1) 525290001Sglebius exit(1); 526290001Sglebius 527290001Sglebius memset(&ev, 0, sizeof(ev)); 528290001Sglebius ev.ident = fd[[1]]; 529290001Sglebius ev.filter = EVFILT_WRITE; 530290001Sglebius ev.flags = EV_ADD | EV_ENABLE; 531290001Sglebius n = kevent(kq, &ev, 1, NULL, 0, NULL); 532290001Sglebius if (n == -1) 533290001Sglebius exit(1); 534290001Sglebius 535290001Sglebius read(fd[[0]], buf, sizeof(buf)); 536290001Sglebius 537290001Sglebius ts.tv_sec = 0; 538290001Sglebius ts.tv_nsec = 0; 539290001Sglebius n = kevent(kq, NULL, 0, &ev, 1, &ts); 540290001Sglebius if (n == -1 || n == 0) 541290001Sglebius exit(1); 542290001Sglebius 543290001Sglebius exit(0); 544290001Sglebius}, [AC_MSG_RESULT(yes) 545290001Sglebius AC_DEFINE(HAVE_WORKING_KQUEUE, 1, 546290001Sglebius [Define if kqueue works correctly with pipes]) 547290001Sglebius havekqueue=yes 548290001Sglebius ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) 549290001Sglebius fi 550290001Sglebiusfi 551290001SglebiusAM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"]) 552290001Sglebius 553290001Sglebiushaveepollsyscall=no 554290001Sglebiushaveepoll=no 555290001SglebiusAC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], ) 556290001Sglebiusif test "x$haveepoll" = "xyes" ; then 557290001Sglebius AC_DEFINE(HAVE_EPOLL, 1, 558290001Sglebius [Define if your system supports the epoll system calls]) 559290001Sglebius needsignal=yes 560290001Sglebiusfi 561290001Sglebiusif test "x$ac_cv_header_sys_epoll_h" = "xyes"; then 562290001Sglebius if test "x$haveepoll" = "xno" ; then 563290001Sglebius AC_MSG_CHECKING(for epoll system call) 564290001Sglebius AC_TRY_RUN( 565290001Sglebius#include <stdint.h> 566290001Sglebius#include <sys/param.h> 567290001Sglebius#include <sys/types.h> 568290001Sglebius#include <sys/syscall.h> 569290001Sglebius#include <sys/epoll.h> 570290001Sglebius#include <unistd.h> 571290001Sglebius 572290001Sglebiusint 573290001Sglebiusepoll_create(int size) 574290001Sglebius{ 575290001Sglebius return (syscall(__NR_epoll_create, size)); 576290001Sglebius} 577290001Sglebius 578290001Sglebiusint 579290001Sglebiusmain(int argc, char **argv) 580290001Sglebius{ 581290001Sglebius int epfd; 582290001Sglebius 583290001Sglebius epfd = epoll_create(256); 584290001Sglebius exit (epfd == -1 ? 1 : 0); 585290001Sglebius}, [AC_MSG_RESULT(yes) 586290001Sglebius AC_DEFINE(HAVE_EPOLL, 1, 587290001Sglebius [Define if your system supports the epoll system calls]) 588290001Sglebius needsignal=yes 589290001Sglebius have_epoll=yes 590290001Sglebius AC_LIBOBJ(epoll_sub) 591290001Sglebius ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) 592290001Sglebius fi 593290001Sglebiusfi 594290001SglebiusAM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"]) 595290001Sglebius 596290001Sglebiushaveeventports=no 597290001SglebiusAC_CHECK_FUNCS(port_create, [haveeventports=yes], ) 598290001Sglebiusif test "x$haveeventports" = "xyes" ; then 599290001Sglebius AC_DEFINE(HAVE_EVENT_PORTS, 1, 600290001Sglebius [Define if your system supports event ports]) 601290001Sglebius needsignal=yes 602290001Sglebiusfi 603290001SglebiusAM_CONDITIONAL(EVPORT_BACKEND, [test "x$haveeventports" = "xyes"]) 604290001Sglebius 605290001Sglebiusif test "x$bwin32" = "xtrue"; then 606290001Sglebius needsignal=yes 607290001Sglebiusfi 608290001Sglebius 609290001SglebiusAM_CONDITIONAL(SIGNAL_SUPPORT, [test "x$needsignal" = "xyes"]) 610290001Sglebius 611290001SglebiusAC_TYPE_PID_T 612290001SglebiusAC_TYPE_SIZE_T 613290001SglebiusAC_TYPE_SSIZE_T 614290001Sglebius 615290001SglebiusAC_CHECK_TYPES([uint64_t, uint32_t, uint16_t, uint8_t, uintptr_t], , , 616290001Sglebius[#ifdef HAVE_STDINT_H 617290001Sglebius#include <stdint.h> 618290001Sglebius#elif defined(HAVE_INTTYPES_H) 619290001Sglebius#include <inttypes.h> 620290001Sglebius#endif 621290001Sglebius#ifdef HAVE_SYS_TYPES_H 622290001Sglebius#include <sys/types.h> 623290001Sglebius#endif]) 624290001Sglebius 625290001SglebiusAC_CHECK_TYPES([fd_mask], , , 626290001Sglebius[#ifdef HAVE_SYS_TYPES_H 627290001Sglebius#include <sys/types.h> 628290001Sglebius#endif 629290001Sglebius#ifdef HAVE_SYS_SELECT_H 630290001Sglebius#include <sys/select.h> 631290001Sglebius#endif]) 632290001Sglebius 633290001SglebiusAC_CHECK_SIZEOF(long long) 634290001SglebiusAC_CHECK_SIZEOF(long) 635290001SglebiusAC_CHECK_SIZEOF(int) 636290001SglebiusAC_CHECK_SIZEOF(short) 637290001SglebiusAC_CHECK_SIZEOF(size_t) 638290001SglebiusAC_CHECK_SIZEOF(void *) 639290001SglebiusAC_CHECK_SIZEOF(off_t) 640290001Sglebius 641290001SglebiusAC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrinfo, struct sockaddr_storage], , , 642290001Sglebius[#define _GNU_SOURCE 643290001Sglebius#include <sys/types.h> 644290001Sglebius#ifdef HAVE_NETINET_IN_H 645290001Sglebius#include <netinet/in.h> 646290001Sglebius#endif 647290001Sglebius#ifdef HAVE_NETINET_IN6_H 648290001Sglebius#include <netinet/in6.h> 649290001Sglebius#endif 650290001Sglebius#ifdef HAVE_SYS_SOCKET_H 651290001Sglebius#include <sys/socket.h> 652290001Sglebius#endif 653290001Sglebius#ifdef HAVE_NETDB_H 654290001Sglebius#include <netdb.h> 655290001Sglebius#endif 656290001Sglebius#ifdef _WIN32 657290001Sglebius#define WIN32_WINNT 0x400 658290001Sglebius#define _WIN32_WINNT 0x400 659290001Sglebius#define WIN32_LEAN_AND_MEAN 660290001Sglebius#if defined(_MSC_VER) && (_MSC_VER < 1300) 661290001Sglebius#include <winsock.h> 662290001Sglebius#else 663290001Sglebius#include <winsock2.h> 664290001Sglebius#include <ws2tcpip.h> 665290001Sglebius#endif 666290001Sglebius#endif 667290001Sglebius]) 668290001SglebiusAC_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], , , 669290001Sglebius[#include <sys/types.h> 670290001Sglebius#ifdef HAVE_NETINET_IN_H 671290001Sglebius#include <netinet/in.h> 672290001Sglebius#endif 673290001Sglebius#ifdef HAVE_NETINET_IN6_H 674290001Sglebius#include <netinet/in6.h> 675290001Sglebius#endif 676290001Sglebius#ifdef HAVE_SYS_SOCKET_H 677290001Sglebius#include <sys/socket.h> 678290001Sglebius#endif 679290001Sglebius#ifdef _WIN32 680290001Sglebius#define WIN32_WINNT 0x400 681290001Sglebius#define _WIN32_WINNT 0x400 682290001Sglebius#define WIN32_LEAN_AND_MEAN 683290001Sglebius#if defined(_MSC_VER) && (_MSC_VER < 1300) 684290001Sglebius#include <winsock.h> 685290001Sglebius#else 686290001Sglebius#include <winsock2.h> 687290001Sglebius#include <ws2tcpip.h> 688290001Sglebius#endif 689290001Sglebius#endif 690290001Sglebius]) 691290001Sglebius 692290001SglebiusAC_CHECK_TYPES([struct so_linger], 693290001Sglebius[#define HAVE_SO_LINGER], , 694290001Sglebius[ 695290001Sglebius#ifdef HAVE_SYS_SOCKET_H 696290001Sglebius#include <sys/socket.h> 697290001Sglebius#endif 698290001Sglebius]) 699290001Sglebius 700290001SglebiusAC_MSG_CHECKING([for socklen_t]) 701290001SglebiusAC_TRY_COMPILE([ 702290001Sglebius #include <sys/types.h> 703290001Sglebius #include <sys/socket.h>], 704290001Sglebius [socklen_t x;], 705290001Sglebius AC_MSG_RESULT([yes]), 706290001Sglebius [AC_MSG_RESULT([no]) 707290001Sglebius AC_DEFINE(socklen_t, unsigned int, 708290001Sglebius [Define to unsigned int if you dont have it])] 709290001Sglebius) 710290001Sglebius 711290001SglebiusAC_MSG_CHECKING([whether our compiler supports __func__]) 712290001SglebiusAC_TRY_COMPILE([], 713290001Sglebius [ const char *cp = __func__; ], 714290001Sglebius AC_MSG_RESULT([yes]), 715290001Sglebius AC_MSG_RESULT([no]) 716290001Sglebius AC_MSG_CHECKING([whether our compiler supports __FUNCTION__]) 717290001Sglebius AC_TRY_COMPILE([], 718290001Sglebius [ const char *cp = __FUNCTION__; ], 719290001Sglebius AC_MSG_RESULT([yes]) 720290001Sglebius AC_DEFINE(__func__, __FUNCTION__, 721290001Sglebius [Define to appropriate substitue if compiler doesnt have __func__]), 722290001Sglebius AC_MSG_RESULT([no]) 723290001Sglebius AC_DEFINE(__func__, __FILE__, 724290001Sglebius [Define to appropriate substitue if compiler doesnt have __func__]))) 725290001Sglebius 726290001Sglebius 727290001Sglebius# check if we can compile with pthreads 728290001Sglebiushave_pthreads=no 729290001Sglebiusif test x$bwin32 != xtrue && test "$enable_thread_support" != "no"; then 730290001Sglebius ACX_PTHREAD([ 731290001Sglebius AC_DEFINE(HAVE_PTHREADS, 1, 732290001Sglebius [Define if we have pthreads on this system]) 733290001Sglebius have_pthreads=yes]) 734290001Sglebius CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 735290001Sglebius AC_CHECK_SIZEOF(pthread_t, , 736290001Sglebius [AC_INCLUDES_DEFAULT() 737290001Sglebius #include <pthread.h> ] 738290001Sglebius ) 739290001Sglebiusfi 740290001SglebiusAM_CONDITIONAL([PTHREADS], [test "$have_pthreads" != "no" && test "$enable_thread_support" != "no"]) 741290001Sglebius 742290001Sglebius# check if we should compile locking into the library 743290001Sglebiusif test x$enable_thread_support = xno; then 744290001Sglebius AC_DEFINE(DISABLE_THREAD_SUPPORT, 1, 745290001Sglebius [Define if libevent should not be compiled with thread support]) 746290001Sglebiusfi 747290001Sglebius 748290001Sglebius# check if we should hard-code the mm functions. 749290001Sglebiusif test x$enable_malloc_replacement = xno; then 750290001Sglebius AC_DEFINE(DISABLE_MM_REPLACEMENT, 1, 751290001Sglebius [Define if libevent should not allow replacing the mm functions]) 752290001Sglebiusfi 753290001Sglebius 754290001Sglebius# check if we should hard-code debugging out 755290001Sglebiusif test x$enable_debug_mode = xno; then 756290001Sglebius AC_DEFINE(DISABLE_DEBUG_MODE, 1, 757290001Sglebius [Define if libevent should build without support for a debug mode]) 758290001Sglebiusfi 759290001Sglebius 760290001Sglebius# check if we should enable verbose debugging 761290001Sglebiusif test x$enable_verbose_debug = xyes; then 762290001Sglebius CFLAGS="$CFLAGS -DUSE_DEBUG" 763290001Sglebiusfi 764290001Sglebius 765290001Sglebius# check if we have and should use openssl 766290001SglebiusAM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"]) 767290001Sglebius 768290001Sglebius# Add some more warnings which we use in development but not in the 769290001Sglebius# released versions. (Some relevant gcc versions can't handle these.) 770290001Sglebiusif test x$enable_gcc_warnings != xno && test "$GCC" = "yes"; then 771290001Sglebius 772290001Sglebius AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ 773290001Sglebius#if !defined(__GNUC__) || (__GNUC__ < 4) 774290001Sglebius#error 775290001Sglebius#endif])], have_gcc4=yes, have_gcc4=no) 776290001Sglebius 777290001Sglebius AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ 778290001Sglebius#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) 779290001Sglebius#error 780290001Sglebius#endif])], have_gcc42=yes, have_gcc42=no) 781290001Sglebius 782290001Sglebius AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ 783290001Sglebius#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) 784290001Sglebius#error 785290001Sglebius#endif])], have_gcc45=yes, have_gcc45=no) 786290001Sglebius 787290001Sglebius AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ 788290001Sglebius#if !defined(__clang__) 789290001Sglebius#error 790290001Sglebius#endif])], have_clang=yes, have_clang=no) 791290001Sglebius 792290001Sglebius CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum" 793290001Sglebius if test x$enable_gcc_warnings = xyes; then 794290001Sglebius CFLAGS="$CFLAGS -Werror" 795290001Sglebius fi 796290001Sglebius 797290001Sglebius CFLAGS="$CFLAGS -Wno-unused-parameter -Wstrict-aliasing" 798290001Sglebius 799290001Sglebius if test x$have_gcc4 = xyes ; then 800290001Sglebius # These warnings break gcc 3.3.5 and work on gcc 4.0.2 801290001Sglebius CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement" 802290001Sglebius #CFLAGS="$CFLAGS -Wold-style-definition" 803290001Sglebius fi 804290001Sglebius 805290001Sglebius if test x$have_gcc42 = xyes ; then 806290001Sglebius # These warnings break gcc 4.0.2 and work on gcc 4.2 807290001Sglebius CFLAGS="$CFLAGS -Waddress" 808290001Sglebius fi 809290001Sglebius 810290001Sglebius if test x$have_gcc42 = xyes && test x$have_clang = xno; then 811290001Sglebius # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2 812290001Sglebius CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init" 813290001Sglebius fi 814290001Sglebius 815290001Sglebius if test x$have_gcc45 = xyes ; then 816290001Sglebius # These warnings work on gcc 4.5 817290001Sglebius CFLAGS="$CFLAGS -Wlogical-op" 818290001Sglebius fi 819290001Sglebius 820290001Sglebius if test x$have_clang = xyes; then 821290001Sglebius # Disable the unused-function warnings, because these trigger 822290001Sglebius # for minheap-internal.h related code. 823290001Sglebius CFLAGS="$CFLAGS -Wno-unused-function" 824290001Sglebius 825290001Sglebius # clang on macosx emits warnigns for each directory specified which 826290001Sglebius # isn't "used" generating a lot of build noise (typically 3 warnings 827290001Sglebius # per file 828290001Sglebius case "$host_os" in 829290001Sglebius darwin*) 830290001Sglebius CFLAGS="$CFLAGS -Qunused-arguments" 831290001Sglebius ;; 832290001Sglebius esac 833290001Sglebius fi 834290001Sglebius 835290001Sglebius##This will break the world on some 64-bit architectures 836290001Sglebius# CFLAGS="$CFLAGS -Winline" 837290001Sglebius 838290001Sglebiusfi 839290001Sglebius 840290001SglebiusLIBEVENT_GC_SECTIONS= 841290001Sglebiusif test "$GCC" = yes && test "$enable_function_sections" = yes ; then 842290001Sglebius AC_CACHE_CHECK( 843290001Sglebius [if linker supports omitting unused code and data], 844290001Sglebius [libevent_cv_gc_sections_runs], 845290001Sglebius [ 846290001Sglebius dnl NetBSD will link but likely not run with --gc-sections 847290001Sglebius dnl http://bugs.ntp.org/1844 848290001Sglebius dnl http://gnats.netbsd.org/40401 849290001Sglebius dnl --gc-sections causes attempt to load as linux elf, with 850290001Sglebius dnl wrong syscalls in place. Test a little gauntlet of 851290001Sglebius dnl simple stdio read code checking for errors, expecting 852290001Sglebius dnl enough syscall differences that the NetBSD code will 853290001Sglebius dnl fail even with Linux emulation working as designed. 854290001Sglebius dnl A shorter test could be refined by someone with access 855290001Sglebius dnl to a NetBSD host with Linux emulation working. 856290001Sglebius origCFLAGS="$CFLAGS" 857290001Sglebius CFLAGS="$CFLAGS -Wl,--gc-sections" 858290001Sglebius AC_LINK_IFELSE( 859290001Sglebius [AC_LANG_PROGRAM( 860290001Sglebius [[ 861290001Sglebius #include <stdlib.h> 862290001Sglebius #include <stdio.h> 863290001Sglebius ]], 864290001Sglebius [[ 865290001Sglebius FILE * fpC; 866290001Sglebius char buf[32]; 867290001Sglebius size_t cch; 868290001Sglebius int read_success_once; 869290001Sglebius 870290001Sglebius fpC = fopen("conftest.c", "r"); 871290001Sglebius if (NULL == fpC) 872290001Sglebius exit(1); 873290001Sglebius do { 874290001Sglebius cch = fread(buf, sizeof(buf), 1, fpC); 875290001Sglebius read_success_once |= (0 != cch); 876290001Sglebius } while (0 != cch); 877290001Sglebius if (!read_success_once) 878290001Sglebius exit(2); 879290001Sglebius if (!feof(fpC)) 880290001Sglebius exit(3); 881290001Sglebius if (0 != fclose(fpC)) 882290001Sglebius exit(4); 883290001Sglebius 884290001Sglebius exit(EXIT_SUCCESS); 885290001Sglebius ]] 886290001Sglebius )], 887290001Sglebius [ 888290001Sglebius dnl We have to do this invocation manually so that we can 889290001Sglebius dnl get the output of conftest.err to make sure it doesn't 890290001Sglebius dnl mention gc-sections. 891290001Sglebius if test "X$cross_compiling" = "Xyes" || grep gc-sections conftest.err ; then 892290001Sglebius libevent_cv_gc_sections_runs=no 893290001Sglebius else 894290001Sglebius libevent_cv_gc_sections_runs=no 895290001Sglebius ./conftest >/dev/null 2>&1 && libevent_cv_gc_sections_runs=yes 896290001Sglebius fi 897290001Sglebius ], 898290001Sglebius [libevent_cv_gc_sections_runs=no] 899290001Sglebius ) 900290001Sglebius CFLAGS="$origCFLAGS" 901290001Sglebius AS_UNSET([origCFLAGS]) 902290001Sglebius ] 903290001Sglebius ) 904290001Sglebius case "$libevent_cv_gc_sections_runs" in 905290001Sglebius yes) 906290001Sglebius CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" 907290001Sglebius LIBEVENT_GC_SECTIONS="-Wl,--gc-sections" 908290001Sglebius ;; 909290001Sglebius esac 910290001Sglebiusfi 911290001SglebiusAC_SUBST([LIBEVENT_GC_SECTIONS]) 912290001Sglebius 913290001SglebiusAM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"]) 914290001Sglebius 915290001SglebiusAC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] ) 916290001SglebiusAC_OUTPUT(Makefile) 917