Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | dnl configure.in for libevent |
michael@0 | 2 | dnl Copyright 2000-2007 Niels Provos |
michael@0 | 3 | dnl Copyright 2007-2012 Niels Provos and Nick Mathewson |
michael@0 | 4 | dnl |
michael@0 | 5 | dnl See LICENSE for copying information. |
michael@0 | 6 | dnl |
michael@0 | 7 | dnl Original version Dug Song <dugsong@monkey.org> |
michael@0 | 8 | |
michael@0 | 9 | AC_PREREQ(2.59c) |
michael@0 | 10 | AC_INIT(event.c) |
michael@0 | 11 | |
michael@0 | 12 | AC_CONFIG_MACRO_DIR([m4]) |
michael@0 | 13 | |
michael@0 | 14 | AM_INIT_AUTOMAKE(libevent,2.0.21-stable) |
michael@0 | 15 | AM_CONFIG_HEADER(config.h) |
michael@0 | 16 | AC_DEFINE(NUMERIC_VERSION, 0x02001500, [Numeric representation of the version]) |
michael@0 | 17 | |
michael@0 | 18 | dnl Initialize prefix. |
michael@0 | 19 | if test "$prefix" = "NONE"; then |
michael@0 | 20 | prefix="/usr/local" |
michael@0 | 21 | fi |
michael@0 | 22 | |
michael@0 | 23 | AC_CANONICAL_BUILD |
michael@0 | 24 | AC_CANONICAL_HOST |
michael@0 | 25 | dnl the 'build' machine is where we run configure and compile |
michael@0 | 26 | dnl the 'host' machine is where the resulting stuff runs. |
michael@0 | 27 | |
michael@0 | 28 | case "$host_os" in |
michael@0 | 29 | |
michael@0 | 30 | osf5*) |
michael@0 | 31 | CFLAGS="$CFLAGS -D_OSF_SOURCE" |
michael@0 | 32 | ;; |
michael@0 | 33 | esac |
michael@0 | 34 | |
michael@0 | 35 | dnl Checks for programs. |
michael@0 | 36 | AC_PROG_CC |
michael@0 | 37 | AM_PROG_CC_C_O |
michael@0 | 38 | AC_PROG_SED |
michael@0 | 39 | AC_PROG_INSTALL |
michael@0 | 40 | AC_PROG_LN_S |
michael@0 | 41 | AC_PROG_MKDIR_P |
michael@0 | 42 | |
michael@0 | 43 | AC_PROG_GCC_TRADITIONAL |
michael@0 | 44 | |
michael@0 | 45 | # We need to test for at least gcc 2.95 here, because older versions don't |
michael@0 | 46 | # have -fno-strict-aliasing |
michael@0 | 47 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ |
michael@0 | 48 | #if !defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95) |
michael@0 | 49 | #error |
michael@0 | 50 | #endif])], have_gcc295=yes, have_gcc295=no) |
michael@0 | 51 | |
michael@0 | 52 | if test "$GCC" = "yes" ; then |
michael@0 | 53 | # Enable many gcc warnings by default... |
michael@0 | 54 | CFLAGS="$CFLAGS -Wall" |
michael@0 | 55 | # And disable the strict-aliasing optimization, since it breaks |
michael@0 | 56 | # our sockaddr-handling code in strange ways. |
michael@0 | 57 | if test x$have_gcc295 = xyes; then |
michael@0 | 58 | CFLAGS="$CFLAGS -fno-strict-aliasing" |
michael@0 | 59 | fi |
michael@0 | 60 | fi |
michael@0 | 61 | |
michael@0 | 62 | # OS X Lion started deprecating the system openssl. Let's just disable |
michael@0 | 63 | # all deprecation warnings on OS X. |
michael@0 | 64 | case "$host_os" in |
michael@0 | 65 | |
michael@0 | 66 | darwin*) |
michael@0 | 67 | CFLAGS="$CFLAGS -Wno-deprecated-declarations" |
michael@0 | 68 | ;; |
michael@0 | 69 | esac |
michael@0 | 70 | |
michael@0 | 71 | AC_ARG_ENABLE(gcc-warnings, |
michael@0 | 72 | AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC)) |
michael@0 | 73 | AC_ARG_ENABLE(thread-support, |
michael@0 | 74 | AS_HELP_STRING(--disable-thread-support, disable support for threading), |
michael@0 | 75 | [], [enable_thread_support=yes]) |
michael@0 | 76 | AC_ARG_ENABLE(malloc-replacement, |
michael@0 | 77 | AS_HELP_STRING(--disable-malloc-replacement, disable support for replacing the memory mgt functions), |
michael@0 | 78 | [], [enable_malloc_replacement=yes]) |
michael@0 | 79 | AC_ARG_ENABLE(openssl, |
michael@0 | 80 | AS_HELP_STRING(--disable-openssl, disable support for openssl encryption), |
michael@0 | 81 | [], [enable_openssl=yes]) |
michael@0 | 82 | AC_ARG_ENABLE(debug-mode, |
michael@0 | 83 | AS_HELP_STRING(--disable-debug-mode, disable support for running in debug mode), |
michael@0 | 84 | [], [enable_debug_mode=yes]) |
michael@0 | 85 | AC_ARG_ENABLE([libevent-install], |
michael@0 | 86 | AS_HELP_STRING([--disable-libevent-install, disable installation of libevent]), |
michael@0 | 87 | [], [enable_libevent_install=yes]) |
michael@0 | 88 | AC_ARG_ENABLE([libevent-regress], |
michael@0 | 89 | AS_HELP_STRING([--disable-libevent-regress, skip regress in make check]), |
michael@0 | 90 | [], [enable_libevent_regress=yes]) |
michael@0 | 91 | AC_ARG_ENABLE([function-sections], |
michael@0 | 92 | AS_HELP_STRING([--enable-function-sections, make static library allow smaller binaries with --gc-sections]), |
michael@0 | 93 | [], [enable_function_sections=no]) |
michael@0 | 94 | |
michael@0 | 95 | |
michael@0 | 96 | AC_PROG_LIBTOOL |
michael@0 | 97 | |
michael@0 | 98 | dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get |
michael@0 | 99 | dnl built by default. You can also turn shared libs on and off from |
michael@0 | 100 | dnl the command line with --enable-shared and --disable-shared. |
michael@0 | 101 | dnl AC_DISABLE_SHARED |
michael@0 | 102 | AC_SUBST(LIBTOOL_DEPS) |
michael@0 | 103 | |
michael@0 | 104 | AM_CONDITIONAL([BUILD_REGRESS], [test "$enable_libevent_regress" = "yes"]) |
michael@0 | 105 | |
michael@0 | 106 | dnl Checks for libraries. |
michael@0 | 107 | AC_SEARCH_LIBS([inet_ntoa], [nsl]) |
michael@0 | 108 | AC_SEARCH_LIBS([socket], [socket]) |
michael@0 | 109 | AC_SEARCH_LIBS([inet_aton], [resolv]) |
michael@0 | 110 | AC_SEARCH_LIBS([clock_gettime], [rt]) |
michael@0 | 111 | AC_SEARCH_LIBS([sendfile], [sendfile]) |
michael@0 | 112 | |
michael@0 | 113 | dnl - check if the macro WIN32 is defined on this compiler. |
michael@0 | 114 | dnl - (this is how we check for a windows version of GCC) |
michael@0 | 115 | AC_MSG_CHECKING(for WIN32) |
michael@0 | 116 | AC_TRY_COMPILE(, |
michael@0 | 117 | [ |
michael@0 | 118 | #ifndef WIN32 |
michael@0 | 119 | die horribly |
michael@0 | 120 | #endif |
michael@0 | 121 | ], |
michael@0 | 122 | bwin32=true; AC_MSG_RESULT(yes), |
michael@0 | 123 | bwin32=false; AC_MSG_RESULT(no), |
michael@0 | 124 | ) |
michael@0 | 125 | |
michael@0 | 126 | dnl - check if the macro __CYGWIN__ is defined on this compiler. |
michael@0 | 127 | dnl - (this is how we check for a cygwin version of GCC) |
michael@0 | 128 | AC_MSG_CHECKING(for CYGWIN) |
michael@0 | 129 | AC_TRY_COMPILE(, |
michael@0 | 130 | [ |
michael@0 | 131 | #ifndef __CYGWIN__ |
michael@0 | 132 | die horribly |
michael@0 | 133 | #endif |
michael@0 | 134 | ], |
michael@0 | 135 | cygwin=true; AC_MSG_RESULT(yes), |
michael@0 | 136 | cygwin=false; AC_MSG_RESULT(no), |
michael@0 | 137 | ) |
michael@0 | 138 | |
michael@0 | 139 | AC_CHECK_HEADERS([zlib.h]) |
michael@0 | 140 | |
michael@0 | 141 | if test "x$ac_cv_header_zlib_h" = "xyes"; then |
michael@0 | 142 | dnl Determine if we have zlib for regression tests |
michael@0 | 143 | dnl Don't put this one in LIBS |
michael@0 | 144 | save_LIBS="$LIBS" |
michael@0 | 145 | LIBS="" |
michael@0 | 146 | ZLIB_LIBS="" |
michael@0 | 147 | have_zlib=no |
michael@0 | 148 | AC_SEARCH_LIBS([inflateEnd], [z], |
michael@0 | 149 | [have_zlib=yes |
michael@0 | 150 | ZLIB_LIBS="$LIBS" |
michael@0 | 151 | AC_DEFINE(HAVE_LIBZ, 1, [Define if the system has zlib])]) |
michael@0 | 152 | LIBS="$save_LIBS" |
michael@0 | 153 | AC_SUBST(ZLIB_LIBS) |
michael@0 | 154 | fi |
michael@0 | 155 | AM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"]) |
michael@0 | 156 | |
michael@0 | 157 | dnl See if we have openssl. This doesn't go in LIBS either. |
michael@0 | 158 | if test "$bwin32" = true; then |
michael@0 | 159 | EV_LIB_WS32=-lws2_32 |
michael@0 | 160 | EV_LIB_GDI=-lgdi32 |
michael@0 | 161 | else |
michael@0 | 162 | EV_LIB_WS32= |
michael@0 | 163 | EV_LIB_GDI= |
michael@0 | 164 | fi |
michael@0 | 165 | AC_SUBST(EV_LIB_WS32) |
michael@0 | 166 | AC_SUBST(EV_LIB_GDI) |
michael@0 | 167 | AC_SUBST(OPENSSL_LIBADD) |
michael@0 | 168 | |
michael@0 | 169 | AC_CHECK_HEADERS([openssl/bio.h]) |
michael@0 | 170 | |
michael@0 | 171 | if test "$enable_openssl" = "yes"; then |
michael@0 | 172 | save_LIBS="$LIBS" |
michael@0 | 173 | LIBS="" |
michael@0 | 174 | OPENSSL_LIBS="" |
michael@0 | 175 | have_openssl=no |
michael@0 | 176 | AC_SEARCH_LIBS([SSL_new], [ssl], |
michael@0 | 177 | [have_openssl=yes |
michael@0 | 178 | OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD" |
michael@0 | 179 | AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])], |
michael@0 | 180 | [have_openssl=no], |
michael@0 | 181 | [-lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD]) |
michael@0 | 182 | LIBS="$save_LIBS" |
michael@0 | 183 | AC_SUBST(OPENSSL_LIBS) |
michael@0 | 184 | fi |
michael@0 | 185 | |
michael@0 | 186 | dnl Checks for header files. |
michael@0 | 187 | AC_HEADER_STDC |
michael@0 | 188 | 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 sys/wait.h netdb.h]) |
michael@0 | 189 | AC_CHECK_HEADERS([sys/stat.h]) |
michael@0 | 190 | AC_CHECK_HEADERS(sys/sysctl.h, [], [], [ |
michael@0 | 191 | #ifdef HAVE_SYS_PARAM_H |
michael@0 | 192 | #include <sys/param.h> |
michael@0 | 193 | #endif |
michael@0 | 194 | ]) |
michael@0 | 195 | if test "x$ac_cv_header_sys_queue_h" = "xyes"; then |
michael@0 | 196 | AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h) |
michael@0 | 197 | AC_EGREP_CPP(yes, |
michael@0 | 198 | [ |
michael@0 | 199 | #include <sys/queue.h> |
michael@0 | 200 | #ifdef TAILQ_FOREACH |
michael@0 | 201 | yes |
michael@0 | 202 | #endif |
michael@0 | 203 | ], [AC_MSG_RESULT(yes) |
michael@0 | 204 | AC_DEFINE(HAVE_TAILQFOREACH, 1, |
michael@0 | 205 | [Define if TAILQ_FOREACH is defined in <sys/queue.h>])], |
michael@0 | 206 | AC_MSG_RESULT(no) |
michael@0 | 207 | ) |
michael@0 | 208 | fi |
michael@0 | 209 | |
michael@0 | 210 | if test "x$ac_cv_header_sys_time_h" = "xyes"; then |
michael@0 | 211 | AC_MSG_CHECKING(for timeradd in sys/time.h) |
michael@0 | 212 | AC_EGREP_CPP(yes, |
michael@0 | 213 | [ |
michael@0 | 214 | #include <sys/time.h> |
michael@0 | 215 | #ifdef timeradd |
michael@0 | 216 | yes |
michael@0 | 217 | #endif |
michael@0 | 218 | ], [ AC_DEFINE(HAVE_TIMERADD, 1, |
michael@0 | 219 | [Define if timeradd is defined in <sys/time.h>]) |
michael@0 | 220 | AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) |
michael@0 | 221 | ) |
michael@0 | 222 | fi |
michael@0 | 223 | |
michael@0 | 224 | if test "x$ac_cv_header_sys_time_h" = "xyes"; then |
michael@0 | 225 | AC_MSG_CHECKING(for timercmp in sys/time.h) |
michael@0 | 226 | AC_EGREP_CPP(yes, |
michael@0 | 227 | [ |
michael@0 | 228 | #include <sys/time.h> |
michael@0 | 229 | #ifdef timercmp |
michael@0 | 230 | yes |
michael@0 | 231 | #endif |
michael@0 | 232 | ], [ AC_DEFINE(HAVE_TIMERCMP, 1, |
michael@0 | 233 | [Define if timercmp is defined in <sys/time.h>]) |
michael@0 | 234 | AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) |
michael@0 | 235 | ) |
michael@0 | 236 | fi |
michael@0 | 237 | |
michael@0 | 238 | if test "x$ac_cv_header_sys_time_h" = "xyes"; then |
michael@0 | 239 | AC_MSG_CHECKING(for timerclear in sys/time.h) |
michael@0 | 240 | AC_EGREP_CPP(yes, |
michael@0 | 241 | [ |
michael@0 | 242 | #include <sys/time.h> |
michael@0 | 243 | #ifdef timerclear |
michael@0 | 244 | yes |
michael@0 | 245 | #endif |
michael@0 | 246 | ], [ AC_DEFINE(HAVE_TIMERCLEAR, 1, |
michael@0 | 247 | [Define if timerclear is defined in <sys/time.h>]) |
michael@0 | 248 | AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) |
michael@0 | 249 | ) |
michael@0 | 250 | fi |
michael@0 | 251 | |
michael@0 | 252 | if test "x$ac_cv_header_sys_time_h" = "xyes"; then |
michael@0 | 253 | AC_MSG_CHECKING(for timerisset in sys/time.h) |
michael@0 | 254 | AC_EGREP_CPP(yes, |
michael@0 | 255 | [ |
michael@0 | 256 | #include <sys/time.h> |
michael@0 | 257 | #ifdef timerisset |
michael@0 | 258 | yes |
michael@0 | 259 | #endif |
michael@0 | 260 | ], [ AC_DEFINE(HAVE_TIMERISSET, 1, |
michael@0 | 261 | [Define if timerisset is defined in <sys/time.h>]) |
michael@0 | 262 | AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) |
michael@0 | 263 | ) |
michael@0 | 264 | fi |
michael@0 | 265 | |
michael@0 | 266 | if test "x$ac_cv_header_sys_sysctl_h" = "xyes"; then |
michael@0 | 267 | AC_CHECK_DECLS([CTL_KERN, KERN_RANDOM, RANDOM_UUID, KERN_ARND], [], [], |
michael@0 | 268 | [[#include <sys/types.h> |
michael@0 | 269 | #include <sys/sysctl.h>]] |
michael@0 | 270 | ) |
michael@0 | 271 | fi |
michael@0 | 272 | |
michael@0 | 273 | AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue) |
michael@0 | 274 | AM_CONDITIONAL(BUILD_CYGWIN, test x$cygwin = xtrue) |
michael@0 | 275 | AM_CONDITIONAL(BUILD_WITH_NO_UNDEFINED, test x$bwin32 = xtrue || test x$cygwin = xtrue) |
michael@0 | 276 | |
michael@0 | 277 | if test x$bwin32 = xtrue; then |
michael@0 | 278 | AC_SEARCH_LIBS([getservbyname],[ws2_32]) |
michael@0 | 279 | fi |
michael@0 | 280 | |
michael@0 | 281 | dnl Checks for typedefs, structures, and compiler characteristics. |
michael@0 | 282 | AC_C_CONST |
michael@0 | 283 | AC_C_INLINE |
michael@0 | 284 | AC_HEADER_TIME |
michael@0 | 285 | |
michael@0 | 286 | dnl Checks for library functions. |
michael@0 | 287 | AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep]) |
michael@0 | 288 | AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl]) |
michael@0 | 289 | AC_CHECK_FUNCS([umask]) |
michael@0 | 290 | |
michael@0 | 291 | AC_CACHE_CHECK( |
michael@0 | 292 | [for getaddrinfo], |
michael@0 | 293 | [libevent_cv_getaddrinfo], |
michael@0 | 294 | [AC_LINK_IFELSE( |
michael@0 | 295 | [AC_LANG_PROGRAM( |
michael@0 | 296 | [[ |
michael@0 | 297 | #ifdef HAVE_NETDB_H |
michael@0 | 298 | #include <netdb.h> |
michael@0 | 299 | #endif |
michael@0 | 300 | ]], |
michael@0 | 301 | [[ |
michael@0 | 302 | getaddrinfo; |
michael@0 | 303 | ]] |
michael@0 | 304 | )], |
michael@0 | 305 | [libevent_cv_getaddrinfo=yes], |
michael@0 | 306 | [libevent_cv_getaddrinfo=no] |
michael@0 | 307 | )] |
michael@0 | 308 | ) |
michael@0 | 309 | if test "$libevent_cv_getaddrinfo" = "yes" ; then |
michael@0 | 310 | AC_DEFINE([HAVE_GETADDRINFO], [1], [Do we have getaddrinfo()?]) |
michael@0 | 311 | else |
michael@0 | 312 | |
michael@0 | 313 | AC_CHECK_FUNCS([getservbyname]) |
michael@0 | 314 | # Check for gethostbyname_r in all its glorious incompatible versions. |
michael@0 | 315 | # (This is cut-and-pasted from Tor, which based its logic on |
michael@0 | 316 | # Python's configure.in.) |
michael@0 | 317 | AH_TEMPLATE(HAVE_GETHOSTBYNAME_R, |
michael@0 | 318 | [Define this if you have any gethostbyname_r()]) |
michael@0 | 319 | |
michael@0 | 320 | AC_CHECK_FUNC(gethostbyname_r, [ |
michael@0 | 321 | AC_MSG_CHECKING([how many arguments gethostbyname_r() wants]) |
michael@0 | 322 | OLD_CFLAGS=$CFLAGS |
michael@0 | 323 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
michael@0 | 324 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ |
michael@0 | 325 | #include <netdb.h> |
michael@0 | 326 | ], [[ |
michael@0 | 327 | char *cp1, *cp2; |
michael@0 | 328 | struct hostent *h1, *h2; |
michael@0 | 329 | int i1, i2; |
michael@0 | 330 | (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2); |
michael@0 | 331 | ]])],[ |
michael@0 | 332 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
michael@0 | 333 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, |
michael@0 | 334 | [Define this if gethostbyname_r takes 6 arguments]) |
michael@0 | 335 | AC_MSG_RESULT(6) |
michael@0 | 336 | ], [ |
michael@0 | 337 | AC_TRY_COMPILE([ |
michael@0 | 338 | #include <netdb.h> |
michael@0 | 339 | ], [ |
michael@0 | 340 | char *cp1, *cp2; |
michael@0 | 341 | struct hostent *h1; |
michael@0 | 342 | int i1, i2; |
michael@0 | 343 | (void)gethostbyname_r(cp1,h1,cp2,i1,&i2); |
michael@0 | 344 | ], [ |
michael@0 | 345 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
michael@0 | 346 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, |
michael@0 | 347 | [Define this if gethostbyname_r takes 5 arguments]) |
michael@0 | 348 | AC_MSG_RESULT(5) |
michael@0 | 349 | ], [ |
michael@0 | 350 | AC_TRY_COMPILE([ |
michael@0 | 351 | #include <netdb.h> |
michael@0 | 352 | ], [ |
michael@0 | 353 | char *cp1; |
michael@0 | 354 | struct hostent *h1; |
michael@0 | 355 | struct hostent_data hd; |
michael@0 | 356 | (void) gethostbyname_r(cp1,h1,&hd); |
michael@0 | 357 | ], [ |
michael@0 | 358 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
michael@0 | 359 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, |
michael@0 | 360 | [Define this if gethostbyname_r takes 3 arguments]) |
michael@0 | 361 | AC_MSG_RESULT(3) |
michael@0 | 362 | ], [ |
michael@0 | 363 | AC_MSG_RESULT(0) |
michael@0 | 364 | ]) |
michael@0 | 365 | ]) |
michael@0 | 366 | ]) |
michael@0 | 367 | CFLAGS=$OLD_CFLAGS |
michael@0 | 368 | ]) |
michael@0 | 369 | |
michael@0 | 370 | fi |
michael@0 | 371 | |
michael@0 | 372 | AC_CHECK_SIZEOF(long) |
michael@0 | 373 | |
michael@0 | 374 | AC_MSG_CHECKING(for F_SETFD in fcntl.h) |
michael@0 | 375 | AC_EGREP_CPP(yes, |
michael@0 | 376 | [ |
michael@0 | 377 | #define _GNU_SOURCE |
michael@0 | 378 | #include <fcntl.h> |
michael@0 | 379 | #ifdef F_SETFD |
michael@0 | 380 | yes |
michael@0 | 381 | #endif |
michael@0 | 382 | ], [ AC_DEFINE(HAVE_SETFD, 1, |
michael@0 | 383 | [Define if F_SETFD is defined in <fcntl.h>]) |
michael@0 | 384 | AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no)) |
michael@0 | 385 | |
michael@0 | 386 | needsignal=no |
michael@0 | 387 | haveselect=no |
michael@0 | 388 | if test x$bwin32 != xtrue; then |
michael@0 | 389 | AC_CHECK_FUNCS(select, [haveselect=yes], ) |
michael@0 | 390 | if test "x$haveselect" = "xyes" ; then |
michael@0 | 391 | needsignal=yes |
michael@0 | 392 | fi |
michael@0 | 393 | fi |
michael@0 | 394 | AM_CONDITIONAL(SELECT_BACKEND, [test "x$haveselect" = "xyes"]) |
michael@0 | 395 | |
michael@0 | 396 | havepoll=no |
michael@0 | 397 | AC_CHECK_FUNCS(poll, [havepoll=yes], ) |
michael@0 | 398 | if test "x$havepoll" = "xyes" ; then |
michael@0 | 399 | needsignal=yes |
michael@0 | 400 | fi |
michael@0 | 401 | AM_CONDITIONAL(POLL_BACKEND, [test "x$havepoll" = "xyes"]) |
michael@0 | 402 | |
michael@0 | 403 | havedevpoll=no |
michael@0 | 404 | if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then |
michael@0 | 405 | AC_DEFINE(HAVE_DEVPOLL, 1, |
michael@0 | 406 | [Define if /dev/poll is available]) |
michael@0 | 407 | fi |
michael@0 | 408 | AM_CONDITIONAL(DEVPOLL_BACKEND, [test "x$ac_cv_header_sys_devpoll_h" = "xyes"]) |
michael@0 | 409 | |
michael@0 | 410 | havekqueue=no |
michael@0 | 411 | if test "x$ac_cv_header_sys_event_h" = "xyes"; then |
michael@0 | 412 | AC_CHECK_FUNCS(kqueue, [havekqueue=yes], ) |
michael@0 | 413 | if test "x$havekqueue" = "xyes" ; then |
michael@0 | 414 | AC_MSG_CHECKING(for working kqueue) |
michael@0 | 415 | AC_TRY_RUN( |
michael@0 | 416 | #include <sys/types.h> |
michael@0 | 417 | #include <sys/time.h> |
michael@0 | 418 | #include <sys/event.h> |
michael@0 | 419 | #include <stdio.h> |
michael@0 | 420 | #include <unistd.h> |
michael@0 | 421 | #include <fcntl.h> |
michael@0 | 422 | |
michael@0 | 423 | int |
michael@0 | 424 | main(int argc, char **argv) |
michael@0 | 425 | { |
michael@0 | 426 | int kq; |
michael@0 | 427 | int n; |
michael@0 | 428 | int fd[[2]]; |
michael@0 | 429 | struct kevent ev; |
michael@0 | 430 | struct timespec ts; |
michael@0 | 431 | char buf[[8000]]; |
michael@0 | 432 | |
michael@0 | 433 | if (pipe(fd) == -1) |
michael@0 | 434 | exit(1); |
michael@0 | 435 | if (fcntl(fd[[1]], F_SETFL, O_NONBLOCK) == -1) |
michael@0 | 436 | exit(1); |
michael@0 | 437 | |
michael@0 | 438 | while ((n = write(fd[[1]], buf, sizeof(buf))) == sizeof(buf)) |
michael@0 | 439 | ; |
michael@0 | 440 | |
michael@0 | 441 | if ((kq = kqueue()) == -1) |
michael@0 | 442 | exit(1); |
michael@0 | 443 | |
michael@0 | 444 | memset(&ev, 0, sizeof(ev)); |
michael@0 | 445 | ev.ident = fd[[1]]; |
michael@0 | 446 | ev.filter = EVFILT_WRITE; |
michael@0 | 447 | ev.flags = EV_ADD | EV_ENABLE; |
michael@0 | 448 | n = kevent(kq, &ev, 1, NULL, 0, NULL); |
michael@0 | 449 | if (n == -1) |
michael@0 | 450 | exit(1); |
michael@0 | 451 | |
michael@0 | 452 | read(fd[[0]], buf, sizeof(buf)); |
michael@0 | 453 | |
michael@0 | 454 | ts.tv_sec = 0; |
michael@0 | 455 | ts.tv_nsec = 0; |
michael@0 | 456 | n = kevent(kq, NULL, 0, &ev, 1, &ts); |
michael@0 | 457 | if (n == -1 || n == 0) |
michael@0 | 458 | exit(1); |
michael@0 | 459 | |
michael@0 | 460 | exit(0); |
michael@0 | 461 | }, [AC_MSG_RESULT(yes) |
michael@0 | 462 | AC_DEFINE(HAVE_WORKING_KQUEUE, 1, |
michael@0 | 463 | [Define if kqueue works correctly with pipes]) |
michael@0 | 464 | havekqueue=yes |
michael@0 | 465 | ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) |
michael@0 | 466 | fi |
michael@0 | 467 | fi |
michael@0 | 468 | AM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"]) |
michael@0 | 469 | |
michael@0 | 470 | haveepollsyscall=no |
michael@0 | 471 | haveepoll=no |
michael@0 | 472 | AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], ) |
michael@0 | 473 | if test "x$haveepoll" = "xyes" ; then |
michael@0 | 474 | AC_DEFINE(HAVE_EPOLL, 1, |
michael@0 | 475 | [Define if your system supports the epoll system calls]) |
michael@0 | 476 | needsignal=yes |
michael@0 | 477 | fi |
michael@0 | 478 | if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then |
michael@0 | 479 | if test "x$haveepoll" = "xno" ; then |
michael@0 | 480 | AC_MSG_CHECKING(for epoll system call) |
michael@0 | 481 | AC_TRY_RUN( |
michael@0 | 482 | #include <stdint.h> |
michael@0 | 483 | #include <sys/param.h> |
michael@0 | 484 | #include <sys/types.h> |
michael@0 | 485 | #include <sys/syscall.h> |
michael@0 | 486 | #include <sys/epoll.h> |
michael@0 | 487 | #include <unistd.h> |
michael@0 | 488 | |
michael@0 | 489 | int |
michael@0 | 490 | epoll_create(int size) |
michael@0 | 491 | { |
michael@0 | 492 | return (syscall(__NR_epoll_create, size)); |
michael@0 | 493 | } |
michael@0 | 494 | |
michael@0 | 495 | int |
michael@0 | 496 | main(int argc, char **argv) |
michael@0 | 497 | { |
michael@0 | 498 | int epfd; |
michael@0 | 499 | |
michael@0 | 500 | epfd = epoll_create(256); |
michael@0 | 501 | exit (epfd == -1 ? 1 : 0); |
michael@0 | 502 | }, [AC_MSG_RESULT(yes) |
michael@0 | 503 | AC_DEFINE(HAVE_EPOLL, 1, |
michael@0 | 504 | [Define if your system supports the epoll system calls]) |
michael@0 | 505 | needsignal=yes |
michael@0 | 506 | have_epoll=yes |
michael@0 | 507 | AC_LIBOBJ(epoll_sub) |
michael@0 | 508 | ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) |
michael@0 | 509 | fi |
michael@0 | 510 | fi |
michael@0 | 511 | AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"]) |
michael@0 | 512 | |
michael@0 | 513 | haveeventports=no |
michael@0 | 514 | AC_CHECK_FUNCS(port_create, [haveeventports=yes], ) |
michael@0 | 515 | if test "x$haveeventports" = "xyes" ; then |
michael@0 | 516 | AC_DEFINE(HAVE_EVENT_PORTS, 1, |
michael@0 | 517 | [Define if your system supports event ports]) |
michael@0 | 518 | needsignal=yes |
michael@0 | 519 | fi |
michael@0 | 520 | AM_CONDITIONAL(EVPORT_BACKEND, [test "x$haveeventports" = "xyes"]) |
michael@0 | 521 | |
michael@0 | 522 | if test "x$bwin32" = "xtrue"; then |
michael@0 | 523 | needsignal=yes |
michael@0 | 524 | fi |
michael@0 | 525 | |
michael@0 | 526 | AM_CONDITIONAL(SIGNAL_SUPPORT, [test "x$needsignal" = "xyes"]) |
michael@0 | 527 | |
michael@0 | 528 | AC_TYPE_PID_T |
michael@0 | 529 | AC_TYPE_SIZE_T |
michael@0 | 530 | AC_TYPE_SSIZE_T |
michael@0 | 531 | |
michael@0 | 532 | AC_CHECK_TYPES([uint64_t, uint32_t, uint16_t, uint8_t, uintptr_t], , , |
michael@0 | 533 | [#ifdef HAVE_STDINT_H |
michael@0 | 534 | #include <stdint.h> |
michael@0 | 535 | #elif defined(HAVE_INTTYPES_H) |
michael@0 | 536 | #include <inttypes.h> |
michael@0 | 537 | #endif |
michael@0 | 538 | #ifdef HAVE_SYS_TYPES_H |
michael@0 | 539 | #include <sys/types.h> |
michael@0 | 540 | #endif]) |
michael@0 | 541 | |
michael@0 | 542 | AC_CHECK_TYPES([fd_mask], , , |
michael@0 | 543 | [#ifdef HAVE_SYS_TYPES_H |
michael@0 | 544 | #include <sys/types.h> |
michael@0 | 545 | #endif |
michael@0 | 546 | #ifdef HAVE_SYS_SELECT_H |
michael@0 | 547 | #include <sys/select.h> |
michael@0 | 548 | #endif]) |
michael@0 | 549 | |
michael@0 | 550 | AC_CHECK_SIZEOF(long long) |
michael@0 | 551 | AC_CHECK_SIZEOF(long) |
michael@0 | 552 | AC_CHECK_SIZEOF(int) |
michael@0 | 553 | AC_CHECK_SIZEOF(short) |
michael@0 | 554 | AC_CHECK_SIZEOF(size_t) |
michael@0 | 555 | AC_CHECK_SIZEOF(void *) |
michael@0 | 556 | |
michael@0 | 557 | AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrinfo, struct sockaddr_storage], , , |
michael@0 | 558 | [#define _GNU_SOURCE |
michael@0 | 559 | #include <sys/types.h> |
michael@0 | 560 | #ifdef HAVE_NETINET_IN_H |
michael@0 | 561 | #include <netinet/in.h> |
michael@0 | 562 | #endif |
michael@0 | 563 | #ifdef HAVE_NETINET_IN6_H |
michael@0 | 564 | #include <netinet/in6.h> |
michael@0 | 565 | #endif |
michael@0 | 566 | #ifdef HAVE_SYS_SOCKET_H |
michael@0 | 567 | #include <sys/socket.h> |
michael@0 | 568 | #endif |
michael@0 | 569 | #ifdef HAVE_NETDB_H |
michael@0 | 570 | #include <netdb.h> |
michael@0 | 571 | #endif |
michael@0 | 572 | #ifdef WIN32 |
michael@0 | 573 | #define WIN32_WINNT 0x400 |
michael@0 | 574 | #define _WIN32_WINNT 0x400 |
michael@0 | 575 | #define WIN32_LEAN_AND_MEAN |
michael@0 | 576 | #if defined(_MSC_VER) && (_MSC_VER < 1300) |
michael@0 | 577 | #include <winsock.h> |
michael@0 | 578 | #else |
michael@0 | 579 | #include <winsock2.h> |
michael@0 | 580 | #include <ws2tcpip.h> |
michael@0 | 581 | #endif |
michael@0 | 582 | #endif |
michael@0 | 583 | ]) |
michael@0 | 584 | 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], , , |
michael@0 | 585 | [#include <sys/types.h> |
michael@0 | 586 | #ifdef HAVE_NETINET_IN_H |
michael@0 | 587 | #include <netinet/in.h> |
michael@0 | 588 | #endif |
michael@0 | 589 | #ifdef HAVE_NETINET_IN6_H |
michael@0 | 590 | #include <netinet/in6.h> |
michael@0 | 591 | #endif |
michael@0 | 592 | #ifdef HAVE_SYS_SOCKET_H |
michael@0 | 593 | #include <sys/socket.h> |
michael@0 | 594 | #endif |
michael@0 | 595 | #ifdef WIN32 |
michael@0 | 596 | #define WIN32_WINNT 0x400 |
michael@0 | 597 | #define _WIN32_WINNT 0x400 |
michael@0 | 598 | #define WIN32_LEAN_AND_MEAN |
michael@0 | 599 | #if defined(_MSC_VER) && (_MSC_VER < 1300) |
michael@0 | 600 | #include <winsock.h> |
michael@0 | 601 | #else |
michael@0 | 602 | #include <winsock2.h> |
michael@0 | 603 | #include <ws2tcpip.h> |
michael@0 | 604 | #endif |
michael@0 | 605 | #endif |
michael@0 | 606 | ]) |
michael@0 | 607 | |
michael@0 | 608 | AC_MSG_CHECKING([for socklen_t]) |
michael@0 | 609 | AC_TRY_COMPILE([ |
michael@0 | 610 | #include <sys/types.h> |
michael@0 | 611 | #include <sys/socket.h>], |
michael@0 | 612 | [socklen_t x;], |
michael@0 | 613 | AC_MSG_RESULT([yes]), |
michael@0 | 614 | [AC_MSG_RESULT([no]) |
michael@0 | 615 | AC_DEFINE(socklen_t, unsigned int, |
michael@0 | 616 | [Define to unsigned int if you dont have it])] |
michael@0 | 617 | ) |
michael@0 | 618 | |
michael@0 | 619 | AC_MSG_CHECKING([whether our compiler supports __func__]) |
michael@0 | 620 | AC_TRY_COMPILE([], |
michael@0 | 621 | [ const char *cp = __func__; ], |
michael@0 | 622 | AC_MSG_RESULT([yes]), |
michael@0 | 623 | AC_MSG_RESULT([no]) |
michael@0 | 624 | AC_MSG_CHECKING([whether our compiler supports __FUNCTION__]) |
michael@0 | 625 | AC_TRY_COMPILE([], |
michael@0 | 626 | [ const char *cp = __FUNCTION__; ], |
michael@0 | 627 | AC_MSG_RESULT([yes]) |
michael@0 | 628 | AC_DEFINE(__func__, __FUNCTION__, |
michael@0 | 629 | [Define to appropriate substitue if compiler doesnt have __func__]), |
michael@0 | 630 | AC_MSG_RESULT([no]) |
michael@0 | 631 | AC_DEFINE(__func__, __FILE__, |
michael@0 | 632 | [Define to appropriate substitue if compiler doesnt have __func__]))) |
michael@0 | 633 | |
michael@0 | 634 | |
michael@0 | 635 | # check if we can compile with pthreads |
michael@0 | 636 | have_pthreads=no |
michael@0 | 637 | if test x$bwin32 != xtrue && test "$enable_thread_support" != "no"; then |
michael@0 | 638 | ACX_PTHREAD([ |
michael@0 | 639 | AC_DEFINE(HAVE_PTHREADS, 1, |
michael@0 | 640 | [Define if we have pthreads on this system]) |
michael@0 | 641 | have_pthreads=yes]) |
michael@0 | 642 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
michael@0 | 643 | AC_CHECK_SIZEOF(pthread_t, , |
michael@0 | 644 | [AC_INCLUDES_DEFAULT() |
michael@0 | 645 | #include <pthread.h> ] |
michael@0 | 646 | ) |
michael@0 | 647 | fi |
michael@0 | 648 | AM_CONDITIONAL(PTHREADS, [test "$have_pthreads" != "no" && test "$enable_thread_support" != "no"]) |
michael@0 | 649 | |
michael@0 | 650 | # check if we should compile locking into the library |
michael@0 | 651 | if test x$enable_thread_support = xno; then |
michael@0 | 652 | AC_DEFINE(DISABLE_THREAD_SUPPORT, 1, |
michael@0 | 653 | [Define if libevent should not be compiled with thread support]) |
michael@0 | 654 | fi |
michael@0 | 655 | |
michael@0 | 656 | # check if we should hard-code the mm functions. |
michael@0 | 657 | if test x$enable_malloc_replacement = xno; then |
michael@0 | 658 | AC_DEFINE(DISABLE_MM_REPLACEMENT, 1, |
michael@0 | 659 | [Define if libevent should not allow replacing the mm functions]) |
michael@0 | 660 | fi |
michael@0 | 661 | |
michael@0 | 662 | # check if we should hard-code debugging out |
michael@0 | 663 | if test x$enable_debug_mode = xno; then |
michael@0 | 664 | AC_DEFINE(DISABLE_DEBUG_MODE, 1, |
michael@0 | 665 | [Define if libevent should build without support for a debug mode]) |
michael@0 | 666 | fi |
michael@0 | 667 | |
michael@0 | 668 | # check if we have and should use openssl |
michael@0 | 669 | AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"]) |
michael@0 | 670 | |
michael@0 | 671 | # Add some more warnings which we use in development but not in the |
michael@0 | 672 | # released versions. (Some relevant gcc versions can't handle these.) |
michael@0 | 673 | if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then |
michael@0 | 674 | |
michael@0 | 675 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ |
michael@0 | 676 | #if !defined(__GNUC__) || (__GNUC__ < 4) |
michael@0 | 677 | #error |
michael@0 | 678 | #endif])], have_gcc4=yes, have_gcc4=no) |
michael@0 | 679 | |
michael@0 | 680 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ |
michael@0 | 681 | #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) |
michael@0 | 682 | #error |
michael@0 | 683 | #endif])], have_gcc42=yes, have_gcc42=no) |
michael@0 | 684 | |
michael@0 | 685 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ |
michael@0 | 686 | #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) |
michael@0 | 687 | #error |
michael@0 | 688 | #endif])], have_gcc45=yes, have_gcc45=no) |
michael@0 | 689 | |
michael@0 | 690 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ |
michael@0 | 691 | #if !defined(__clang__) |
michael@0 | 692 | #error |
michael@0 | 693 | #endif])], have_clang=yes, have_clang=no) |
michael@0 | 694 | |
michael@0 | 695 | 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 -Werror" |
michael@0 | 696 | CFLAGS="$CFLAGS -Wno-unused-parameter -Wstrict-aliasing" |
michael@0 | 697 | |
michael@0 | 698 | if test x$have_gcc4 = xyes ; then |
michael@0 | 699 | # These warnings break gcc 3.3.5 and work on gcc 4.0.2 |
michael@0 | 700 | CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement" |
michael@0 | 701 | #CFLAGS="$CFLAGS -Wold-style-definition" |
michael@0 | 702 | fi |
michael@0 | 703 | |
michael@0 | 704 | if test x$have_gcc42 = xyes ; then |
michael@0 | 705 | # These warnings break gcc 4.0.2 and work on gcc 4.2 |
michael@0 | 706 | CFLAGS="$CFLAGS -Waddress" |
michael@0 | 707 | fi |
michael@0 | 708 | |
michael@0 | 709 | if test x$have_gcc42 = xyes && test x$have_clang = xno; then |
michael@0 | 710 | # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2 |
michael@0 | 711 | CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init" |
michael@0 | 712 | fi |
michael@0 | 713 | |
michael@0 | 714 | if test x$have_gcc45 = xyes ; then |
michael@0 | 715 | # These warnings work on gcc 4.5 |
michael@0 | 716 | CFLAGS="$CFLAGS -Wlogical-op" |
michael@0 | 717 | fi |
michael@0 | 718 | |
michael@0 | 719 | if test x$have_clang = xyes; then |
michael@0 | 720 | # Disable the unused-function warnings, because these trigger |
michael@0 | 721 | # for minheap-internal.h related code. |
michael@0 | 722 | CFLAGS="$CFLAGS -Wno-unused-function" |
michael@0 | 723 | fi |
michael@0 | 724 | |
michael@0 | 725 | ##This will break the world on some 64-bit architectures |
michael@0 | 726 | # CFLAGS="$CFLAGS -Winline" |
michael@0 | 727 | |
michael@0 | 728 | fi |
michael@0 | 729 | |
michael@0 | 730 | LIBEVENT_GC_SECTIONS= |
michael@0 | 731 | if test "$GCC" = yes && test "$enable_function_sections" = yes ; then |
michael@0 | 732 | AC_CACHE_CHECK( |
michael@0 | 733 | [if linker supports omitting unused code and data], |
michael@0 | 734 | [libevent_cv_gc_sections_runs], |
michael@0 | 735 | [ |
michael@0 | 736 | dnl NetBSD will link but likely not run with --gc-sections |
michael@0 | 737 | dnl http://bugs.ntp.org/1844 |
michael@0 | 738 | dnl http://gnats.netbsd.org/40401 |
michael@0 | 739 | dnl --gc-sections causes attempt to load as linux elf, with |
michael@0 | 740 | dnl wrong syscalls in place. Test a little gauntlet of |
michael@0 | 741 | dnl simple stdio read code checking for errors, expecting |
michael@0 | 742 | dnl enough syscall differences that the NetBSD code will |
michael@0 | 743 | dnl fail even with Linux emulation working as designed. |
michael@0 | 744 | dnl A shorter test could be refined by someone with access |
michael@0 | 745 | dnl to a NetBSD host with Linux emulation working. |
michael@0 | 746 | origCFLAGS="$CFLAGS" |
michael@0 | 747 | CFLAGS="$CFLAGS -Wl,--gc-sections" |
michael@0 | 748 | AC_LINK_IFELSE( |
michael@0 | 749 | [AC_LANG_PROGRAM( |
michael@0 | 750 | [[ |
michael@0 | 751 | #include <stdlib.h> |
michael@0 | 752 | #include <stdio.h> |
michael@0 | 753 | ]], |
michael@0 | 754 | [[ |
michael@0 | 755 | FILE * fpC; |
michael@0 | 756 | char buf[32]; |
michael@0 | 757 | size_t cch; |
michael@0 | 758 | int read_success_once; |
michael@0 | 759 | |
michael@0 | 760 | fpC = fopen("conftest.c", "r"); |
michael@0 | 761 | if (NULL == fpC) |
michael@0 | 762 | exit(1); |
michael@0 | 763 | do { |
michael@0 | 764 | cch = fread(buf, sizeof(buf), 1, fpC); |
michael@0 | 765 | read_success_once |= (0 != cch); |
michael@0 | 766 | } while (0 != cch); |
michael@0 | 767 | if (!read_success_once) |
michael@0 | 768 | exit(2); |
michael@0 | 769 | if (!feof(fpC)) |
michael@0 | 770 | exit(3); |
michael@0 | 771 | if (0 != fclose(fpC)) |
michael@0 | 772 | exit(4); |
michael@0 | 773 | |
michael@0 | 774 | exit(EXIT_SUCCESS); |
michael@0 | 775 | ]] |
michael@0 | 776 | )], |
michael@0 | 777 | [ |
michael@0 | 778 | dnl We have to do this invocation manually so that we can |
michael@0 | 779 | dnl get the output of conftest.err to make sure it doesn't |
michael@0 | 780 | dnl mention gc-sections. |
michael@0 | 781 | if test "X$cross_compiling" = "Xyes" || grep gc-sections conftest.err ; then |
michael@0 | 782 | libevent_cv_gc_sections_runs=no |
michael@0 | 783 | else |
michael@0 | 784 | libevent_cv_gc_sections_runs=no |
michael@0 | 785 | ./conftest >/dev/null 2>&1 && libevent_cv_gc_sections_runs=yes |
michael@0 | 786 | fi |
michael@0 | 787 | ], |
michael@0 | 788 | [libevent_cv_gc_sections_runs=no] |
michael@0 | 789 | ) |
michael@0 | 790 | CFLAGS="$origCFLAGS" |
michael@0 | 791 | AS_UNSET([origCFLAGS]) |
michael@0 | 792 | ] |
michael@0 | 793 | ) |
michael@0 | 794 | case "$libevent_cv_gc_sections_runs" in |
michael@0 | 795 | yes) |
michael@0 | 796 | CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" |
michael@0 | 797 | LIBEVENT_GC_SECTIONS="-Wl,--gc-sections" |
michael@0 | 798 | ;; |
michael@0 | 799 | esac |
michael@0 | 800 | fi |
michael@0 | 801 | AC_SUBST([LIBEVENT_GC_SECTIONS]) |
michael@0 | 802 | |
michael@0 | 803 | AM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"]) |
michael@0 | 804 | |
michael@0 | 805 | AC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] ) |
michael@0 | 806 | AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile) |