mirror of
https://github.com/libevent/libevent.git
synced 2025-01-20 05:02:55 +08:00
Merge branch 'build-fixes' (#969)
* build-fixes: github workflow: fix configure error on mingw-w64 cmake: fix getaddrinfo checking error cmake: remove CheckFunctionExistsEx autoconf: fix getaddrinfo checking errors on mingw
This commit is contained in:
commit
5c4ea4afb2
6
.github/workflows/mingw.yml
vendored
6
.github/workflows/mingw.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
|
||||
- name: Cache MingW
|
||||
- name: Cache MinGW
|
||||
id: cache-mingw
|
||||
uses: actions/cache@v1.0.3
|
||||
with:
|
||||
@ -55,7 +55,7 @@ jobs:
|
||||
- name: Install Dependes
|
||||
if: steps.cache-mingw.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
msys2do pacman -S --noconfirm mingw-w64-x86_64-gcc make autoconf automake libtool openssl-devel
|
||||
msys2do pacman -S --noconfirm mingw-w64-x86_64-gcc make autoconf automake libtool mingw-w64-x86_64-openssl
|
||||
|
||||
- name: Build And Test
|
||||
shell: powershell
|
||||
@ -74,7 +74,7 @@ jobs:
|
||||
mkdir -p build
|
||||
cd build
|
||||
[[ $? -ne 0 ]] && exit 1
|
||||
LDFLAGS="-L/usr/lib" CFLAGS="-I/usr/include" ../configure $EVENT_CONFIGURE_OPTIONS 2>&1
|
||||
LDFLAGS="-L/mingw64/lib" CFLAGS="-I/mingw64/include" ../configure $EVENT_CONFIGURE_OPTIONS 2>&1
|
||||
[[ $? -ne 0 ]] && exit 1
|
||||
make -j $EVENT_BUILD_PARALLEL 2>&1
|
||||
[[ $? -ne 0 ]] && exit 1
|
||||
|
127
CMakeLists.txt
127
CMakeLists.txt
@ -51,13 +51,13 @@ string(REGEX MATCH "SunOS" SOLARIS "${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
|
||||
include(CheckTypeSize)
|
||||
include(CheckFunctionExistsEx)
|
||||
include(CheckFileOffsetBits)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckVariableExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckSymbolsExist)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckPrototypeDefinition)
|
||||
@ -339,7 +339,7 @@ endif()
|
||||
if(WIN32)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h -D_WIN32_WINNT=0x0600)
|
||||
endif()
|
||||
if (SOLARIS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES socket nsl)
|
||||
@ -451,63 +451,70 @@ endif()
|
||||
CHECK_INCLUDE_FILE(sys/timerfd.h EVENT__HAVE_SYS_TIMERFD_H)
|
||||
CHECK_INCLUDE_FILE(errno.h EVENT__HAVE_ERRNO_H)
|
||||
|
||||
|
||||
CHECK_FUNCTION_EXISTS_EX(epoll_create EVENT__HAVE_EPOLL)
|
||||
CHECK_FUNCTION_EXISTS_EX(epoll_ctl EVENT__HAVE_EPOLL_CTL)
|
||||
CHECK_FUNCTION_EXISTS_EX(eventfd EVENT__HAVE_EVENTFD)
|
||||
if(NOT EVENT__DISABLE_CLOCK_GETTIME)
|
||||
CHECK_FUNCTION_EXISTS_EX(clock_gettime EVENT__HAVE_CLOCK_GETTIME)
|
||||
if (WIN32)
|
||||
list(APPEND CHECK_SYMBOL_HEADERS winsock2.h ws2tcpip.h)
|
||||
endif()
|
||||
CHECK_FUNCTION_EXISTS_EX(fcntl EVENT__HAVE_FCNTL)
|
||||
CHECK_FUNCTION_EXISTS_EX(getaddrinfo EVENT__HAVE_GETADDRINFO)
|
||||
CHECK_FUNCTION_EXISTS_EX(getnameinfo EVENT__HAVE_GETNAMEINFO)
|
||||
CHECK_FUNCTION_EXISTS_EX(gettimeofday EVENT__HAVE_GETTIMEOFDAY)
|
||||
CHECK_FUNCTION_EXISTS_EX(getprotobynumber EVENT__HAVE_GETPROTOBYNUMBER)
|
||||
CHECK_FUNCTION_EXISTS_EX(getservbyname EVENT__HAVE_GETSERVBYNAME)
|
||||
CHECK_FUNCTION_EXISTS_EX(inet_ntop EVENT__HAVE_INET_NTOP)
|
||||
CHECK_FUNCTION_EXISTS_EX(inet_pton EVENT__HAVE_INET_PTON)
|
||||
CHECK_FUNCTION_EXISTS_EX(kqueue EVENT__HAVE_KQUEUE)
|
||||
CHECK_FUNCTION_EXISTS_EX(mmap EVENT__HAVE_MMAP)
|
||||
CHECK_FUNCTION_EXISTS_EX(pipe EVENT__HAVE_PIPE)
|
||||
CHECK_FUNCTION_EXISTS_EX(pipe2 EVENT__HAVE_PIPE2)
|
||||
CHECK_FUNCTION_EXISTS_EX(poll EVENT__HAVE_POLL)
|
||||
CHECK_FUNCTION_EXISTS_EX(port_create EVENT__HAVE_PORT_CREATE)
|
||||
CHECK_FUNCTION_EXISTS_EX(sendfile EVENT__HAVE_SENDFILE)
|
||||
CHECK_FUNCTION_EXISTS_EX(sigaction EVENT__HAVE_SIGACTION)
|
||||
CHECK_FUNCTION_EXISTS_EX(signal EVENT__HAVE_SIGNAL)
|
||||
CHECK_FUNCTION_EXISTS_EX(strsignal EVENT__HAVE_STRSIGNAL)
|
||||
CHECK_FUNCTION_EXISTS_EX(splice EVENT__HAVE_SPLICE)
|
||||
CHECK_FUNCTION_EXISTS_EX(strlcpy EVENT__HAVE_STRLCPY)
|
||||
CHECK_FUNCTION_EXISTS_EX(strsep EVENT__HAVE_STRSEP)
|
||||
CHECK_FUNCTION_EXISTS_EX(strtok_r EVENT__HAVE_STRTOK_R)
|
||||
CHECK_FUNCTION_EXISTS_EX(strtoll EVENT__HAVE_STRTOLL)
|
||||
CHECK_FUNCTION_EXISTS_EX(vasprintf EVENT__HAVE_VASPRINTF)
|
||||
CHECK_FUNCTION_EXISTS_EX(sysctl EVENT__HAVE_SYSCTL)
|
||||
CHECK_FUNCTION_EXISTS_EX(accept4 EVENT__HAVE_ACCEPT4)
|
||||
CHECK_FUNCTION_EXISTS_EX(arc4random EVENT__HAVE_ARC4RANDOM)
|
||||
CHECK_FUNCTION_EXISTS_EX(arc4random_buf EVENT__HAVE_ARC4RANDOM_BUF)
|
||||
CHECK_FUNCTION_EXISTS_EX(arc4random_addrandom EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
|
||||
CHECK_FUNCTION_EXISTS_EX(epoll_create1 EVENT__HAVE_EPOLL_CREATE1)
|
||||
CHECK_FUNCTION_EXISTS_EX(getegid EVENT__HAVE_GETEGID)
|
||||
CHECK_FUNCTION_EXISTS_EX(geteuid EVENT__HAVE_GETEUID)
|
||||
CHECK_FUNCTION_EXISTS_EX(getifaddrs EVENT__HAVE_GETIFADDRS)
|
||||
CHECK_FUNCTION_EXISTS_EX(issetugid EVENT__HAVE_ISSETUGID)
|
||||
CHECK_FUNCTION_EXISTS_EX(mach_absolute_time EVENT__HAVE_MACH_ABSOLUTE_TIME)
|
||||
CHECK_FUNCTION_EXISTS_EX(nanosleep EVENT__HAVE_NANOSLEEP)
|
||||
CHECK_FUNCTION_EXISTS_EX(usleep EVENT__HAVE_USLEEP)
|
||||
CHECK_FUNCTION_EXISTS_EX(timeradd EVENT__HAVE_TIMERADD)
|
||||
CHECK_FUNCTION_EXISTS_EX(timerclear EVENT__HAVE_TIMERCLEAR)
|
||||
CHECK_FUNCTION_EXISTS_EX(timercmp EVENT__HAVE_TIMERCMP)
|
||||
CHECK_FUNCTION_EXISTS_EX(timerfd_create EVENT__HAVE_TIMERFD_CREATE)
|
||||
CHECK_FUNCTION_EXISTS_EX(timerisset EVENT__HAVE_TIMERISSET)
|
||||
CHECK_FUNCTION_EXISTS_EX(putenv EVENT__HAVE_PUTENV)
|
||||
CHECK_FUNCTION_EXISTS_EX(setenv EVENT__HAVE_SETENV)
|
||||
CHECK_FUNCTION_EXISTS_EX(setrlimit EVENT__HAVE_SETRLIMIT)
|
||||
CHECK_FUNCTION_EXISTS_EX(umask EVENT__HAVE_UMASK)
|
||||
CHECK_FUNCTION_EXISTS_EX(unsetenv EVENT__HAVE_UNSETENV)
|
||||
list(APPEND SYMBOLS_TO_CHECK
|
||||
getaddrinfo
|
||||
getnameinfo
|
||||
getprotobynumber
|
||||
inet_ntop
|
||||
inet_pton
|
||||
strtoll
|
||||
timerclear
|
||||
timercmp
|
||||
timerisset
|
||||
putenv
|
||||
)
|
||||
CHECK_SYMBOLS_EXIST("${SYMBOLS_TO_CHECK}" "${CHECK_SYMBOL_HEADERS}" "EVENT")
|
||||
unset(CHECK_SYMBOL_HEADERS)
|
||||
unset(SYMBOLS_TO_CHECK)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(epoll_create EVENT__HAVE_EPOLL)
|
||||
CHECK_FUNCTION_EXISTS(epoll_ctl EVENT__HAVE_EPOLL_CTL)
|
||||
CHECK_FUNCTION_EXISTS(eventfd EVENT__HAVE_EVENTFD)
|
||||
if(NOT EVENT__DISABLE_CLOCK_GETTIME)
|
||||
CHECK_FUNCTION_EXISTS(clock_gettime EVENT__HAVE_CLOCK_GETTIME)
|
||||
endif()
|
||||
CHECK_FUNCTION_EXISTS(fcntl EVENT__HAVE_FCNTL)
|
||||
CHECK_FUNCTION_EXISTS(gettimeofday EVENT__HAVE_GETTIMEOFDAY)
|
||||
CHECK_FUNCTION_EXISTS(kqueue EVENT__HAVE_KQUEUE)
|
||||
CHECK_FUNCTION_EXISTS(mmap EVENT__HAVE_MMAP)
|
||||
CHECK_FUNCTION_EXISTS(pipe EVENT__HAVE_PIPE)
|
||||
CHECK_FUNCTION_EXISTS(pipe2 EVENT__HAVE_PIPE2)
|
||||
CHECK_FUNCTION_EXISTS(poll EVENT__HAVE_POLL)
|
||||
CHECK_FUNCTION_EXISTS(port_create EVENT__HAVE_PORT_CREATE)
|
||||
CHECK_FUNCTION_EXISTS(sendfile EVENT__HAVE_SENDFILE)
|
||||
CHECK_FUNCTION_EXISTS(sigaction EVENT__HAVE_SIGACTION)
|
||||
CHECK_FUNCTION_EXISTS(signal EVENT__HAVE_SIGNAL)
|
||||
CHECK_FUNCTION_EXISTS(strsignal EVENT__HAVE_STRSIGNAL)
|
||||
CHECK_FUNCTION_EXISTS(splice EVENT__HAVE_SPLICE)
|
||||
CHECK_FUNCTION_EXISTS(strlcpy EVENT__HAVE_STRLCPY)
|
||||
CHECK_FUNCTION_EXISTS(strsep EVENT__HAVE_STRSEP)
|
||||
CHECK_FUNCTION_EXISTS(strtok_r EVENT__HAVE_STRTOK_R)
|
||||
CHECK_FUNCTION_EXISTS(vasprintf EVENT__HAVE_VASPRINTF)
|
||||
CHECK_FUNCTION_EXISTS(sysctl EVENT__HAVE_SYSCTL)
|
||||
CHECK_FUNCTION_EXISTS(accept4 EVENT__HAVE_ACCEPT4)
|
||||
CHECK_FUNCTION_EXISTS(arc4random EVENT__HAVE_ARC4RANDOM)
|
||||
CHECK_FUNCTION_EXISTS(arc4random_buf EVENT__HAVE_ARC4RANDOM_BUF)
|
||||
CHECK_FUNCTION_EXISTS(arc4random_addrandom EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
|
||||
CHECK_FUNCTION_EXISTS(epoll_create1 EVENT__HAVE_EPOLL_CREATE1)
|
||||
CHECK_FUNCTION_EXISTS(getegid EVENT__HAVE_GETEGID)
|
||||
CHECK_FUNCTION_EXISTS(geteuid EVENT__HAVE_GETEUID)
|
||||
CHECK_FUNCTION_EXISTS(getifaddrs EVENT__HAVE_GETIFADDRS)
|
||||
CHECK_FUNCTION_EXISTS(issetugid EVENT__HAVE_ISSETUGID)
|
||||
CHECK_FUNCTION_EXISTS(mach_absolute_time EVENT__HAVE_MACH_ABSOLUTE_TIME)
|
||||
CHECK_FUNCTION_EXISTS(nanosleep EVENT__HAVE_NANOSLEEP)
|
||||
CHECK_FUNCTION_EXISTS(usleep EVENT__HAVE_USLEEP)
|
||||
CHECK_FUNCTION_EXISTS(timeradd EVENT__HAVE_TIMERADD)
|
||||
CHECK_FUNCTION_EXISTS(timerfd_create EVENT__HAVE_TIMERFD_CREATE)
|
||||
CHECK_FUNCTION_EXISTS(setenv EVENT__HAVE_SETENV)
|
||||
CHECK_FUNCTION_EXISTS(setrlimit EVENT__HAVE_SETRLIMIT)
|
||||
CHECK_FUNCTION_EXISTS(umask EVENT__HAVE_UMASK)
|
||||
CHECK_FUNCTION_EXISTS(unsetenv EVENT__HAVE_UNSETENV)
|
||||
|
||||
# Get the gethostbyname_r prototype.
|
||||
CHECK_FUNCTION_EXISTS_EX(gethostbyname_r EVENT__HAVE_GETHOSTBYNAME_R)
|
||||
CHECK_FUNCTION_EXISTS(gethostbyname_r EVENT__HAVE_GETHOSTBYNAME_R)
|
||||
|
||||
if(EVENT__HAVE_GETHOSTBYNAME_R)
|
||||
CHECK_PROTOTYPE_DEFINITION(gethostbyname_r
|
||||
@ -534,13 +541,13 @@ if(HAVE_PORT_H AND HAVE_PORT_CREATE)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
CHECK_FUNCTION_EXISTS_EX(select EVENT__HAVE_SELECT)
|
||||
CHECK_FUNCTION_EXISTS(select EVENT__HAVE_SELECT)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
CHECK_FUNCTION_EXISTS_EX(_gmtime64_s EVENT__HAVE__GMTIME64_S)
|
||||
CHECK_FUNCTION_EXISTS(_gmtime64_s EVENT__HAVE__GMTIME64_S)
|
||||
if (NOT EVENT__HAVE__GMTIME64_S)
|
||||
CHECK_FUNCTION_EXISTS_EX(_gmtime64 EVENT__HAVE__GMTIME64)
|
||||
CHECK_FUNCTION_EXISTS(_gmtime64 EVENT__HAVE__GMTIME64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -583,7 +590,7 @@ 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_FUNCTION_EXISTS_EX(getrandom EVENT__HAVE_GETRANDOM)
|
||||
CHECK_FUNCTION_EXISTS(getrandom EVENT__HAVE_GETRANDOM)
|
||||
|
||||
CHECK_TYPE_SIZE(fd_mask EVENT__HAVE_FD_MASK)
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
#ifdef CHECK_FUNCTION_EXISTS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char
|
||||
CHECK_FUNCTION_EXISTS(void);
|
||||
#ifdef __CLASSIC_C__
|
||||
int main()
|
||||
{
|
||||
int ac;
|
||||
char* av[];
|
||||
#else
|
||||
int main(int ac, char* av[])
|
||||
{
|
||||
#endif
|
||||
CHECK_FUNCTION_EXISTS();
|
||||
if (ac > 1000) {
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CHECK_FUNCTION_EXISTS */
|
||||
|
||||
#error "CHECK_FUNCTION_EXISTS has to specify the function"
|
||||
|
||||
#endif /* CHECK_FUNCTION_EXISTS */
|
@ -1,69 +0,0 @@
|
||||
# - Check if a C function can be linked
|
||||
# CHECK_FUNCTION_EXISTS(<function> <variable>)
|
||||
#
|
||||
# Check that the <function> is provided by libraries on the system and
|
||||
# store the result in a <variable>. This does not verify that any
|
||||
# system header file declares the function, only that it can be found
|
||||
# at link time (considure using CheckSymbolExists).
|
||||
#
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2002-2011 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
MACRO(CHECK_FUNCTION_EXISTS_EX FUNCTION VARIABLE)
|
||||
IF(${VARIABLE} MATCHES "^${VARIABLE}$")
|
||||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION}")
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
|
||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||
IF(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
|
||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||
TRY_COMPILE(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/cmake/CheckFunctionExistsEx.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
|
||||
"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
IF(${VARIABLE})
|
||||
SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION} - found")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the function ${FUNCTION} exists passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
ELSE(${VARIABLE})
|
||||
MESSAGE(STATUS "Looking for ${FUNCTION} - not found")
|
||||
SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the function ${FUNCTION} exists failed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
ENDIF(${VARIABLE})
|
||||
ENDIF()
|
||||
ENDMACRO(CHECK_FUNCTION_EXISTS_EX)
|
20
cmake/CheckSymbolsExist.cmake
Normal file
20
cmake/CheckSymbolsExist.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# Check if each symbol in the symbol list exists,
|
||||
# and define PREFIX__HAVE_SYMNAME to 1 if yes.
|
||||
#
|
||||
|
||||
include(CheckSymbolExists)
|
||||
|
||||
# SYMLIST: list of symbols to check
|
||||
# HEADERS: header files to be included in check code
|
||||
# PREFIX: the prefix of definition
|
||||
macro(CHECK_SYMBOLS_EXIST SYMLIST HEADERS PREFIX)
|
||||
foreach(SYMNAME ${SYMLIST})
|
||||
string(TOUPPER "${SYMNAME}" SYMNAME_UPPER)
|
||||
if("${PREFIX}" STREQUAL "")
|
||||
set(HAVE_SYM_DEF "HAVE_${SYMNAME_UPPER}")
|
||||
else()
|
||||
set(HAVE_SYM_DEF "${PREFIX}__HAVE_${SYMNAME_UPPER}")
|
||||
endif()
|
||||
CHECK_SYMBOL_EXISTS(${SYMNAME} "${HEADERS}" ${HAVE_SYM_DEF})
|
||||
endforeach()
|
||||
endmacro()
|
40
configure.ac
40
configure.ac
@ -251,6 +251,7 @@ AC_CHECK_HEADERS([ \
|
||||
sys/wait.h \
|
||||
sys/random.h \
|
||||
errno.h \
|
||||
afunix.h \
|
||||
])
|
||||
|
||||
case "${host_os}" in
|
||||
@ -347,7 +348,7 @@ AM_CONDITIONAL(BUILD_MIDIPIX, test x$midipix = xtrue)
|
||||
AM_CONDITIONAL(BUILD_WITH_NO_UNDEFINED, test x$bwin32 = xtrue || test x$cygwin = xtrue || test x$midipix = xtrue)
|
||||
|
||||
if test x$bwin32 = xtrue; then
|
||||
AC_SEARCH_LIBS([getservbyname],[ws2_32])
|
||||
AC_HAVE_LIBRARY([ws2_32])
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@ -367,11 +368,7 @@ AC_CHECK_FUNCS([ \
|
||||
getegid \
|
||||
geteuid \
|
||||
getifaddrs \
|
||||
getnameinfo \
|
||||
getprotobynumber \
|
||||
gettimeofday \
|
||||
inet_ntop \
|
||||
inet_pton \
|
||||
issetugid \
|
||||
mach_absolute_time \
|
||||
mmap \
|
||||
@ -396,17 +393,36 @@ AC_CHECK_FUNCS([ \
|
||||
unsetenv \
|
||||
usleep \
|
||||
vasprintf \
|
||||
getservbyname \
|
||||
getrandom \
|
||||
])
|
||||
|
||||
AC_CHECK_FUNCS(_gmtime64_s, [have__gmtime64_s=yes], )
|
||||
if test "x$have__gmtime64_s" != "xyes"; then
|
||||
AC_CHECK_FUNCS(_gmtime64)
|
||||
fi
|
||||
AS_IF([test x$bwin32 = xtrue],
|
||||
AC_CHECK_FUNCS(_gmtime64_s, , [AC_CHECK_FUNCS(_gmtime64)])
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(STRLCPY_IMPL, [test x"$ac_cv_func_strlcpy" = xno])
|
||||
|
||||
m4_define([funcstochk],
|
||||
[getnameinfo
|
||||
getprotobynumber
|
||||
getservbyname
|
||||
inet_ntop
|
||||
inet_pton]
|
||||
)
|
||||
|
||||
AS_IF([test x$bwin32 = xtrue],
|
||||
[AX_CHECK_DECLS_EX([funcstochk getaddrinfo],
|
||||
[#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif])],
|
||||
[AC_CHECK_FUNCS(m4_normalize(funcstochk))]
|
||||
)
|
||||
|
||||
m4_undefine([funcstochk])
|
||||
|
||||
dnl check getaddrinfo and gethostbyname_r for non-windows
|
||||
AS_IF([test x$bwin32 = xfalse], [
|
||||
AC_CACHE_CHECK(
|
||||
[for getaddrinfo],
|
||||
[libevent_cv_getaddrinfo],
|
||||
@ -486,6 +502,7 @@ AC_CHECK_FUNC(gethostbyname_r, [
|
||||
])
|
||||
|
||||
fi
|
||||
]) dnl end of checking getaddrinfo and gethostbyname_r
|
||||
|
||||
AC_MSG_CHECKING(for F_SETFD in fcntl.h)
|
||||
AC_EGREP_CPP(yes,
|
||||
@ -739,6 +756,9 @@ AC_CHECK_TYPES([struct linger],,,
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for socklen_t])
|
||||
|
22
m4/ax_check_funcs_ex.m4
Normal file
22
m4/ax_check_funcs_ex.m4
Normal file
@ -0,0 +1,22 @@
|
||||
# Check if the function is available.
|
||||
# HAVE_XXX will be defined if yes.
|
||||
|
||||
# $1: the name of function
|
||||
# $2: the headers in where the function declared
|
||||
AC_DEFUN([AX_CHECK_DECL_EX], [dnl
|
||||
AS_IF([test "x$2" = "x"], [AC_MSG_ERROR([header not privided])])
|
||||
AS_VAR_PUSHDEF([have_func_var], [HAVE_[]m4_toupper($1)])
|
||||
AC_CHECK_DECL([$1],dnl
|
||||
[AC_DEFINE([have_func_var], [1], [Define to 1 if you have the `$1' function.])],,dnl
|
||||
[$2]dnl
|
||||
)
|
||||
AS_VAR_POPDEF([have_func_var])dnl
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CHECK_DECLS_EX], [dnl
|
||||
AS_IF([test "x$2" = "x"], [AC_MSG_ERROR([header not privided])])
|
||||
m4_foreach([decl],dnl
|
||||
m4_split(m4_normalize($1)),dnl
|
||||
[AX_CHECK_DECL_EX([decl], [$2])]dnl
|
||||
)
|
||||
])
|
Loading…
x
Reference in New Issue
Block a user