127 Commits

Author SHA1 Message Date
Azat Khuzhin
2db851a980 cmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined
This will allow overriding them in parent cmake rules, i.e. if libevent
is used via add_subdirectory().

Closes: #931
(cherry picked from commit 8f13c170cf6e9a02dec410b967884ec5e08947ab)
2020-06-28 21:19:54 +03:00
yuangongji
1c047618ba cmake: improve package config file
(cherry picked from commit dc4be869d5009f38e0ef02ff07dd799f9c2fef2f)
2020-06-28 21:19:54 +03:00
Philip Homburg
f602211fa1 Parse IPv6 scope IDs.
(cherry picked from commit 9fecb59a94ef246088d7f3e0365c2fe80d0df2f4)
2020-06-28 21:19:54 +03:00
yuangongji
a9d1121d16 cmake: eliminate duplicate installation of public headers
(cherry picked from commit 5fe83d7433022e29a401753f64ec78faaf25e0a7)
2020-06-28 21:17:33 +03:00
Michael Davidsaver
87c6f7358e append to CMAKE_MODULE_PATH
Don't override any -DCMAKE_MODULE_PATH= passed from CLI
to eg. test custom Platform/ support.

(cherry picked from commit 84affc1837a727640f46eff2723c1364d2cd1695)
2020-06-28 21:17:33 +03:00
Azat Khuzhin
d2871a37bf Do not use sysctl.h on linux (it had been deprecated)
It had been deprecated for a long time (AFAIK), but since
glibc-2.29.9000-309-g744e829637 it produces a #warning

(cherry picked from commit b9b9f19058dc04b7ad4d079a38f6b86c0e7b1072)
2020-06-28 21:17:33 +03:00
William A Rowe Jr
50b9be003c Avoid transforming base C_FLAGS set deliberately
The CMAKE_C_FLAGS_DEBUG, CMAKE_C_FLAGS_RELEASE, CMAKE_C_FLAGS_MINSIZEREL
and CMAKE_C_FLAGS_RELWITHDEBINFO options are correctly and deliberately
toggled to use the libcmt (/MT) flag options in place of the usual
msvcrt (/MD) options, but this isn't necessarily desired by the user.
The default choice can be overriden with the EVENT__MSVC_STATIC_RUNTIME
cmake option.

However, the /MD flag that is the choice of CMake only enters into
play for the four types of builds above. If the user introduces another
CMAKE_BUILD_TYPE, the base CMAKE_C_FLAGS must not be manipulated, as
that value (and the CMAKE_C_FLAGS_{custom} value) have been explicitly
chosen by the user/developer deploying this library, and the mismatch
between these flags in different dependencies results in link errors.

The CMake build schema itself doesn't place an /MD flag in CMAKE_BUILD_TYPE
so any /M compile option in that variable needs to be retained.

Signed-off-by: William Rowe <wrowe@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
(cherry picked from commit af4b07a55cc0ff0298cbd26c87b3f6a08f84c394)
2020-06-28 21:17:33 +03:00
yuangongji
f4a6152c3b evutil_time: detect and use _gmtime64_s()/_gmtime64()
(cherry picked from commit 148d12ad31b03a813f4ffd9df14a85392aa74130)
2020-06-28 21:17:33 +03:00
yuangongji
e9478640b2 https-client: load certificates from the system cert store on Windows
(cherry picked from commit 572a565130d40172e1f2b5ac83d0cdffd502105b)
2020-06-28 21:17:33 +03:00
Azat Khuzhin
66ec78fddb 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
(cherry picked from commit 86f55b0420f864b518475f781ce7a3c619180b12)
2020-06-28 21:17:32 +03:00
yuangongji
7a85300ab0 cmake: attach doxygen target into all target
v2: Disable non-html generator for doxygen by default
v3: convert cmake option to doxygen config
(cherry picked from commit 1d1c19091f13b7e19015698a23f454aa85f17ac3)
2020-06-28 21:16:14 +03:00
Azat Khuzhin
5b723a66b4
Bump version to 2.1.11-stable (with ABI breakage) 2019-08-02 00:26:20 +03:00
yuangongji
305251b9ce
cmake: set library names to be the same as with autotools
libtool has VERSION_INFO [1], cmake has SOVERSION/VERSION instead
(although it has different format). Also libtool has RELEASE [2] while
cmake do not have analog yet [3], hence manual symlinks should be
created.

  [1]: https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
  [2]: https://www.gnu.org/software/libtool/manual/html_node/Release-numbers.html
  [3]: https://gitlab.kitware.com/cmake/cmake/issues/17652

Plus osx has compatibility_version/current_version dylib properties and
cmake do not have separate properties for them [4], hence manual LINK_FLAGS.
And also there INSTALL_NAME_DIR property which should be adjusted too.

  [4]: https://public.kitware.com/Bug/view.php?id=4383

So after all changes, here is an example before/after for osx and linux:

  # osx
    # autotools
    .libs/libevent_pthreads-2.2.1.dylib
    .libs/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib
    /usr/local/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0)
    # cmake
      # before patch
      lib/libevent_pthreads.2.2.0.dylib
      lib/libevent_pthreads.dylib -> libevent_pthreads.2.2.0.dylib
      @rpath/libevent_pthreads.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0)
      # after patch
      lib/libevent_pthreads-2.2.1.dylib
      lib/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib
      /vagrant/.cmake/inst/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0)

  # linux
    # autotools
    .libs/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0
    .libs/libevent_pthreads-2.2.so.1.0.0
    .libs/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0
    # cmake
      # before patch
      lib/libevent_pthreads.so -> libevent_pthreads.so.2.2.0
      lib/libevent_pthreads.so.2.2.0
      # after patch
      lib/libevent_pthreads-2.2.so -> libevent_pthreads-2.2.so.1
      lib/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0
      lib/libevent_pthreads-2.2.so.1.0.0
      lib/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0

Closes: #838 (cherry-picked)
Closes: #760
(cherry picked from commit 669a53f341e192657140952cfe025c260da2b1c1)
2019-08-02 00:08:41 +03:00
Keith Smiley
f013fc7dde
Enable _GNU_SOURCE for Android
When targeting the Android NDK _GNU_SOURCE is not enabled by default:

```
 /*
  * With bionic, you always get all C and POSIX API.
  *
  * If you want BSD and/or GNU extensions, _BSD_SOURCE and/or _GNU_SOURCE are
  * expected to be defined by callers before *any* standard header file is
  * included.
  *
  * In our header files we test against __USE_BSD and __USE_GNU.
  */
 #if defined(_GNU_SOURCE)
 #  define __USE_BSD 1
 #  define __USE_GNU 1
 #endif
```

Because of this `pipe2` is not available:

```
 #if defined(__USE_GNU)
 int pipe2(int __fds[2], int __flags) __INTRODUCED_IN(9);
 #endif
```

The function used to check if it does exist:

```
CHECK_FUNCTION_EXISTS_EX(pipe2 EVENT__HAVE_PIPE2)
```

Just check that the _linking_ succeeds, which it does, it's just not
visible in the import, leading to a warning (or error):

```
evutil.c:2637:6: error: implicit declaration of function 'pipe2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if (pipe2(fd, O_NONBLOCK|O_CLOEXEC) == 0)
            ^
```

When targeting the NDK it should be safe to always opt into this. Clang
would pass the right flag for us automatically _if_ the source was C++
instead of C.

(cherry picked from commit 41c95abb9930b0c13c238e110b857acb810ad7b9)
2019-08-02 00:08:41 +03:00
Keith Smiley
3aa68a82dc
Enable kqueue for APPLE targets
The CMAKE_CROSSCOMPILING variable is not set for Apple targets seemingly
because of cmake implementation details (more info
https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html).
Since Apple targets have working kqueue implementations this check makes
sure we enable it always when those are the targets, without users
having to explicitly set EVENT__HAVE_WORKING_KQUEUE

(cherry picked from commit 0d7d85c2083f7a4c9efe01c061486f332b576d28)
2019-08-02 00:08:41 +03:00
Azat Khuzhin
c9ce638c84
cmake: link against shell32.lib/advapi32.lib
Fixes: #844
Refs: #760 (cmake-vs-autotools)
(cherry picked from commit 69466cde0382ab3df12e3a011720f87af3998081)
2019-08-02 00:08:40 +03:00
yuangongji
2d65071c3a
cmake: add missing autotools targets (doxygen, uninstall, event_rpcgen.py)
Close: #832 (cherry-picked)
(cherry picked from commit 7201062f3ef505a77baa6ccaf1cf73812462308a)
2019-08-02 00:05:49 +03:00
Azat Khuzhin
f5bfd721d1
Bump version to 2.1.10-stable everywhere 2019-05-25 23:45:37 +03:00
Azat Khuzhin
3da21a9491
cmake: add -Wmissing-prototypes (like autotools has)
(cherry picked from commit 49a367e6cfb9b9bc8d1b04cbfb834ec3e0c1d84d)
2019-05-25 21:25:33 +03:00
Azat Khuzhin
7c4da93715
Merge branch 'issue-807-accept4-getnameinfo-AF_UNIX'
* issue-807-accept4-getnameinfo-AF_UNIX:
  http-server: add usage/help dialog
  http: avoid use of uninitialized value for AF_UNIX/AF_LOCAL sockaddr
  http-server: add ability to bind to unix-socket
  build: struct sockaddr_un detection (sys/un.h, afunix.h)

Fixes: #807
(cherry picked from commit 76eded24d3b0c3fc48c5a888906cc9043223101b)
2019-05-25 21:25:13 +03:00
Azat Khuzhin
b062bf0af7
cmake: sync warnings with autotools v2
By some reason gcc reports next error:
  ../http.c:3330:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       value = "";

Only under -Wwrite-strings, well this is logical, but this information
does not reflected in any documentation.

Follow-up: 8348b413 ("cmake: add various warning flags like autotools has")

f

(cherry picked from commit 42d5a36bd8076c137545759d34500401627a649b)
2019-05-25 21:25:10 +03:00
Enji Cooper
00ba9fa299
Define _GNU_SOURCE properly/consistently per autoconf
Although `_GNU_SOURCE` can be defined as an arbitrary #define per the
glibc docs [1], it's best to define it in a manner consistent with the way
that autoconf defines it, i.e., `1`.

While this shouldn't matter in most cases, it does when the headers from
other projects follow the poorly defined GNU convention implemented by
autoconf and are included after the libevent's util.h header. An example
failure with clang, similar to the failure I encountered, is as follows:
```
$ printf "#define _GNU_SOURCE\n#define _GNU_SOURCE 1" | clang -c -x c -
<stdin>:2:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
        ^
<stdin>:1:9: note: previous definition is here
        ^
1 warning generated.
```

This happened when compiling python [2] with a stale homebrew util.h file from
libevent (which admittedly would not happen in a correct libevent install, as the
header should be installed under /usr/local/include/event2/util.h). However, if
both headers had been combined (which is more likely), it would have failed as
shown above.

Removing the ad hoc definition unbreaks compiling python's pyconfig.h.in header
when included after util.h from libevent.

1. http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
2. https://github.com/python/cpython/blob/master/configure.ac#L126

Closes: #773 (cherry-picked)

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
(cherry picked from commit 5f87be42f0ae0126938624a1419a572607078217)
2019-05-25 21:25:09 +03:00
Azat Khuzhin
900f5c4503
Bump version to 2.1.9-beta everywhere 2019-02-10 16:22:56 +03:00
Azat Khuzhin
7f16190227
cmake: fix checking of devpoll backend (like in autotools, by devpoll.h existence)
(cherry picked from commit 8e87de3c24cad940516f49aa0466cfe53fa042bf)
2019-02-10 14:33:57 +03:00
Azat Khuzhin
c8b3ec1711
cmake: support static runtime (MSVC)
Fixes: #737
(cherry picked from commit 246f44041e0782f728fa5ff2d39113005a1ab02d)
2019-02-02 15:18:06 +03:00
Fredrik Strupe
c264028cd3
cmake: Fix some typos in option descriptions
(cherry picked from commit f33c2ce5f89bc334230867f37d07dbfd5e3921bd)
2019-02-02 15:18:06 +03:00
Azat Khuzhin
bc7f2fd9f2
cmake: do not build both (SHARED and STATIC) for MSVC/win32
MSVC does not support SHARED and STATIC libraries with the same name,
so let's just build SHARED libraries by default instead (yes we can add
prefix but let's stick with this).

The reason for this is that in windows shared libraries requires .lib
file too, but this is not static library it is imported library for
shared (doh...), for more info [1] and [2].

  [1]: https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-creation
  [2]: https://blogs.msdn.microsoft.com/oldnewthing/20091013-00/?p=16403

And when we build both static library can and will override shared
library imported part, let's take a look at event_extra.lib:

- before patch [3]:
  $ less libevent-fail/lib/Debug/event_extra.lib | head
  ==> use library:contained_file to view a file in the archive
  rw-rw-rw- 100666/100666  59568 Nov 21 23:55 2018 event_extra_static.dir/Debug/evrpc.obj
  rw-rw-rw- 100666/100666 252219 Nov 21 23:55 2018 event_extra_static.dir/Debug/evdns.obj
  rw-rw-rw- 100666/100666 203850 Nov 21 23:55 2018 event_extra_static.dir/Debug/http.obj
  rw-rw-rw- 100666/100666  25907 Nov 21 23:55 2018 event_extra_static.dir/Debug/event_tagging.obj

  [3]: https://ci.appveyor.com/project/azat/libevent/builds/20472024/job/t0o93v042jai0dj7

- "after patch" [4] (not after but the same effect):
  $ less libevent-ok/lib/Debug/event_extra.lib | head
  ==> use library:contained_file to view a file in the archive
  --------- 0/0    509 Nov 21 23:38 2018 event_extra.dll
  ...

  [4]: https://ci.appveyor.com/project/azat/libevent/builds/20478998/job/ca9k3c76amc4qr76

Refs: #691
(cherry picked from commit 90d80ef4167d97b11e01e80fcc4eaa447712e92f)
2019-02-02 15:18:05 +03:00
Azat Khuzhin
eb10a7387c
cmake: introduce EVENT__LIBRARY_TYPE option
Long time ago in [1] cmake build was forced to compile both libraries
(SHARED and STATIC), since this is how our autotools build works.

  [1]: 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED and STATIC libraries (like autoconf does)")

And there is no way to configure this (and indeed you need to do this
for MSVC for example), so let's introduce option for this --
EVENT__LIBRARY_TYPE.

Plus now we have INTERFACE libraries, that we can use internally in
libevent's cmake rules to avoid strict to _shared/_static variant of the
libraries to link with samples/tests (we prefer SHARED over STATIC for
linking).

Also bump minimal cmake required version to 3.1 by the following
reasons:
- 3.1 is required for RPATH configuration under APPLE
- 3.0 is required for add_library(INTERFACE) (did not found it in 2.8.x
documentation)
- remove extra conditions
(anyway 3.1 was release 4 years ago, so I guess that most of the systems
will have it)

(cherry picked from commit c9a073eae8f86a74fbbb125db34b881ef40108b7)
2019-02-02 15:18:05 +03:00
Azat Khuzhin
a28c83464c
cmake: drop redundant add_dependencies()
(cherry picked from commit d705e8c0e924d3b815697a075c27a36298f04078)
2019-02-02 15:18:05 +03:00
Azat Khuzhin
b6309bccfc
Merge branch 'sample-http-server'
Some improvements for http-server sample:
- getopt
- persistent port via -p option
- IOCP for win32 via -I
- disable buffering
- enable debug logging via -v/EVENT_DEBUG_LOGGING_ALL
- cleanup (by signal and separate error path on errors)

* sample-http-server:
  s/http-server: graceful cleanup
  s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset
  s/http-server: turn off buffering (otherwise do output on win32)
  s/http-server: add an option to use IOCP
  s/http-server: add options (for persistent port)

Refs: #709
(cherry picked from commit 9a4b8ec1b64fab27544f154076261afdf1efac07)
2019-02-02 15:18:03 +03:00
Azat Khuzhin
5e5de36f85
cmake: set CMP0075 to NEW (for ws2_32.lib in win32)
Otherwise cmake complains:
  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:
    ws2_32.lib

  For compatibility with CMake 3.11 and below this check is ignoring it.

(cherry picked from commit 6d3a53966bc822fd580a6a02301838aca601391b)
2019-02-02 15:18:03 +03:00
Azat Khuzhin
3d3d1e0530
cmake: set CMP0074 to NEW (for OPENSSL_ROOT in appveyor)
We have $env:OPENSSL_ROOT (env) equals to -DOPENSSL_ROOT (cmake
variable) anyway.

cmake complains:
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable OpenSSL_ROOT is set to:
    C:/OpenSSL-Win64/bin

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

(cherry picked from commit 65904773f2bf965e2050d4d7c91e30d4f123a787)
2019-02-02 15:18:03 +03:00
Azat Khuzhin
b52c649875
cmake: do not detect _GNU_SOURCE/__GNU_LIBRARY__ if it is cached
(cherry picked from commit 3ed93997387296e374d8a2dd770e43ddfa3328e9)
2019-02-02 15:18:02 +03:00
Azat Khuzhin
acf4821d7c
cmake: add various warning flags like autotools has
This is mostly to match autotools and reduce amount mixiing declarations
and code.

Added:
- -Wextra (the same as -W), -Wno-unused-parameter -Wstrict-aliasing
- -fno-strict-aliasing (gcc 2.9.5+)
- -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement (4.0+)
- -Waddress -Wno-unused-function -Wnormalized=id -Woverride-init (4.2+)
- -Wlogical-op (4.5+)

Removed:
- -Wformat (include in -Wall)

Plus use CMAKE_C_COMPILER_ID over CMAKE_COMPILER_IS_GNUCC, as
cmake-variables(7) suggesting, and add common GNUC/CLANG variables.

v2: drop checks for flags, since add_compiler_flags() will check if such
flags exists anyway (but just to note, gcc ignores non existing warning
flags by default).

(cherry picked from commit 8348b41308a7126d009bb6e0b33aa5f465e1dc33)
2019-02-02 15:18:00 +03:00
Azat Khuzhin
2594a96ff6
Add -fdiagnostics-color=always for Ninja
(cherry picked from commit cec4a37120b7fe07525018e4415db8adcfba9299)
2019-02-02 15:17:59 +03:00
Azat Khuzhin
b3af7bdde3
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
(cherry picked from commit e85818d24850540d220e6d7bc0a30653ba2135f2)
2019-02-02 15:17:58 +03:00
Philip Prindeville
8ab60087c3
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>
(cherry picked from commit 755896efe25e5caecd498c08cce072c713720783)
2019-02-02 15:17:57 +03:00
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