summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-01-08 23:07:57 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2022-01-10 22:38:27 -0500
commitaeba3144548b17d1fc35db4a6809ba5ebbe50c7e (patch)
treef0178a17bf3cdea44ec77817a33055dff7a0bb48 /src/CMakeLists.txt
parent618fb436f2f0bddbc143be092a6bb7d9e8f6c49d (diff)
downloadlighttpd-git-aeba3144548b17d1fc35db4a6809ba5ebbe50c7e.tar.gz
[build] check headers before some funcs
skip some func checks (slow) if expected header does not exist
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt83
1 files changed, 56 insertions, 27 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c845c1dd..b73083cc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -107,23 +107,14 @@ if(WITH_WEBDAV_LOCKS)
set(WITH_UUID 1)
endif()
-check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
-set(CMAKE_REQUIRED_FLAGS "-include sys/types.h")
-check_include_files(sys/event.h HAVE_SYS_EVENT_H)
-set(CMAKE_REQUIRED_FLAGS)
check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
-check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
set(CMAKE_REQUIRED_FLAGS "-include sys/time.h")
check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H)
set(CMAKE_REQUIRED_FLAGS)
check_include_files(sys/poll.h HAVE_SYS_POLL_H)
check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_files(sys/procctl.h HAVE_SYS_PROCCTL_H)
-check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
-check_include_files(sys/select.h HAVE_SYS_SELECT_H)
-check_include_files(sys/types.h HAVE_SYS_TYPES_H)
-check_include_files(sys/uio.h HAVE_SYS_UIO_H)
check_include_files(sys/un.h HAVE_SYS_UN_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
@@ -131,7 +122,6 @@ check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(pthread.h HAVE_PTHREAD_H)
check_include_files(getopt.h HAVE_GETOPT_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
-check_include_files(malloc.h HAVE_MALLOC_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(pwd.h HAVE_PWD_H)
check_include_files(stdint.h HAVE_STDINT_H)
@@ -160,15 +150,66 @@ set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
check_type_size(socklen_t HAVE_SOCKLEN_T)
set(CMAKE_EXTRA_INCLUDE_FILES)
+check_include_files(malloc.h HAVE_MALLOC_H)
+if(HAVE_MALLOC_H)
+check_function_exists(malloc_trim HAVE_MALLOC_TRIM)
+check_function_exists(mallopt HAVE_MALLOPT)
+endif()
+
+check_include_files(signal.h HAVE_SIGNAL_H)
+if(HAVE_SIGNAL_H)
+check_function_exists(sigaction HAVE_SIGACTION)
+check_function_exists(signal HAVE_SIGNAL)
+endif()
+
+check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
+if(HAVE_SYS_EPOLL_H)
+check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
+endif()
+
+set(CMAKE_REQUIRED_FLAGS "-include sys/types.h")
+check_include_files(sys/event.h HAVE_SYS_EVENT_H)
+set(CMAKE_REQUIRED_FLAGS)
+if(HAVE_SYS_EVENT_H)
+check_function_exists(kqueue HAVE_KQUEUE)
+endif()
+
+check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
+if(HAVE_SYS_MMAN_H)
+check_function_exists(mmap HAVE_MMAP)
+endif()
+
check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
+if(HAVE_SYS_RANDOM_H)
set(CMAKE_EXTRA_INCLUDE_FILES sys/random.h)
check_function_exists(getentropy HAVE_GETENTROPY)
set(CMAKE_EXTRA_INCLUDE_FILES)
+endif()
check_include_files(linux/random.h HAVE_LINUX_RANDOM_H)
+if(HAVE_LINUX_RANDOM_H)
set(CMAKE_EXTRA_INCLUDE_FILES linux/random.h)
check_function_exists(getrandom HAVE_GETRANDOM)
set(CMAKE_EXTRA_INCLUDE_FILES)
+endif()
+
+check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
+if(HAVE_SYS_RESOURCE_H)
+check_function_exists(getrlimit HAVE_GETRLIMIT)
+endif()
+
+check_include_files(sys/uio.h HAVE_SYS_UIO_H)
+if(HAVE_SYS_UIO_H)
+check_function_exists(preadv HAVE_PREADV)
+check_function_exists(pwritev HAVE_PWRITEV)
+check_function_exists(writev HAVE_WRITEV)
+endif()
+
+check_function_exists(poll HAVE_POLL)
+if(NOT HAVE_POLL)
+check_include_files(sys/select.h HAVE_SYS_SELECT_H)
+check_function_exists(select HAVE_SELECT)
+endif()
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
check_function_exists(timegm HAVE_TIMEGM)
@@ -190,40 +231,24 @@ check_type_size(off_t SIZEOF_OFF_T)
check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
check_function_exists(chroot HAVE_CHROOT)
check_function_exists(copy_file_range HAVE_COPY_FILE_RANGE)
-check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(getloadavg HAVE_GETLOADAVG)
-check_function_exists(getrlimit HAVE_GETRLIMIT)
check_function_exists(getuid HAVE_GETUID)
check_function_exists(gmtime_r HAVE_GMTIME_R)
-check_function_exists(inet_aton HAVE_INET_ATON)
-check_function_exists(inet_pton HAVE_INET_PTON)
check_function_exists(jrand48 HAVE_JRAND48)
-check_function_exists(kqueue HAVE_KQUEUE)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_function_exists(lstat HAVE_LSTAT)
check_function_exists(madvise HAVE_MADVISE)
-check_function_exists(malloc_trim HAVE_MALLOC_TRIM)
-check_function_exists(mallopt HAVE_MALLOPT)
check_function_exists(mempcpy HAVE_MEMPCPY)
check_function_exists(mkostemp HAVE_MKOSTEMP)
-check_function_exists(mmap HAVE_MMAP)
check_function_exists(pipe2 HAVE_PIPE2)
-check_function_exists(poll HAVE_POLL)
check_function_exists(pread HAVE_PREAD)
-check_function_exists(preadv HAVE_PREADV)
check_function_exists(pwrite HAVE_PWRITE)
-check_function_exists(pwritev HAVE_PWRITEV)
-check_function_exists(select HAVE_SELECT)
check_function_exists(sendfile HAVE_SENDFILE)
-check_function_exists(send_file HAVE_SEND_FILE)
check_function_exists(sendfile64 HAVE_SENDFILE64)
-check_function_exists(sigaction HAVE_SIGACTION)
-check_function_exists(signal HAVE_SIGNAL)
check_function_exists(splice HAVE_SPLICE)
check_function_exists(srandom HAVE_SRANDOM)
check_function_exists(strerror_r HAVE_STRERROR_R)
-check_function_exists(writev HAVE_WRITEV)
check_function_exists(issetugid HAVE_ISSETUGID)
check_function_exists(memset_s HAVE_MEMSET_S)
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
@@ -237,7 +262,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(CMAKE_REQUIRED_LIBRARIES "socket;nsl")
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
set(CMAKE_REQUIRED_LIBRARIES "network")
+elseif(WIN32)
+set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
endif()
+check_function_exists(inet_aton HAVE_INET_ATON)
+check_function_exists(inet_pton HAVE_INET_PTON)
check_c_source_compiles("
#include <sys/types.h>
#include <sys/socket.h>
@@ -1105,7 +1134,7 @@ if(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND")
add_target_properties(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
target_link_libraries(mod_proxy ws2_32)
- target_link_libraries(mod_fcgi ws2_32)
+ target_link_libraries(mod_fastcgi ws2_32)
target_link_libraries(mod_scgi ws2_32)
target_link_libraries(mod_ssi ws2_32)