Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 2023 15:16:09 GMT
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b4d6d81dd112 - stable/13 - libevent: Import libevent 2.1.12
Message-ID:  <202311281516.3ASFG9ZV094531@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=b4d6d81dd112b3c537e755c5ccf19268f6c16d9e

commit b4d6d81dd112b3c537e755c5ccf19268f6c16d9e
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-11-14 23:04:28 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-11-28 15:15:54 +0000

    libevent: Import libevent 2.1.12
    
    Merge commit '5223d1d95fddcef6f9a36e264a5800bd907ade8b' into main
    
    (cherry picked from commit b50261e21f39a6c7249a49e7b60aa878c98512a8)
---
 contrib/libevent/CMakeLists.txt                    | 1575 +++++++++
 contrib/libevent/ChangeLog                         |  313 ++
 contrib/libevent/ChangeLog-1.4                     |    2 +-
 contrib/libevent/ChangeLog-2.0                     |    2 +-
 contrib/libevent/Doxyfile                          |   46 +-
 contrib/libevent/Makefile.am                       |   67 +-
 contrib/libevent/Makefile.in                       | 1486 ++++++---
 contrib/libevent/README.md                         |  487 +++
 contrib/libevent/WIN32-Code/getopt.c               |  149 +
 contrib/libevent/WIN32-Code/getopt.h               |   33 +
 contrib/libevent/WIN32-Code/getopt_long.c          |  234 ++
 .../WIN32-Code/nmake/event2/event-config.h         |   26 +-
 contrib/libevent/aclocal.m4                        |  193 +-
 contrib/libevent/arc4random.c                      |   40 +-
 contrib/libevent/buffer.c                          |   50 +-
 contrib/libevent/buffer_iocp.c                     |    1 +
 contrib/libevent/bufferevent-internal.h            |   36 +
 contrib/libevent/bufferevent.c                     |  115 +-
 contrib/libevent/bufferevent_async.c               |   66 +-
 contrib/libevent/bufferevent_filter.c              |   10 +-
 contrib/libevent/bufferevent_openssl.c             |   75 +-
 contrib/libevent/bufferevent_pair.c                |    4 +-
 contrib/libevent/bufferevent_ratelim.c             |    9 +-
 contrib/libevent/bufferevent_sock.c                |   74 +-
 contrib/libevent/{ => build-aux}/compile           |   17 +-
 contrib/libevent/{ => build-aux}/config.guess      |  970 +++---
 contrib/libevent/build-aux/config.sub              | 1793 +++++++++++
 contrib/libevent/{ => build-aux}/depcomp           |   10 +-
 contrib/libevent/{ => build-aux}/install-sh        |   60 +-
 contrib/libevent/{ => build-aux}/ltmain.sh         |  766 +++--
 contrib/libevent/{ => build-aux}/missing           |   16 +-
 contrib/libevent/{ => build-aux}/test-driver       |   10 +-
 contrib/libevent/cmake/AddCompilerFlags.cmake      |   13 +
 contrib/libevent/cmake/AddEventLibrary.cmake       |  193 ++
 contrib/libevent/cmake/COPYING-CMAKE-SCRIPTS       |   22 +
 contrib/libevent/cmake/CheckConstExists.cmake      |   25 +
 contrib/libevent/cmake/CheckFileOffsetBits.c       |   14 +
 contrib/libevent/cmake/CheckFileOffsetBits.cmake   |   43 +
 contrib/libevent/cmake/CheckFunctionKeywords.cmake |   14 +
 .../libevent/cmake/CheckPrototypeDefinition.c.in   |   29 +
 .../libevent/cmake/CheckPrototypeDefinition.cmake  |   82 +
 contrib/libevent/cmake/CheckWorkingKqueue.cmake    |   52 +
 contrib/libevent/cmake/CodeCoverage.cmake          |  165 +
 contrib/libevent/cmake/Copyright.txt               |   57 +
 contrib/libevent/cmake/LibeventConfig.cmake.in     |  183 ++
 .../libevent/cmake/LibeventConfigVersion.cmake.in  |   11 +
 contrib/libevent/cmake/Macros.cmake                |   36 +
 contrib/libevent/cmake/Uninstall.cmake.in          |   23 +
 contrib/libevent/cmake/UseDoxygen.cmake            |  111 +
 contrib/libevent/cmake/VersionViaGit.cmake         |   66 +
 contrib/libevent/config.h.in                       |   63 +-
 contrib/libevent/config.sub                        | 1807 -----------
 contrib/libevent/configure                         | 3390 +++++++++++++++++---
 contrib/libevent/configure.ac                      |  328 +-
 contrib/libevent/defer-internal.h                  |    3 +
 contrib/libevent/doxygen.am                        |   55 +
 contrib/libevent/epoll.c                           |   15 +-
 contrib/libevent/epolltable-internal.h             |    2 +-
 contrib/libevent/evbuffer-internal.h               |    2 +-
 contrib/libevent/evconfig-private.h.cmake          |   40 +
 contrib/libevent/evconfig-private.h.in             |    7 +
 contrib/libevent/evdns.c                           |  144 +-
 contrib/libevent/event-config.h.cmake              |  513 +++
 contrib/libevent/event-internal.h                  |   13 +-
 contrib/libevent/event.c                           |  392 ++-
 contrib/libevent/event_iocp.c                      |    2 +-
 contrib/libevent/event_rpcgen.py                   | 2057 ++++++------
 contrib/libevent/event_tagging.c                   |    4 +
 contrib/libevent/evmap.c                           |   43 +-
 contrib/libevent/evrpc.c                           |    6 +-
 contrib/libevent/evthread-internal.h               |   16 +-
 contrib/libevent/evthread.c                        |    2 +-
 contrib/libevent/evutil.c                          |  144 +-
 contrib/libevent/evutil_rand.c                     |    6 +-
 contrib/libevent/evutil_time.c                     |   65 +-
 contrib/libevent/http-internal.h                   |    9 +-
 contrib/libevent/http.c                            |  254 +-
 contrib/libevent/include/event2/buffer.h           |    3 +-
 contrib/libevent/include/event2/buffer_compat.h    |    3 +-
 contrib/libevent/include/event2/bufferevent.h      |   11 +-
 .../libevent/include/event2/bufferevent_compat.h   |    4 +
 contrib/libevent/include/event2/dns.h              |   46 +-
 contrib/libevent/include/event2/dns_compat.h       |   24 +-
 contrib/libevent/include/event2/event.h            |   77 +-
 contrib/libevent/include/event2/http.h             |   13 +-
 contrib/libevent/include/event2/http_compat.h      |    6 +-
 contrib/libevent/include/event2/listener.h         |   12 +
 contrib/libevent/include/event2/rpc.h              |   48 +-
 contrib/libevent/include/event2/rpc_struct.h       |   14 +
 contrib/libevent/include/event2/util.h             |   34 +-
 contrib/libevent/include/event2/visibility.h       |   31 +-
 contrib/libevent/include/include.am                |    7 +-
 contrib/libevent/iocp-internal.h                   |   14 +
 contrib/libevent/kqueue.c                          |   17 +-
 contrib/libevent/listener.c                        |   29 +-
 contrib/libevent/log-internal.h                    |   25 +-
 contrib/libevent/log.c                             |   11 +-
 contrib/libevent/m4/ax_check_funcs_ex.m4           |   22 +
 contrib/libevent/m4/ax_prog_doxygen.m4             |  600 ++++
 contrib/libevent/m4/libevent_openssl.m4            |    9 +
 contrib/libevent/m4/libtool.m4                     |  102 +-
 contrib/libevent/m4/ltoptions.m4                   |    2 +-
 contrib/libevent/m4/ltsugar.m4                     |    2 +-
 contrib/libevent/m4/ltversion.m4                   |   12 +-
 contrib/libevent/m4/lt~obsolete.m4                 |    2 +-
 contrib/libevent/make-event-config.sed             |   10 +-
 contrib/libevent/minheap-internal.h                |    6 +-
 contrib/libevent/mm-internal.h                     |    5 +
 contrib/libevent/openssl-compat.h                  |   16 +-
 contrib/libevent/poll.c                            |   25 +-
 contrib/libevent/sample/dns-example.c              |   17 +-
 contrib/libevent/sample/event-read-fifo.c          |    4 +-
 contrib/libevent/sample/hello-world.c              |    3 +-
 contrib/libevent/sample/http-connect.c             |   86 +-
 contrib/libevent/sample/http-server.c              |  292 +-
 contrib/libevent/sample/https-client.c             |   88 +-
 contrib/libevent/sample/include.am                 |   11 +-
 contrib/libevent/sample/le-proxy.c                 |   16 +-
 .../libevent/sample/openssl_hostname_validation.c  |    3 +-
 contrib/libevent/sample/signal-test.c              |   25 +-
 contrib/libevent/sample/time-test.c                |    7 +-
 contrib/libevent/select.c                          |    2 +-
 contrib/libevent/signal.c                          |    2 +
 contrib/libevent/strlcpy-internal.h                |    2 +
 contrib/libevent/test/bench.c                      |   60 +-
 contrib/libevent/test/bench_cascade.c              |    8 +-
 contrib/libevent/test/bench_http.c                 |    3 +
 contrib/libevent/test/bench_httpclient.c           |    4 +-
 contrib/libevent/test/check-dumpevents.py          |   10 +-
 contrib/libevent/test/include.am                   |   43 +-
 contrib/libevent/test/print-winsock-errors.c       |   86 +
 contrib/libevent/test/regress.c                    |  332 +-
 contrib/libevent/test/regress.gen.c                |  105 +-
 contrib/libevent/test/regress.gen.h                |   11 +-
 contrib/libevent/test/regress.h                    |    7 +-
 contrib/libevent/test/regress_buffer.c             |  369 ++-
 contrib/libevent/test/regress_bufferevent.c        |  156 +-
 contrib/libevent/test/regress_dns.c                |  522 ++-
 contrib/libevent/test/regress_et.c                 |  146 +-
 contrib/libevent/test/regress_finalize.c           |   48 +
 contrib/libevent/test/regress_http.c               |  479 ++-
 contrib/libevent/test/regress_listener.c           |  100 +-
 contrib/libevent/test/regress_main.c               |   68 +-
 contrib/libevent/test/regress_rpc.c                |   49 +-
 contrib/libevent/test/regress_ssl.c                |  404 ++-
 contrib/libevent/test/regress_testutils.c          |    2 +-
 contrib/libevent/test/regress_thread.c             |    8 +-
 contrib/libevent/test/regress_thread.h             |   34 +-
 contrib/libevent/test/regress_util.c               |  196 +-
 contrib/libevent/test/rpcgen_wrapper.sh            |   11 +-
 contrib/libevent/test/test-changelist.c            |    4 +-
 contrib/libevent/test/test-closed.c                |    1 +
 contrib/libevent/test/test-eof.c                   |    4 +-
 contrib/libevent/test/test-fdleak.c                |   15 +-
 contrib/libevent/test/test-init.c                  |    2 +-
 contrib/libevent/test/test-ratelim.c               |   87 +-
 contrib/libevent/test/test-time.c                  |   25 +-
 contrib/libevent/test/test-weof.c                  |    4 +-
 contrib/libevent/test/test.sh                      |    4 +-
 contrib/libevent/test/tinytest.c                   |  169 +-
 contrib/libevent/test/tinytest.h                   |    5 +-
 contrib/libevent/test/tinytest_macros.h            |   12 +-
 contrib/libevent/time-internal.h                   |    3 +
 contrib/libevent/util-internal.h                   |   72 +-
 contrib/libevent/win32select.c                     |    3 +-
 165 files changed, 18349 insertions(+), 6378 deletions(-)

diff --git a/contrib/libevent/CMakeLists.txt b/contrib/libevent/CMakeLists.txt
new file mode 100644
index 000000000000..676727f16563
--- /dev/null
+++ b/contrib/libevent/CMakeLists.txt
@@ -0,0 +1,1575 @@
+#
+# Libevent CMake project
+#
+# Based on initial work by:
+#    Alexey Ozeritsky
+#
+# Additional changes:
+#   Brodie Thiesfield
+#   Joakim Soderberg
+#   Trond Norbye
+#   Sergei Nikulov
+#
+#   Build example:
+#
+#       cd libevent
+#       md build
+#       cd build
+#       cmake -G "Visual Studio 10" ..
+#       start libevent.sln
+#
+
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+if (POLICY CMP0054)
+    cmake_policy(SET CMP0054 NEW)
+endif()
+if (POLICY CMP0074)
+    cmake_policy(SET CMP0074 NEW)
+endif()
+if (POLICY CMP0075)
+    cmake_policy(SET CMP0075 NEW)
+endif()
+
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE Release
+        CACHE STRING "Set build type to Debug o Release (default Release)" FORCE)
+endif()
+string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+
+# get rid of the extra default configurations
+# what? why would you get id of other useful build types? - Ellzey
+set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Limited configurations" FORCE)
+
+set(EVENT__LIBRARY_TYPE DEFAULT CACHE STRING
+    "Set library type to SHARED/STATIC/BOTH (default SHARED for MSVC, otherwise BOTH)")
+
+project(libevent C)
+
+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
+string(REGEX MATCH "SunOS" SOLARIS "${CMAKE_SYSTEM_NAME}")
+
+
+include(CheckTypeSize)
+include(CheckFileOffsetBits)
+include(Macros)
+include(CheckVariableExists)
+include(CheckSymbolExists)
+include(CheckStructHasMember)
+include(CheckCSourceCompiles)
+include(CheckPrototypeDefinition)
+include(CheckFunctionKeywords)
+include(CheckConstExists)
+include(AddCompilerFlags)
+include(VersionViaGit)
+
+event_fuzzy_version_from_git()
+
+set(EVENT_VERSION_MAJOR ${EVENT_GIT___VERSION_MAJOR})
+set(EVENT_VERSION_MINOR ${EVENT_GIT___VERSION_MINOR})
+set(EVENT_VERSION_PATCH ${EVENT_GIT___VERSION_PATCH})
+set(EVENT_VERSION_STAGE ${EVENT_GIT___VERSION_STAGE})
+
+
+set(EVENT_ABI_MAJOR ${EVENT_VERSION_MAJOR})
+set(EVENT_ABI_MINOR ${EVENT_VERSION_MINOR})
+set(EVENT_ABI_PATCH ${EVENT_VERSION_PATCH})
+
+set(EVENT_ABI_LIBVERSION
+    "${EVENT_ABI_MAJOR}.${EVENT_ABI_MINOR}.${EVENT_ABI_PATCH}")
+
+set(EVENT_PACKAGE_VERSION
+    "${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}")
+
+set(EVENT_NUMERIC_VERSION 0x02010c00)
+# equals to VERSION_INFO in Makefile.am
+set(EVENT_ABI_LIBVERSION_CURRENT   7)
+set(EVENT_ABI_LIBVERSION_REVISION  1)
+set(EVENT_ABI_LIBVERSION_AGE       0)
+
+# equals to RELEASE in Makefile.am
+set(EVENT_PACKAGE_RELEASE 2.1)
+
+# only a subset of names can be used, defaults to "beta"
+set(EVENT_STAGE_NAME ${EVENT_VERSION_STAGE})
+
+# a list that defines what can set for EVENT_STAGE_VERSION
+set(EVENT__ALLOWED_STAGE_NAMES
+	rc
+	beta
+	alpha
+	alpha-dev
+	release
+	stable
+)
+list(
+	FIND EVENT__ALLOWED_STAGE_NAMES
+	"${EVENT_STAGE_NAME}"
+	EVENT__STAGE_RET
+)
+if (EVENT__STAGE_RET EQUAL -1)
+	message(WARNING
+		"stage ${EVENT_STAGE_NAME} is not allowed, reset to beta")
+	set(EVENT_STAGE_NAME beta)
+endif()
+
+set(EVENT_VERSION
+	"${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}-${EVENT_STAGE_NAME}")
+
+option(EVENT__DISABLE_DEBUG_MODE
+    "Define if libevent should build without support for a debug mode" OFF)
+
+option(EVENT__ENABLE_VERBOSE_DEBUG
+    "Enables verbose debugging" OFF)
+
+option(EVENT__DISABLE_MM_REPLACEMENT
+    "Define if libevent should not allow replacing the mm functions" OFF)
+
+option(EVENT__DISABLE_THREAD_SUPPORT
+    "Define if libevent should not be compiled with thread support" OFF)
+
+option(EVENT__DISABLE_OPENSSL
+    "Define if libevent should build without support for OpenSSL encryption" OFF)
+
+option(EVENT__DISABLE_BENCHMARK
+    "Defines if libevent should build without the benchmark executables" OFF)
+
+option(EVENT__DISABLE_TESTS
+    "If tests should be compiled or not" OFF)
+
+option(EVENT__DISABLE_REGRESS
+    "Disable the regress tests" OFF)
+
+option(EVENT__DISABLE_SAMPLES
+    "Disable sample files" OFF)
+
+option(EVENT__DISABLE_CLOCK_GETTIME
+    "Do not use clock_gettime even if it is available" OFF)
+
+option(EVENT__FORCE_KQUEUE_CHECK
+    "When crosscompiling forces running a test program that verifies that Kqueue works with pipes. Note that this requires you to manually run the test program on the cross compilation target to verify that it works. See cmake documentation for try_run for more details" OFF)
+
+# TODO: Add --disable-largefile     omit support for large files
+option(EVENT__COVERAGE
+"Enable running gcov to get a test coverage report (only works with GCC/CLang). Make sure to enable -DCMAKE_BUILD_TYPE=Debug as well." OFF)
+
+# Put the libaries and binaries that get built into directories at the
+# top of the build tree rather than in hard-to-find leaf directories.
+#
+# But only if this variables are not defined yet
+# (i.e. libevent is used via add_subdirectory())
+if (NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+endif()
+if (NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
+    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+endif()
+if (NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
+    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+endif()
+
+if (EVENT__ENABLE_VERBOSE_DEBUG)
+    add_definitions(-DUSE_DEBUG=1)
+endif()
+
+# make it colorful under ninja-build
+if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
+    add_compiler_flags(-fdiagnostics-color=always)
+endif()
+
+# Setup compiler flags for coverage.
+if (EVENT__COVERAGE)
+    if (NOT "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "debug")
+        message(FATAL_ERROR "Coverage requires -DCMAKE_BUILD_TYPE=Debug")
+    endif()
+
+    message(STATUS "Setting coverage compiler flags")
+
+    set(CMAKE_REQUIRED_LIBRARIES "--coverage")
+    add_compiler_flags(-g -O0 --coverage)
+    set(CMAKE_REQUIRED_LIBRARIES "")
+endif()
+
+set(GNUC 0)
+set(CLANG 0)
+set(MSVC 0)
+if (("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR
+    ("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang"))
+    set(CLANG 1)
+endif()
+if (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR (${CLANG}))
+    set(GNUC 1)
+endif()
+if (("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") OR (${CLANG}))
+    set(MSVC 1)
+endif()
+
+# Detect library type
+set(EVENT_LIBRARY_TYPE)
+if ("${EVENT__LIBRARY_TYPE}" STREQUAL "DEFAULT")
+    if (${MSVC})
+        set(EVENT_LIBRARY_TYPE SHARED)
+    else()
+        set(EVENT_LIBRARY_TYPE BOTH)
+    endif()
+else()
+    string(TOUPPER "${EVENT__LIBRARY_TYPE}" EVENT_LIBRARY_TYPE)
+endif()
+if ((${MSVC}) AND ("${EVENT_LIBRARY_TYPE}" STREQUAL "BOTH"))
+    message(WARNING
+      "Building SHARED and STATIC is not supported for MSVC "
+      "(due to conflicts in library name"
+      " between STATIC library and IMPORTED library for SHARED libraries)")
+endif()
+set(EVENT_LIBRARY_STATIC OFF)
+set(EVENT_LIBRARY_SHARED OFF)
+if ("${EVENT_LIBRARY_TYPE}" STREQUAL "BOTH")
+    set(EVENT_LIBRARY_STATIC ON)
+    set(EVENT_LIBRARY_SHARED ON)
+elseif ("${EVENT_LIBRARY_TYPE}" STREQUAL "STATIC")
+    set(EVENT_LIBRARY_STATIC ON)
+elseif ("${EVENT_LIBRARY_TYPE}" STREQUAL "SHARED")
+    set(EVENT_LIBRARY_SHARED ON)
+else()
+    message(FATAL_ERROR "${EVENT_LIBRARY_TYPE} is not supported")
+endif()
+
+if (${MSVC})
+    set(msvc_static_runtime OFF)
+    if ("${EVENT_LIBRARY_TYPE}" STREQUAL "STATIC")
+        set(msvc_static_runtime ON)
+    endif()
+
+    # For more info:
+    # - https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=vs-2017
+    # - https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime
+    option(EVENT__MSVC_STATIC_RUNTIME
+           "Link static runtime libraries"
+           ${msvc_static_runtime})
+
+    if (EVENT__MSVC_STATIC_RUNTIME)
+        foreach (flag_var
+                 CMAKE_C_FLAGS_DEBUG
+                 CMAKE_C_FLAGS_RELEASE
+                 CMAKE_C_FLAGS_MINSIZEREL
+                 CMAKE_C_FLAGS_RELWITHDEBINFO
+        )
+            if (${flag_var} MATCHES "/MD")
+                string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+            endif()
+        endforeach()
+    endif()
+endif()
+
+# GNUC specific options.
+if (${GNUC})
+    option(EVENT__DISABLE_GCC_WARNINGS "Disable verbose warnings with GCC" OFF)
+    option(EVENT__ENABLE_GCC_HARDENING "Enable compiler security checks" OFF)
+    option(EVENT__ENABLE_GCC_FUNCTION_SECTIONS "Enable gcc function sections" OFF)
+    option(EVENT__ENABLE_GCC_WARNINGS "Make all GCC warnings into errors" OFF)
+
+    set(GCC_V ${CMAKE_C_COMPILER_VERSION})
+
+    list(APPEND __FLAGS
+         -Wall -Wextra -Wno-unused-parameter -Wstrict-aliasing -Wstrict-prototypes
+
+         -fno-strict-aliasing # gcc 2.9.5+
+         -Wmissing-prototypes
+
+         # gcc 4
+         -Winit-self
+         -Wmissing-field-initializers
+         -Wdeclaration-after-statement
+
+         # gcc 4.2
+         -Waddress
+         -Wnormalized=id
+         -Woverride-init
+
+         # gcc 4.5
+         -Wlogical-op
+
+         -Wwrite-strings
+    )
+
+    if (${CLANG})
+        list(APPEND __FLAGS -Wno-unused-function)
+    endif()
+
+    if (EVENT__DISABLE_GCC_WARNINGS)
+        list(APPEND __FLAGS -w)
+    endif()
+
+    if (EVENT__ENABLE_GCC_HARDENING)
+        list(APPEND __FLAGS
+             -fstack-protector-all
+             -fwrapv
+             -fPIE
+             -Wstack-protector
+             "--param ssp-buffer-size=1")
+
+        add_definitions(-D_FORTIFY_SOURCE=2)
+    endif()
+
+    if (EVENT__ENABLE_GCC_FUNCTION_SECTIONS)
+        list(APPEND __FLAGS -ffunction-sections)
+        # TODO: Add --gc-sections support. We need some checks for NetBSD to ensure this works.
+    endif()
+
+    if (EVENT__ENABLE_GCC_WARNINGS)
+        list(APPEND __FLAGS -Werror)
+    endif()
+
+    add_compiler_flags(${__FLAGS})
+endif()
+
+if (APPLE)
+    # Get rid of deprecated warnings for OpenSSL on OSX 10.7 and greater.
+    add_compiler_flags(
+        -Wno-error=deprecated-declarations
+        -Qunused-arguments
+    )
+endif()
+
+if (MINGW OR CYGWIN)
+    set(WIN32 TRUE)
+endif()
+
+# Winsock.
+if(WIN32)
+    set(CMAKE_REQUIRED_LIBRARIES  ws2_32 shell32 advapi32)
+    set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h -D_WIN32_WINNT=0x0600)
+endif()
+if (SOLARIS)
+    set(CMAKE_REQUIRED_LIBRARIES socket nsl)
+endif()
+
+# Check if _GNU_SOURCE is available.
+if (NOT DEFINED _GNU_SOURCE)
+  CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
+
+  if (NOT _GNU_SOURCE)
+    unset(_GNU_SOURCE CACHE)
+    CHECK_SYMBOL_EXISTS(_GNU_SOURCE "features.h" _GNU_SOURCE)
+  endif()
+
+  if (ANDROID)
+    set(_GNU_SOURCE TRUE)
+  endif()
+endif()
+
+if (_GNU_SOURCE)
+    add_definitions(-D_GNU_SOURCE=1)
+    set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+endif()
+
+# Check if header files exist
+list(APPEND FILES_TO_CHECK
+    fcntl.h
+    inttypes.h
+    memory.h
+    signal.h
+    stdarg.h
+    stddef.h
+    stdint.h
+    stdlib.h
+    string.h
+    errno.h
+    unistd.h
+    time.h
+    sys/types.h
+    sys/stat.h
+    sys/time.h
+    sys/param.h
+)
+if (WIN32)
+    list(APPEND FILES_TO_CHECK
+        io.h
+        winsock2.h
+        ws2tcpip.h
+        afunix.h
+    )
+else()
+    list(APPEND FILES_TO_CHECK
+        netdb.h
+        dlfcn.h
+        arpa/inet.h
+        poll.h
+        port.h
+        sys/socket.h
+        sys/random.h
+        sys/un.h
+        sys/devpoll.h
+        sys/epoll.h
+        sys/eventfd.h
+        sys/event.h
+        sys/ioctl.h
+        sys/mman.h
+        sys/queue.h
+        sys/select.h
+        sys/sendfile.h
+        sys/uio.h
+        sys/wait.h
+        sys/resource.h
+        sys/timerfd.h
+        netinet/in.h
+        netinet/in6.h
+        netinet/tcp.h
+        ifaddrs.h
+    )
+endif()
+
+if (NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
+    list(APPEND FILES_TO_CHECK sys/sysctl.h)
+endif()
+
+if (APPLE)
+    list(APPEND FILES_TO_CHECK
+        mach/mach_time.h
+        mach/mach.h
+    )
+endif()
+
+foreach(FILE ${FILES_TO_CHECK})
+    CHECK_INCLUDE_FILE_CONCAT(${FILE} "EVENT")
+endforeach()
+unset(FILES_TO_CHECK)
+
+# Check if functions exist
+list(APPEND SYMBOLS_TO_CHECK
+    getaddrinfo
+    getnameinfo
+    getprotobynumber
+    getservbyname
+    gethostbyname
+    inet_ntop
+    inet_pton
+    gettimeofday
+    signal
+    strtoll
+    splice
+    strlcpy
+    strsep
+    strtok_r
+    vasprintf
+    timerclear
+    timercmp
+    timerisset
+    timeradd
+    nanosleep
+    putenv
+    umask
+)
+if (NOT EVENT__DISABLE_CLOCK_GETTIME)
+    list(APPEND SYMBOLS_TO_CHECK clock_gettime)
+endif()
+
+if (WIN32)
+    list(APPEND SYMBOLS_TO_CHECK
+        _gmtime64_s
+        _gmtime64
+    )
+else()
+    list(APPEND SYMBOLS_TO_CHECK
+        getifaddrs
+        select
+        epoll_create
+        epoll_create1
+        epoll_ctl
+        eventfd
+        poll
+        port_create
+        kqueue
+        fcntl
+        mmap
+        pipe
+        pipe2
+        sendfile
+        sigaction
+        strsignal
+        sysctl
+        accept4
+        arc4random
+        arc4random_buf
+        arc4random_addrandom
+        getrandom
+        getegid
+        geteuid
+        issetugid
+        usleep
+        timerfd_create
+        setenv
+        unsetenv
+        setrlimit
+        gethostbyname_r
+    )
+    if (APPLE)
+        list(APPEND SYMBOLS_TO_CHECK mach_absolute_time)
+    endif()
+endif()
+
+# Add stdio.h for vasprintf
+set(EVENT_INCLUDES ${EVENT_INCLUDES} stdio.h)
+CHECK_SYMBOLS_EXIST("${SYMBOLS_TO_CHECK}" "${EVENT_INCLUDES}" "EVENT")
+unset(SYMBOLS_TO_CHECK)
+set(EVENT__HAVE_EPOLL ${EVENT__HAVE_EPOLL_CREATE})
+
+# Get the gethostbyname_r prototype.
+if(EVENT__HAVE_GETHOSTBYNAME_R)
+    CHECK_PROTOTYPE_DEFINITION(gethostbyname_r
+        "int gethostbyname_r(const char *name, struct hostent *hp, struct hostent_data *hdata)"
+        "0"
+        "netdb.h"
+        EVENT__HAVE_GETHOSTBYNAME_R_3_ARG)
+
+    CHECK_PROTOTYPE_DEFINITION(gethostbyname_r
+        "struct hostent *gethostbyname_r(const char *name, struct hostent *hp, char *buf, size_t buflen, int *herr)"
+        "NULL"
+        "netdb.h"
+        EVENT__HAVE_GETHOSTBYNAME_R_5_ARG)
+
+    CHECK_PROTOTYPE_DEFINITION(gethostbyname_r
+        "int gethostbyname_r(const char *name, struct hostent *hp, char *buf, size_t buflen, struct hostent **result, int *herr)"
+        "0"
+        "netdb.h"
+        EVENT__HAVE_GETHOSTBYNAME_R_6_ARG)
+endif()
+
+if(HAVE_PORT_H AND HAVE_PORT_CREATE)
+    set(EVENT__HAVE_EVENT_PORTS 1)
+endif()
+
+# Only `CHECK_TYPE_SIZE()' will use `CMAKE_EXTRA_INCLUDE_FILES'
+set(CMAKE_EXTRA_INCLUDE_FILES ${EVENT_INCLUDES})
+
+CHECK_TYPE_SIZE("struct sockaddr_un" EVENT__HAVE_STRUCT_SOCKADDR_UN)
+CHECK_TYPE_SIZE("uint8_t" EVENT__HAVE_UINT8_T)
+CHECK_TYPE_SIZE("uint16_t" EVENT__HAVE_UINT16_T)
+CHECK_TYPE_SIZE("uint32_t" EVENT__HAVE_UINT32_T)
+CHECK_TYPE_SIZE("uint64_t" EVENT__HAVE_UINT64_T)
+CHECK_TYPE_SIZE("short" EVENT__SIZEOF_SHORT BUILTIN_TYPES_ONLY)
+CHECK_TYPE_SIZE("int" EVENT__SIZEOF_INT BUILTIN_TYPES_ONLY)
+CHECK_TYPE_SIZE("unsigned" EVENT__SIZEOF_UNSIGNED BUILTIN_TYPES_ONLY)
+CHECK_TYPE_SIZE("unsigned int" EVENT__SIZEOF_UNSIGNED_INT BUILTIN_TYPES_ONLY)
+CHECK_TYPE_SIZE("long" EVENT__SIZEOF_LONG BUILTIN_TYPES_ONLY)
+CHECK_TYPE_SIZE("long long" EVENT__SIZEOF_LONG_LONG BUILTIN_TYPES_ONLY)
+
+if(WIN32)
+    # These aren't available until Windows Vista.
+    # But you can still link them. They just won't be found when running the exe.
+    set(EVENT__HAVE_INET_NTOP 0)
+    set(EVENT__HAVE_INET_PTON 0)
+endif()
+
+# Check for different inline keyword versions.
+check_function_keywords("inline" "__inline" "__inline__")
+
+if (HAVE_INLINE)
+    set(EVENT__inline inline)
+elseif (HAVE___INLINE)
+    set(EVENT__inline __inline)
+elseif(HAVE___INLINE__)
+    set(EVENT__inline __inline__)
+else()
+    set(EVENT__inline)
+endif()
+
+# __func__/__FUNCTION__ is not a macros in general
+CHECK_SYMBOL_EXISTS("__func__"     "" EVENT__HAVE___func__)
+CHECK_SYMBOL_EXISTS("__FUNCTION__" "" EVENT__HAVE___FUNCTION__)
+
+CHECK_SYMBOL_EXISTS(TAILQ_FOREACH sys/queue.h EVENT__HAVE_TAILQFOREACH)
+CHECK_CONST_EXISTS(CTL_KERN sys/sysctl.h EVENT__HAVE_DECL_CTL_KERN)
+CHECK_CONST_EXISTS(KERN_ARND sys/sysctl.h EVENT__HAVE_DECL_KERN_ARND)
+CHECK_SYMBOL_EXISTS(F_SETFD fcntl.h EVENT__HAVE_SETFD)
+
+CHECK_TYPE_SIZE(fd_mask EVENT__HAVE_FD_MASK)
+
+CHECK_TYPE_SIZE(size_t EVENT__SIZEOF_SIZE_T)
+if(NOT EVENT__SIZEOF_SIZE_T)
+  set(EVENT__size_t "unsigned")
+  set(EVENT__SIZEOF_SIZE_T ${EVENT__SIZEOF_UNSIGNED})
+else()
+    set(EVENT__size_t size_t)
+endif()
+
+CHECK_TYPE_SIZE("off_t" EVENT__SIZEOF_OFF_T LANGUAGE C)
+
+
+# XXX we should functionalize these size and type sets. --elley
+
+# Winssck.
+if (_MSC_VER)
+    list(APPEND CMAKE_EXTRA_INCLUDE_FILES BaseTsd.h)
+endif()
+CHECK_TYPE_SIZE("ssize_t" EVENT__SIZEOF_SSIZE_T_LOWER LANGUAGE C)
+CHECK_TYPE_SIZE("SSIZE_T" EVENT__SIZEOF_SSIZE_T_UPPER LANGUAGE C)
+
+if (EVENT__SIZEOF_SSIZE_T_LOWER)
+    set(EVENT__ssize_t "ssize_t")
+    set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_SSIZE_T_LOWER})
+elseif (EVENT__SIZEOF_SSIZE_T_UPPER)
+    set(EVENT__ssize_t "SSIZE_T")
+    set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_SSIZE_T_UPPER})
+else()
+    set(EVENT__ssize_t "int")
+    set(EVENT__SIZEOF_SSIZE_T ${EVENT__SIZEOF_INT})
+endif()
+
+CHECK_TYPE_SIZE(socklen_t EVENT__SIZEOF_SOCKLEN_T)
+if(NOT EVENT__SIZEOF_SOCKLEN_T)
+  set(EVENT__socklen_t "unsigned int")
+  set(EVENT__SIZEOF_SOCKLEN_T ${EVENT__SIZEOF_UNSIGNED_INT})
+else()
+    set(EVENT__socklen_t "socklen_t")
+endif()
+
+CHECK_TYPE_SIZE(pid_t EVENT__SIZEOF_PID_T)
+if(NOT EVENT__SIZEOF_PID_T)
+  set(EVENT__SIZEOF_PID_T ${EVENT__SIZEOF_INT})
+else()
+	set(EVENT__SIZEOF_PID_T EVENT__SIZEOF_PID_T)
+endif()
+
+if (NOT EVENT__DISABLE_THREAD_SUPPORT)
+    if (NOT WIN32)
+        list(APPEND CMAKE_EXTRA_INCLUDE_FILES pthread.h)
+    endif()
+    CHECK_TYPE_SIZE(pthread_t EVENT__SIZEOF_PTHREAD_T)
+endif()
+
+if(EVENT__HAVE_CLOCK_GETTIME)
+  set(EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1)
+endif()
+
+# we're just getting lazy now.
+CHECK_TYPE_SIZE("uintptr_t" EVENT__HAVE_UINTPTR_T)
+CHECK_TYPE_SIZE("void *" EVENT__SIZEOF_VOID_P)
+CHECK_TYPE_SIZE("time_t" EVENT__SIZEOF_TIME_T)
+
+# Tests file offset bits.
+# TODO: Add AIX test for if -D_LARGE_FILES is needed.
+
+# XXX: Why is this here? we don't even use it. Well, we don't even use it
+#      on top of that, why is it set in the config.h?! IT_MAKES_NO_SENSE
+#      I'm commenting it out for now.
+#      - ellzey
+
+#CHECK_FILE_OFFSET_BITS()
+
+# Verify kqueue works with pipes.
+if (EVENT__HAVE_KQUEUE)
+    if ((CMAKE_CROSSCOMPILING OR APPLE) AND NOT EVENT__FORCE_KQUEUE_CHECK)
+        message(WARNING "Cannot check if kqueue works with pipes when crosscompiling, use EVENT__FORCE_KQUEUE_CHECK to be sure (this requires manually running a test program on the cross compilation target)")
+        set(EVENT__HAVE_WORKING_KQUEUE 1)
+    else()
+        message(STATUS "Checking if kqueue works with pipes...")
+        include(CheckWorkingKqueue)
+    endif()
+endif()
+
+if(EVENT__HAVE_NETDB_H)
+    list(APPEND CMAKE_EXTRA_INCLUDE_FILES netdb.h)
+    CHECK_TYPE_SIZE("struct addrinfo" EVENT__HAVE_STRUCT_ADDRINFO)
+elseif(WIN32)
+    list(APPEND CMAKE_EXTRA_INCLUDE_FILES ws2tcpip.h)
+    CHECK_TYPE_SIZE("struct addrinfo" EVENT__HAVE_STRUCT_ADDRINFO)
+endif()
+
+# Check for sockaddr structure sizes.
+set(SOCKADDR_HEADERS)
+if (WIN32)
+    set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
+    if (_MSC_VER LESS 1300)
+        set(SOCKADDR_HEADERS winsock.h)
+    else()
+        set(SOCKADDR_HEADERS winsock2.h ws2tcpip.h)
+    endif()
+else()
+    if (EVENT__HAVE_NETINET_IN_H)
+        set(SOCKADDR_HEADERS ${SOCKADDR_HEADERS} netinet/in.h)
+    endif()
+
+    if (EVENT__HAVE_NETINET_IN6_H)
+        set(SOCKADDR_HEADERS ${SOCKADDR_HEADERS} netinet/in6.h)
+    endif()
+
+    if (EVENT__HAVE_SYS_SOCKET_H)
+        set(SOCKADDR_HEADERS ${SOCKADDR_HEADERS} sys/socket.h)
+    endif()
+
+    if (EVENT__HAVE_NETDB_H)
+        set(SOCKADDR_HEADERS ${SOCKADDR_HEADERS} netdb.h)
+    endif()
+endif()
+
+CHECK_TYPE_SIZE("struct in6_addr" EVENT__HAVE_STRUCT_IN6_ADDR)
+if(EVENT__HAVE_STRUCT_IN6_ADDR)
+    CHECK_STRUCT_HAS_MEMBER("struct in6_addr"
+            s6_addr16 "${SOCKADDR_HEADERS}"
+            EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16)
+
+    CHECK_STRUCT_HAS_MEMBER("struct in6_addr"
+            s6_addr32 "${SOCKADDR_HEADERS}"
+            EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32)
+endif()
+
+CHECK_TYPE_SIZE("sa_family_t" EVENT__HAVE_SA_FAMILY_T)
+CHECK_TYPE_SIZE("struct sockaddr_in6" EVENT__HAVE_STRUCT_SOCKADDR_IN6)
+
+if(EVENT__HAVE_STRUCT_SOCKADDR_IN6)
+    CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6"
+            sin6_len "${SOCKADDR_HEADERS}"
+            EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN)
+
+    CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6"
+            sin_len "${SOCKADDR_HEADERS}"
+            EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN)
+endif()
+
+CHECK_TYPE_SIZE("struct sockaddr_storage" EVENT__HAVE_STRUCT_SOCKADDR_STORAGE)
+if(EVENT__HAVE_STRUCT_SOCKADDR_STORAGE)
+    CHECK_STRUCT_HAS_MEMBER("struct sockaddr_storage"
+            ss_family "${SOCKADDR_HEADERS}"
+            EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
+
+    CHECK_STRUCT_HAS_MEMBER("struct sockaddr_storage"
+            __ss_family "${SOCKADDR_HEADERS}" EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY)
+endif()
+
+CHECK_TYPE_SIZE("struct linger" EVENT__HAVE_STRUCT_LINGER)
+
+# Group the source files.
+set(HDR_PRIVATE
+    bufferevent-internal.h
+    changelist-internal.h
+    defer-internal.h
+    epolltable-internal.h
+    evbuffer-internal.h
+    event-internal.h
+    evmap-internal.h
+    evrpc-internal.h
+    evsignal-internal.h
+    evthread-internal.h
+    ht-internal.h
+    http-internal.h
+    iocp-internal.h
+    ipv6-internal.h
+    log-internal.h
+    minheap-internal.h
+    mm-internal.h
+    ratelim-internal.h
+    strlcpy-internal.h
+    util-internal.h
+    evconfig-private.h
+    compat/sys/queue.h)
+
+set(HDR_COMPAT
+    include/evdns.h
+    include/evrpc.h
+    include/event.h
+    include/evhttp.h
+    include/evutil.h)
+
+set(HDR_PUBLIC
+    include/event2/buffer.h
+    include/event2/bufferevent.h
+    include/event2/bufferevent_compat.h
+    include/event2/bufferevent_struct.h
+    include/event2/buffer_compat.h
+    include/event2/dns.h
+    include/event2/dns_compat.h
+    include/event2/dns_struct.h
+    include/event2/event.h
+    include/event2/event_compat.h
+    include/event2/event_struct.h
+    include/event2/http.h
+    include/event2/http_compat.h
+    include/event2/http_struct.h
+    include/event2/keyvalq_struct.h
+    include/event2/listener.h
+    include/event2/rpc.h
+    include/event2/rpc_compat.h
+    include/event2/rpc_struct.h
+    include/event2/tag.h
+    include/event2/tag_compat.h
+    include/event2/thread.h
+    include/event2/util.h
*** 36060 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311281516.3ASFG9ZV094531>