90 Commits

Author SHA1 Message Date
Azat Khuzhin
3375750ad7
Fix typo in cmake because of which EVENT__SIZEOF_SIZE_T was wrong
Fixes: #580
(cherry picked from commit 6e5c15d095d37036553d491b52d27fbbda08e7f2)
2019-02-02 15:13:55 +03:00
Andrey Okoshkin
7fa08c4b75
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.

(cherry picked from commit 6ee73ea9b0b15a9f4909c51e171b7799210ec26c)
2019-02-02 15:13:54 +03:00
lightningkay
4a2373eec0
cmake doesn't has POLICY CMP0054 in low version
(cherry picked from commit 3f19c5eb8335500ca6f0dd3b62c32d06103757d0)
2019-02-02 15:13:54 +03:00
Kiyoshi Aman
532a8cc301
Port event_rpcgen.py and test/check-dumpevents.py to Python 3.
These scripts remain compatible with Python 2.

(cherry picked from commit 8b0aa7b36a3250fad4953f194c8a94ab25032583)
2019-02-02 15:13:53 +03:00
Carlo Marcelo Arenas Belón
8983e5117b
test: fix 32bit linux regress
(cherry picked from commit 63c4bf78d6af3c6ff46d2e8e4b53dd9f577a9ca9)
2019-02-02 15:13:53 +03:00
Azat Khuzhin
6f74954017
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.

(cherry picked from commit 2773a5ed5e75540d43500e054581ea1fab2132ac)
2019-02-02 15:13:51 +03:00
Azat Khuzhin
3e69029008
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).

(cherry picked from commit 8b29b136793f3bfdb22fba117527763434363a3f)
2019-02-02 15:13:51 +03:00
Azat Khuzhin
d2a41a50a8
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.

(cherry picked from commit 346f8e17080f4649986e0d48176c0a0a5618ea98)
2019-02-02 15:13:51 +03:00
Azat Khuzhin
ebd12e6de7
Merge branch 'win32-fixes'
This patchset fixes win32 builds after some previous patches (referenced
in particular commits), and also removes some quirks for win32.

* win32-fixes:
  test: do not return void
  log/win32: fix exporting extern variable
  log-internal: missing extern "C"
  log: remove USE_GLOBAL_FOR_DEBUG_LOGGING
  cmake: Export missing symbols for win32
  cmake: eliminate EVENT_BUILDING_REGRESS_TEST, since we link with shared libs
  test: windows doesn't have WNOWAIT
  cmake: clean not used #defines from event-config.h
  cmake: add <pthread.h> only for non-win32

(cherry picked from commit d84f0205453941235b0e04729098d4329c189bba)
2019-02-02 15:13:49 +03:00
Azat Khuzhin
9806b12637
Merge branch 'cmake-missing-bits'
This patchset adds next missing things (in compare to autotools):
- pkgconfig
- event_pthreads/event_openssl
- compile shared/static libraries always

And some fixes, because it will not build after fixing other things:
- export missing symbols for cmake (-fvisibility=hidden)

* cmake-missing-bits:
  cmake: support visibility for AppleClang too
  cmake: fix export absolute path and relative path and cleanup a bit
  cmake: generate and install pkgconfig files
  cmake: build SHARED and STATIC libraries (like autoconf does)
  cmake: add missing event_openssl/event_pthreads libraries
  Export symbols for -fvisibility=hidden (under cmake)

Refs: #246
(cherry picked from commit 489991a2b2628ba1ff4e6879b9f67ec35d224c38)
2019-02-02 15:13:49 +03:00
Shuo Chen
e50af3315a
Fix detection of timerfd_create() in CMake.
(cherry picked from commit 65870949e7ce8110cb987cdeaa432c482cd9aabc)
2019-02-02 15:13:49 +03:00
Azat Khuzhin
cea61de609
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
(cherry picked from commit 819d04937729b7f8b7c84d6c5c40c5fcd6d68dfd)
2019-02-02 15:13:49 +03:00
Azat Khuzhin
a0bfe2c451
Merge branch 'cmake-configure-fixes-v2'
Fixes in cmake, to make it more like configure and support some
cross-compiling.

* cmake-configure-fixes-v2:
  cmake: fix extracting of the version from git (check for number of matches)
  Detect arch4random_addrandom() existence
  Use off_t instead of ev_off_t for sendfile() (fixes android build)
  cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE)
  Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
  cmake: add <pthread.h> into CMAKE_REQUIRED_INCLUDES for sizeof(pthread_t)
  cmake: fix values for #cmakedefine
  cmake: drop duplicates from event-config template
  cmake: add value for the #cmakedefine macros (like autoconf)
  cmake: Fix checking of enum values from sysctl.h

(cherry picked from commit 5aade2d30b6c5eff226cbf7b63fda5a01987ba4f)
2019-02-02 15:13:49 +03:00
Azat Khuzhin
e7bd9e0380
Merge branch 'fix-openssl-linking'
* fix-openssl-linking:
  sample/https-client: use ERR_remove_*state() when we have them
  Do not check for ERR_remove_thread_state() (do not link ssl into every library)

Closes: #476
(cherry picked from commit 98faf19895bd6aa41c68f7da050179e207f05ae1)
2019-02-02 15:13:49 +03:00
Trond Norbye
45b1f379d4
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)
(cherry picked from commit cc0e04d798643b76ce1874213cb6cc3b2c6b5ac4)
2019-02-02 15:13:48 +03:00
Azat Khuzhin
8567f2f56e
Merge branch 'fix-struct-linger'
@jbech
  "Accidentally disabled by 0dda56a due to confusion between struct
  linger vs. SO_LINGER and #define vs. AC_DEFINE. Try adding synthetic
  #error test to confirm."

* fix-struct-linger:
  cmake: check for 'struct linger' existence
  test/bench*: prefix event-config.h macros after 0dda56a48e94
  test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94

Fixes: #444 (original pull-request)
(cherry picked from commit 9d5a4bdc5cfbf2385efc7c58103161b3512c4500)
2019-02-02 15:13:48 +03:00
Azat Khuzhin
d9d11cb2e9
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.

(cherry picked from commit fe2c2622c389d7e9529b3c2fa828fb69cc985a1e)
2019-02-02 14:19:09 +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
Azat Khuzhin
a1609a87d7 cmake: fix building dns-example under win32 (missing getopt) 2016-01-14 11:58:39 +03:00
Azat Khuzhin
7707f6b03a cmake: Fix detection of ssize_t/SSIZE_T
Since ssize_it is POSIX, windows/VS also have this but with BaseTsd.h, plus the
logic prefers "ssize_t" (lower) instead of "SSIZE_T" (upper) when the latest
only available -- fix this too.

Refs: #311
2016-01-07 20:40:22 +03:00
Mark Ellzey
d56efd94b0 Fixed issue with cmake version generation 2015-12-21 17:43:00 -08:00
Mark Ellzey
7f9646d23a Cmake is now officially working.
Though I am currently breaking out things that seem to be repetitive, and a
cooler version macro and changelog updater.

More to come.
2015-12-21 04:36:24 -08:00
Mark Ellzey
49a53811a6 More cmake updates, lot's of missing definitions 2015-12-20 21:44:04 -08:00
Mark Ellzey
a9db46aec2 CMAKE CMAKE CMAKE CLEANUPS
It's almost useful.
2015-12-20 00:43:46 -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
Azat Khuzhin
cf2cf2a01a test: run regress with EVENT_DEBUG_MODE=1 and without
This could show some bugs like "event_assign called on an already added event",
and some others that debugging mode could track.
2015-09-02 19:38:30 +03:00
Azat Khuzhin
1d34498ea3 sample: add HTTP CONNECT tunnelling example using libevent http layer 2015-08-18 12:59:50 +03:00
Joakim Söderberg
19ba454317 This fixes a bug introduced in 27bd9faf498b91923296cc91643e03ec4055c230
CMake configuration files are intended to be used by other projects to find the library. Specifically the CMake find_package command can use it to find all files related to the project.

The idea is to support 2 different CMake configuration files for Libevent. One if you simply build libevent that is generated for the build tree.
And a second one that is generated for an install target that will be installed on the system and point to where on the system the lib files and such can be find.

So for instance, in the build tree the config would set the cmake variable `LIBEVENT_INCLUDE_DIRS` to `/path/to/libevent/build/include`.
And for the system config it would be set to `/usr/local/include` (or whatever target the user chose when running cmake).

27bd9faf498b91923296cc91643e03ec4055c230 changed this behavior so that both configs would point to the system wide path `/usr/local/include`

This meant that projects just wanting to import directly for the build tree would fail.
2015-02-05 17:34:50 +01:00