37 Commits

Author SHA1 Message Date
fanquake
78e8541a9e
build: remove no-longer used checks for vasprintf
From what I can tell the last usage was removed in
8d1317d71c46e27c5073d3429a64af69de0351a6.
2021-03-28 13:55:59 +08:00
fanquake
4c29b01c87
build: remove splice implementation fragments
Looks like a `splice` implementation was planned, but has clearly never
eventuated (the TODO comment is from ~12 years ago, in
8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better
to remove the unused code/correct the docs.
2021-03-28 10:57:11 +08:00
Azat Khuzhin
972289f356 Detect existence of pthread_mutexattr_setprotocol()
Fixes: #1084
2020-08-29 01:15:20 +03:00
okhowang(王沛文)
028385f685 fix build system and add test and cleanup code 2020-07-22 22:53:23 +03:00
Nick Grifka
83ef3216e4 Add wepoll support to light up the epoll backend on Windows
libevent is lacking a scalable backend on Windows. Let's leverage the wepoll
library until Windows comes up with an epoll/kqueue compete user mode API.

- All regress tests pass for standard wepoll
- These 2 tests fail intermittently for changelist wepoll, so disabling
  changelist wepoll for now
     http/cancel_inactive_server
     http/stream_in
- verify target on Windows runs tests for both wepoll and win32 backends
- wepoll backend preferred over win32 backend
- wepoll version 1.5.6

v2: cleaner backend abstraction. Disallow wepoll on MinGW/Cygwin.
v3: Add wepoll.h to dist
v4: Make sure wepoll source files are excluded from cygwin/mingw builds
v5: Keep win32 as default backend on windows.
v6: Include wepoll in mingw builds. Verified that regress tests pass w/ WEPOLL backend.
v7: Enable wepoll on mingw when building with cmake
v8: Add wepoll testrunner for autotools test target
2020-05-08 23:27:04 +03:00
yuangongji
41d1d75a84 cmake: replace CheckFunctionExists with CheckSymbolExists
Checking functions with `CheckFunctionExists` may
get wrong results, we should replace it with
`CheckSymbolExists`, which is recommended by the cmake
official documentation.
Before using `CheckSymbolExists`, we use
`CheckIncludeFiles` to check header files and save the
available header files in a variable that guarantees
`CheckSymbolExists` and `CheckTypeSize` to work correctly.
This approach is modeled after the cmake scripts of `curl`.

The following functions or files were not found before
modification, they can now be found:
- msys2 + mingw-8.1.0 on Windows10 or mingw-7.3.0 on Ubuntu-18.04
timerclear
timercmp
timerisset

- windows10
getaddrinfo
getnameinfo
getprotobynumber
getservbyname
putenv
strtoll
timerclear
timercmp
timerisset

- ubuntu-18.04
sys/sysctl.h
timeradd
timerclear
timercmp
timerisset

- MacOS 10.13
sys/random.h
timeradd
timerclear
timercmp
timerisset
2020-03-22 22:22:51 +08:00
Azat Khuzhin
b1e46c32db test: put thread into real time scheduling class on osx for better latencies 2020-01-13 23:36:19 +03:00
yuangongji
148d12ad31 evutil_time: detect and use _gmtime64_s()/_gmtime64() 2019-09-19 15:52:49 +08:00
Azat Khuzhin
194a5d8226 cmake: fix getrandom() detection
Fixes: 86f55b04 ("arc4random: replace sysctl() with getrandom (on linux)")
2019-09-04 00:46:27 +03:00
Azat Khuzhin
86f55b0420 arc4random: replace sysctl() with getrandom (on linux)
Since sysctl() is deprecated for a long-long time, according to
sysctl(2):

    Since Linux 2.6.24, uses of this system call result in warnings in the kernel log.

Fixes: #890
Suggested-by: Pierce Lopez
2019-09-03 00:50:10 +03:00
Azat Khuzhin
da11217544
build: struct sockaddr_un detection (sys/un.h, afunix.h)
- On UNIX:     sys/un.h
- Since win10: afunix.h

And windows has AF_UNIX but do not have sockaddr_un (before windows
build 17061 [1]), hence the sockaddr_un detection.

  [1]: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
2019-05-12 18:17:53 +03:00
Azat Khuzhin
d5b24cc0c8
sample/becat: bufferevent cat, ncat/nc/telnet analog 2019-03-16 17:40:20 +03:00
Azat Khuzhin
8e87de3c24
cmake: fix checking of devpoll backend (like in autotools, by devpoll.h existence) 2019-02-04 22:21:28 +03:00
Azat Khuzhin
e85818d248
Cleanup __func__ detection
First of all __func__ is not a macro, it is char[] array, so the code
that we had before in cmake, was incorrect, i.e.:
  #if defined (__func__)
  #define EVENT____func__ __func__
  #elif defined(__FUNCTION__)
  #define EVENT____func__  __FUNCTION__
  #else
  #define EVENT____func__ __FILE__
  #endif

So just detect do we have __func__/__FUNCTION__ in configure/cmake
before build and define EVENT__HAVE___func__/EVENT__HAVE___FUNCTION__
to use the later to choose which should be used as a __func__ (if it is
not presented).

Closes: #644
2018-08-02 02:50:48 +03:00
Philip Prindeville
755896efe2 Get rid of macros which are never used
There are no expansions of these macros or tests for their existence.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2018-06-16 17:04:05 -06:00
Azat Khuzhin
266f43af77 Fix arc4random_addrandom() detecting and fallback (regression)
But this is kind of hot-fix, we definitelly need more sane arc4random
compat layer.

Fixes: #488
Introduced-in: 6541168 ("Detect arch4random_addrandom() existence")
2017-03-27 17:04:33 +03:00
Azat Khuzhin
d5e1087044 cmake: clean not used #defines from event-config.h
- _LARGE_FILES: we have it in evconfig-private.h.in, drop from event-config.h
- EVENT___FILE_OFFSET_BITS: remove it for now
- EVENT__const
2017-03-13 22:13:13 +03:00
Azat Khuzhin
7182c2f561 cmake: build SHARED and STATIC libraries (like autoconf does)
Since they are useful for debugging, and if autotools build them then
cmamke has to do this too, to make migration more simple.

And now:
- tests: uses shared libraries (since this is upstreams one)
- other binaries: uses static libraries

This removes next private config:
- EVENT__NEED_DLLIMPORT
2017-03-13 16:20:40 +03:00
Azat Khuzhin
66a4eb0c3a Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
Because checking in cmake breaks cross-compiling.

Introduced-in: 43eb56c7c738e3642f0981e3dd6ab9e082eec798.
Fixes: #482
Fixes: #462
Refs: #475

v2: use waitid() with WNOWAIT
v3: use WNOWAIT only if it available in waitpid(), because not all netbsd
    supports it
2017-03-08 13:31:55 +03:00
Azat Khuzhin
7f945b2d1b cmake: fix values for #cmakedefine 2017-03-08 13:31:53 +03:00
Azat Khuzhin
852726028f cmake: drop duplicates from event-config template 2017-03-08 12:47:32 +03:00
Azat Khuzhin
336ab816c8 cmake: add value for the #cmakedefine macros (like autoconf)
Before this patch for cmake we had:
  #define EVENT__HAVE_ACCEPT4
  /* #undef EVENT__HAVE_ARC4RANDOM */

While autotools has:
 #define EVENT__HAVE_ACCEPT4 1
 /* #undef EVENT__HAVE_ARC4RANDOM */
2017-03-08 12:47:31 +03:00
Azat Khuzhin
fa135bdcd9 cmake: Fix checking of enum values from sysctl.h
CheckSymbolExists do not do this, so add new CheckConstExists that will
use CheckCSourceCompiles() to check this.

v2: use set() instead of string(APPEND)
2017-03-08 12:47:22 +03:00
Pierce Lopez
5d18d87916 Do not check for ERR_remove_thread_state() (do not link ssl into every library)
This reverts commit c4e9d9bd662de7f575f2172c160795d452ebe709
("sample/https-client: check for ERR_remove_thread_state() existence").

Calling AC_SEARCH_LIBS() modifies LIBS - -lcrypto incorrectly
ends up in LIBS, and thus linked to by libevent_core.so.

Checking for ERR_remove_thread_state should no longer be needed
because it was introduced in openssl 1.0.0, and the previous line
0.9.8 had support discontinued at the end of 2015.

Fixes: #473
2017-03-06 01:39:29 +03:00
Azat Khuzhin
b24a78cccf cmake: check for 'struct linger' existence 2017-01-29 23:06:34 +03:00
Zonr Chang
dc624adf42 cmake: cleanup
- Remove a redundant check on netdb.h (EVENT__HAVE_NETDB_H).
- Properly setup EVENT__SIZEOF_SSIZE_T for the case where "ssize_t" is
  not "int".
- Remove unused EVENT__HAVE_PTHREAD.
- Set EVENT__HAVE_LIBZ instead of EVENT__HAVE_ZLIB (and remove the
  latter).

Closes: #391 (cherry-picked from PR)
2016-10-26 18:48:41 +03:00
Azat Khuzhin
43eb56c7c7 tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris
According to solaris docs:
  "One instance of a SIGCHLD signal is queued for each child process whose
  status has changed. If waitpid() returns because the status of a child
  process is available, and WNOWAIT was not specified in options, any pending
  SIGCHLD signal associated with the process ID of that child process is
  discarded. Any other pending SIGCHLD signals remain pending."

And interesting thing that it works if you add sleep(1) before waitpid(), and
also if you run with --verbose (some race or what).

But linux doesn't support WNOWAIT in waitpid() so add detection into
cmake/autotools.

Fixes: #387
Link: https://bugzilla.redhat.com/show_bug.cgi?id=840782
2016-08-11 17:08:35 +03:00
Mark Ellzey
303161777d
[#372] check for errno.h 2016-06-28 10:37:24 -07:00
Azat Khuzhin
49bd79047b cmake: don't define EVENT__NEED_DLLIMPORT always (fixes VS2013 static build)
Otherwise that #ifdef in visibility.h is useless, and __declspec(dllimport)
will be always on.

Fixes: #314
Fixes: 4545fa9b6866df47ce2f908631a84477a94d5f49 ("Add option to build shared
library")
2016-01-30 23:54:03 +03:00
Mark Ellzey
49a53811a6 More cmake updates, lot's of missing definitions 2015-12-20 21:44:04 -08:00
Mark Ellzey
6aad23d8d5 CMake syntax fixes fo .in files 2015-12-20 01:56:25 -08:00
Mark Ellzey
8b228e27f5 Lot's of cmake updates
This is still not done, cmake here was a horrid mess, but we're
getting our act together now.
2015-12-19 01:47:49 -08:00
Azat Khuzhin
c4e9d9bd66 sample/https-client: check for ERR_remove_thread_state() existence
Fixes: freebsd 9.2 build
2015-11-24 01:19:25 +03:00
Nick Mathewson
8896a92b07 Merge remote-tracking branch 'origin/pr/110' 2014-03-03 13:47:21 -05:00
Trond Norbye
4545fa9b68 Add option to build shared library 2014-02-25 14:57:24 +01:00
Nick Mathewson
f665d5cb27 Stop checking for inet_aton; we don't use it.
We had cmake and autoconf tests for the inet_aton function... but we
never actually use it any more.

(The autoconf tests still use the callability of inet_aton to decide
whether we need to link against -lresolv)

Reported by Harlan Stenn.
2014-02-24 10:33:16 -05:00
Joakim Soderberg
e415196a7d Initial CMake commit. 2013-12-09 18:05:32 +01:00