101 Commits

Author SHA1 Message Date
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
6e5c15d095 Fix typo in cmake because of which EVENT__SIZEOF_SIZE_T was wrong
Fixes: #580
2017-12-16 23:28:41 +03:00
Andrey Okoshkin
6ee73ea9b0 Fix generation of LibeventConfig.cmake for the installation tree
'LIBEVENT_INCLUDE_DIRS' is properly initialized in 'LibeventConfig.cmake' as
'LibeventConfig.cmake.in' contains usage of 'LIBEVENT_CMAKE_DIR' and
'EVENT_INSTALL_INCLUDE_DIR' variables but not 'EVENT_CMAKE_DIR' and
'EVENT__INCLUDE_DIRS'.
Related typos are fixed.
2017-11-29 11:13:51 +03:00
lightningkay
3f19c5eb83 cmake doesn't has POLICY CMP0054 in low version 2017-11-04 18:57:00 +03:00
Kiyoshi Aman
8b0aa7b36a Port event_rpcgen.py and test/check-dumpevents.py to Python 3.
These scripts remain compatible with Python 2.
2017-09-25 11:35:23 +03:00
Carlo Marcelo Arenas Belón
63c4bf78d6 test: fix 32bit linux regress 2017-09-01 15:50:36 -07:00
Azat Khuzhin
2773a5ed5e cmake: set CMP0054 to NEW to avoid variables over expansion (since cmake 3.8)
==> win: CMake Warning (dev) at CMakeLists.txt:782 (elseif):
==> win:   Policy CMP0054 is not set: Only interpret if() arguments as variables or
==> win:   keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
==> win:   details.  Use the cmake_policy command to set the policy and suppress this
==> win:   warning.
==> win:
==> win:   Quoted variables like "MSVC" will no longer be dereferenced when the policy
==> win:   is set to NEW.  Since the policy is not set the OLD behavior will be used.
==> win: This warning is for project developers.  Use -Wno-dev to suppress it.
2017-05-29 21:59:01 +03:00
Azat Khuzhin
8b29b13679 cmake: fix building bench/bench_cascade under win32 (missing getopt)
Because of typo in cmake, now rewrote to make it less error prone (since even
for non-win32 there are variables overlap).
2017-05-29 21:59:01 +03:00
Azat Khuzhin
346f8e1708 cmake: avoid requiring cmake 3.1 on win32 for dns-example
Avoid using target_sources() from cmake 3.1, just pass needable sources as
list.
2017-05-29 21:59:01 +03:00
Azat Khuzhin
30f2a969e8 cmake: eliminate EVENT_BUILDING_REGRESS_TEST, since we link with shared libs
Before 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED
and STATIC libraries (like autoconf does)") it links with *.c.
2017-03-14 00:33:37 +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
2d2299cf7a cmake: add <pthread.h> only for non-win32
Fixes: b2b4b4d74e78a3e4fe7a74224d1e6aada5bde351 ("cmake: add <pthread.h>
into CMAKE_REQUIRED_INCLUDES for sizeof(pthread_t)")
2017-03-13 22:09:27 +03:00
Azat Khuzhin
805e1aa819 cmake: support visibility for AppleClang too
Defaults apple linker behaviour is -two_levelnamespace, and you cannot
use "-undefined suppress" with it, so let's link non event_core with
event_core library to avoid undefined symbols.
2017-03-13 16:25:30 +03:00
Azat Khuzhin
fd5a3fc036 cmake: fix export absolute path and relative path and cleanup a bit
Remove next vars, since I don't think that somebody want to change it:
- bin
- lib
- include

And fix exports problem:
  CMake Error: INSTALL(EXPORT "LibeventTargets") given absolute DESTINATION "/usr/lib/cmake/libevent" but the export references an installation of target "event_core_static" which has relative DESTINATION "lib".
2017-03-13 16:20:40 +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
72ef9d1652 cmake: add missing event_openssl/event_pthreads libraries
This will remove openssl requirement if you don't use it (i.e. if you
not link with openssl_pthreads).

Plus it fixes some linking dependencies:
- libm required only for test-ratelim

And fix some coding style alignment issues.

Refs: #246
2017-03-13 12:57:22 +03:00
Shuo Chen
65870949e7 Fix detection of timerfd_create() in CMake. 2017-03-12 01:00:41 -08:00
Azat Khuzhin
819d049377 Do not add epoll_sub (syscall wrappers) for epoll in cmake
Nowadays mostly all supported OS'es has this wrappers, and some of them (like
SmartOS) has wrappers but doesn't have __NR_epoll* defines for syscall numbers,
so just drop them (instead of adding yet another check int cmake like autotools
has, since this will break building in cross-compile environment).

Also one minor note, configure doesn't added epoll_sub.c either, since it check
epoll_create() in runtime.

And I tested it in SmartOS and it even works (`make verify`).

Fixes: #463
2017-03-08 23:34:44 +03:00
Marek Sebera
6541168d70 Detect arch4random_addrandom() existence
Refs: #370
Refs: #475
2017-03-08 13:31:55 +03:00
Azat Khuzhin
71a56bd3a7 cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE)
Fixes pipe2() on Android-9/armv7-a

Refs: #475
2017-03-08 13:31:55 +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
b2b4b4d74e cmake: add <pthread.h> into CMAKE_REQUIRED_INCLUDES for sizeof(pthread_t)
Fixes: #475
2017-03-08 13:31:55 +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
Trond Norbye
cc0e04d798 Fix RPATH for APPLE
By setting the CMake minimum version to 3.1 CMake automatically
adds the correct magic to make the library relocatable on
the filesystem (instead of burning the location of the library
at link time into the binary).

ex:
otool -L bin/http-connect
bin/http-connect:
	@rpath/libevent_extra.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

Fixes: #468 (cherry-picked)
2017-02-28 11:02:39 +03:00
Azat Khuzhin
b24a78cccf cmake: check for 'struct linger' existence 2017-01-29 23:06:34 +03:00
Azat Khuzhin
fe2c2622c3 Make EVENT_STAGE_NAME non cached
It did not work before correctly anyway, since cmake do not reset cache
entries by default, so that reset to "beta" didn't work.

But I don't think that making this variable cached is useful, so let's
remove this.
2017-01-29 20:35:57 +03:00
Azat Khuzhin
efcfa046ae Bump version in master to 2.2.0-alpha-dev
And according to f8d80a285cf941505277d9060d0357b5b7e543d2 ("Bump version
to 2.1.3-alpha-dev") numeric version have 1 at the end, since it means
"-dev".
2017-01-29 20:33:55 +03:00
Azat Khuzhin
9b63b5d410 Bump version to 2.1.8-stable everywhere
P.S. in referenced commit I made a mistake and instead of *-rc* I wrote
*-beta*.

See-also: f4489b8323cda0bf8eed7c1353911a852d7a947c ("Bump version to
2.1.7-beta everywhere")
2017-01-26 02:36:00 +03:00
Azat Khuzhin
f4489b8323 Bump version to 2.1.7-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-11-04 23:05:20 +03:00
Azat Khuzhin
40fbffc0df Fix cmake -DEVENT__COVERAGE=ON
- do not use compiler check from the root cmake rules with syntax error,
  let CodeCoverage check it
- fix CodeCoverage to check C compiler not CXX
- case insensitive checking of CMAKE_BUILD_TYPE
- replace flags with --coverage, and fix flags with linking with
  --coverate, otherwise it will not compile during checking flags and
  fails.
2016-11-02 11:36:24 +03:00
Azat Khuzhin
3453c0815f cmake: fix finding python2, and check that it is really 2
python version check removed in a4d044c0cd97f68b4b3dde414b83d609719d33d7
("cmake: use PYTHON_EXECUTABLE to find python2"), but in
bcb990ab7cf4921c2c30a1aa4fcb4c0131fffe94 ("cmake/win32: fix running
regress, but fixing finding python2 interpreter") we set
PYTHON_EXECUTABLE only if it exists.
2016-10-31 02:25:43 +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
bcb990ab7c cmake/win32: fix running regress, but fixing finding python2 interpreter
Could not find executable C:/projects/libevent/build/bin/regress
  Looked in the following places:
  C:/projects/libevent/build/bin/regress
  C:/projects/libevent/build/bin/regress.exe
  ...
   9/13 Test  #9: regress__WIN32_debug ................***Not Run   0.00 sec

Link: https://ci.appveyor.com/project/nmathewson/libevent/build/2.1.6.271/job/wvy2jp7uojcut5cx#L1256
Fixes: #411
2016-10-26 01:41:07 +03:00
Azat Khuzhin
a4d044c0cd cmake: use PYTHON_EXECUTABLE to find python2
Since most of the distros have symlinks for this.
2016-10-04 23:22:34 +03:00
Azat Khuzhin
91559607fd Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake
See-also: adc402ba5f0e15f4c77505852507f33b50f37ab6 ("Adding option to
ignore clock_gettime: --disable-clock-gettime")
2016-10-03 03:20:07 +03:00
Azat Khuzhin
51019e9460 Bump version to 2.1.6-beta everywhere
- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor
2016-08-27 01:28:36 +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
Azat Khuzhin
dc95823cd7 cmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections
Otherwise we will not detect next functions for instance:
- gethostbyname_r # and related

And now both autotools/cmake builds passes all regress tests in basic env (on
solaris of course).

Fixes: dns/client_fail_requests_getaddrinfo
2016-08-10 00:34:44 +03:00
Azat Khuzhin
050bfc7fc6 cmake/solaris: fix building (link with socket,nsl) 2016-08-10 00:17:01 +03:00
Azat Khuzhin
c4dfb93ff2 cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers 2016-08-09 15:47:58 +03:00
Azat Khuzhin
de0c1965ca cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON 2016-08-09 15:47:58 +03:00
Azat Khuzhin
ecb0ec821a cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
There is duplicated "evthread_win32.c" appending to ${SRC_CORE} list, leave
only one that under if EVENT__DISABLE_THREAD_SUPPORT

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.96/job/44q3rgifasny7gek
2016-08-09 15:47:58 +03:00
Azat Khuzhin
e35f22416a cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
Fixes: 8b228e27f57300be61b57a41a2ec8666b726dc34 ("Lot's of cmake updates")
2016-08-09 15:47:58 +03:00
Azat Khuzhin
38716c653d cmake: do not use stderr for notifications/version-info
For all except "STATUS" message() will write to stderr, and this also includes
case when you does not have <mode> at all. Plus for every message in stderr
powershell generates exception and make appveyor fails.

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.85/job/i10k7m0t80330mtr
2016-08-09 15:47:58 +03:00
Mark Ellzey
303161777d
[#372] check for errno.h 2016-06-28 10:37:24 -07:00
Azat Khuzhin
87f7238f33 cmake: require 3.1 only for win32 to make it work under ubunty precise
Also I [TRIED] wily but ubuntu can't upgrade transparently.

TRIED: https://travis-ci.org/azat/libevent/jobs/114924723
Fixes: https://travis-ci.org/libevent/libevent/jobs/114917275
2016-03-10 01:54:33 +03:00
Azat Khuzhin
c46ead5dc7 cmake: require at least 3.1 for target_sources() 2016-03-10 01:07:54 +03:00
Azat Khuzhin
36588e169d cmake: fix adding of compiler flags, and now it will
- add_compiler_flags() must accept array IOW just ARGN will be enoough
- add_compiler_flags() called with variable name instead of it's value

P.S. and fix some alignments issues
P.P.S. more cmake issues expected since now CFLAGS actually works
P.P.P.S. some issues with cmake cache is possible, so just reset it
2016-03-10 00:48:16 +03:00
Azat Khuzhin
f29f59e811 Replace -Wswitch-enum with -Wswitch, and add it into cmake rules too
According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html:
  -Wswitch-enum
  Warn whenever a switch statement has an index of enumerated type and lacks a
  case for one or more of the named codes of that enumeration. case labels
  outside the enumeration range also provoke warnings when this option is used.
  The only difference between -Wswitch and this option is that this option
  gives a warning about an omitted enumeration code even if there is a *default
  label*.
2016-03-10 00:48:09 +03:00