Browse Source

[build] check headers before some funcs

skip some func checks (slow) if expected header does not exist
master
Glenn Strauss 4 months ago
parent
commit
aeba314454
  1. 1
      SConstruct
  2. 34
      configure.ac
  3. 83
      src/CMakeLists.txt
  4. 66
      src/meson.build

1
SConstruct

@ -433,7 +433,6 @@ if 1:
'pwrite',
'pwritev',
'select',
'send_file',
'sendfile',
'sendfile64',
'sigaction',

34
configure.ac

@ -97,22 +97,16 @@ AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([\
getopt.h \
inttypes.h \
malloc.h \
poll.h \
pwd.h \
stdlib.h \
stdint.h \
strings.h \
sys/epoll.h \
sys/event.h \
sys/inotify.h \
sys/loadavg.h \
sys/mman.h \
sys/poll.h \
sys/prctl.h \
sys/procctl.h \
sys/resource.h \
sys/select.h \
sys/sendfile.h \
sys/time.h \
sys/uio.h \
@ -1427,48 +1421,46 @@ AC_CHECK_FUNCS([\
chroot \
clock_gettime \
copy_file_range \
epoll_ctl \
explicit_bzero \
explicit_memset \
fork \
getloadavg \
getrlimit \
getuid \
gmtime_r \
inet_aton \
inet_pton \
issetugid \
jrand48 \
kqueue \
localtime_r \
lstat \
madvise \
malloc_trim \
mallopt \
mempcpy \
memset_s \
mkostemp \
mmap \
pipe2 \
poll \
pread \
preadv \
pwrite \
pwritev \
select \
send_file \
sendfile \
sendfile64 \
sigaction \
signal \
splice \
srandom \
strerror_r \
timegm \
writev \
])
AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
AC_CHECK_HEADERS([linux/random.h], [AC_CHECK_FUNCS([getrandom])])
AC_CHECK_HEADERS([malloc.h], [AC_CHECK_FUNCS([malloc_trim mallopt])])
AC_CHECK_HEADERS([signal.h], [AC_CHECK_FUNCS([signal sigaction])])
AC_CHECK_HEADERS([sys/epoll.h], [AC_CHECK_FUNCS([epoll_ctl])])
AC_CHECK_HEADERS([sys/event.h], [AC_CHECK_FUNCS([kqueue])])
AC_CHECK_HEADERS([sys/mman.h], [AC_CHECK_FUNCS([mmap])])
AC_CHECK_HEADERS([sys/random.h], [AC_CHECK_FUNCS([getentropy])])
AC_CHECK_HEADERS([sys/resource.h], [AC_CHECK_FUNCS([getrlimit])])
AC_CHECK_HEADERS([sys/uio.h], [AC_CHECK_FUNCS([preadv pwritev writev])])
if test "$ac_cv_func_poll" = no; then
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_FUNCS([select])
fi
case "$host_os" in
*sunos*|*solaris* )

83
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)

66
src/meson.build

@ -34,19 +34,12 @@ endif
conf_data = configuration_data()
conf_data.set('HAVE_SYS_EPOLL_H', compiler.has_header('sys/epoll.h'))
conf_data.set('HAVE_SYS_EVENT_H', compiler.has_header('sys/event.h'))
conf_data.set('HAVE_SYS_INOTIFY_H', compiler.has_header('sys/inotify.h'))
conf_data.set('HAVE_SYS_LOADAVG_H', compiler.has_header('sys/loadavg.h'))
conf_data.set('HAVE_SYS_MMAN_H', compiler.has_header('sys/mman.h'))
conf_data.set('HAVE_SYS_POLL_H', compiler.has_header('sys/poll.h'))
conf_data.set('HAVE_SYS_PRCTL_H', compiler.has_header('sys/prctl.h'))
conf_data.set('HAVE_SYS_PROCCTL_H', compiler.has_header('sys/procctl.h'))
conf_data.set('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h'))
conf_data.set('HAVE_SYS_SENDFILE_H', compiler.has_header('sys/sendfile.h'))
conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h'))
conf_data.set('HAVE_SYS_TYPES_H', compiler.has_header('sys/types.h'))
conf_data.set('HAVE_SYS_UIO_H', compiler.has_header('sys/uio.h'))
conf_data.set('HAVE_SYS_UN_H', compiler.has_header('sys/un.h'))
conf_data.set('HAVE_SYS_WAIT_H', compiler.has_header('sys/wait.h'))
conf_data.set('HAVE_SYS_TIME_H', compiler.has_header('sys/time.h'))
@ -55,7 +48,6 @@ conf_data.set('HAVE_PTHREAD_H', compiler.has_header('pthread.h'))
conf_data.set('HAVE_DLFCN_H', compiler.has_header('dlfcn.h'))
conf_data.set('HAVE_GETOPT_H', compiler.has_header('getopt.h'))
conf_data.set('HAVE_INTTYPES_H', compiler.has_header('inttypes.h'))
conf_data.set('HAVE_MALLOC_H', compiler.has_header('malloc.h'))
conf_data.set('HAVE_POLL_H', compiler.has_header('poll.h'))
conf_data.set('HAVE_PWD_H', compiler.has_header('pwd.h'))
conf_data.set('HAVE_STDINT_H', compiler.has_header('stdint.h'))
@ -99,6 +91,32 @@ endif
conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t', args: defs, prefix: '#include <sys/socket.h>'))
conf_data.set('HAVE_MALLOC_H', compiler.has_header('malloc.h'))
if conf_data.get('HAVE_MALLOC_H')
conf_data.set('HAVE_MALLOC_TRIM', compiler.has_function('malloc_trim', args: defs))
conf_data.set('HAVE_MALLOPT', compiler.has_function('mallopt', args: defs))
endif
if compiler.has_header('signal.h')
conf_data.set('HAVE_SIGACTION', compiler.has_function('sigaction', args: defs))
conf_data.set('HAVE_SIGNAL', compiler.has_function('signal', args: defs))
endif
conf_data.set('HAVE_SYS_EPOLL_H', compiler.has_header('sys/epoll.h'))
if conf_data.get('HAVE_SYS_EPOLL_H')
conf_data.set('HAVE_EPOLL_CTL', compiler.has_function('epoll_ctl', args: defs))
endif
conf_data.set('HAVE_SYS_EVENT_H', compiler.has_header('sys/event.h'))
if conf_data.get('HAVE_SYS_EVENT_H')
conf_data.set('HAVE_KQUEUE', compiler.has_function('kqueue', args: defs))
endif
conf_data.set('HAVE_SYS_MMAN_H', compiler.has_header('sys/mman.h'))
if conf_data.get('HAVE_SYS_MMAN_H')
conf_data.set('HAVE_MMAP', compiler.has_function('mmap', args: defs))
endif
conf_data.set('HAVE_SYS_RANDOM_H', compiler.has_header('sys/random.h'))
if conf_data.get('HAVE_SYS_RANDOM_H')
conf_data.set('HAVE_GETENTROPY', compiler.has_function(
@ -117,6 +135,24 @@ if conf_data.get('HAVE_LINUX_RANDOM_H')
))
endif
conf_data.set('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h'))
if conf_data.get('HAVE_SYS_RESOURCE_H')
conf_data.set('HAVE_GETRLIMIT', compiler.has_function('getrlimit', args: defs))
endif
conf_data.set('HAVE_SYS_UIO_H', compiler.has_header('sys/uio.h'))
if conf_data.get('HAVE_SYS_UIO_H')
conf_data.set('HAVE_PREADV', compiler.has_function('preadv', args: defs))
conf_data.set('HAVE_PWRITEV', compiler.has_function('pwritev', args: defs))
conf_data.set('HAVE_WRITEV', compiler.has_function('writev', args: defs))
endif
conf_data.set('HAVE_POLL', compiler.has_function('poll', args: defs))
if not(conf_data.get('HAVE_POLL'))
conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h'))
conf_data.set('HAVE_SELECT', compiler.has_function('select', args: defs))
endif
if target_machine.system() == 'sunos'
conf_data.set('HAVE_PORT_H', compiler.has_header('port.h'))
conf_data.set('HAVE_PRIV_H', compiler.has_header('priv.h'))
@ -133,41 +169,27 @@ conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t', args: defs))
conf_data.set('HAVE_ARC4RANDOM_BUF', compiler.has_function('arc4random_buf', args: defs))
conf_data.set('HAVE_CHROOT', compiler.has_function('chroot', args: defs))
conf_data.set('HAVE_COPY_FILE_RANGE', compiler.has_function('copy_file_range', args: defs))
conf_data.set('HAVE_EPOLL_CTL', compiler.has_function('epoll_ctl', args: defs))
conf_data.set('HAVE_FORK', compiler.has_function('fork', args: defs))
conf_data.set('HAVE_GETLOADAVG', compiler.has_function('getloadavg', args: defs))
conf_data.set('HAVE_GETRLIMIT', compiler.has_function('getrlimit', args: defs))
conf_data.set('HAVE_GETUID', compiler.has_function('getuid', args: defs))
conf_data.set('HAVE_GMTIME_R', compiler.has_function('gmtime_r', args: defs))
conf_data.set('HAVE_INET_ATON', compiler.has_function('inet_aton', args: defs))
conf_data.set('HAVE_INET_PTON', compiler.has_function('inet_pton', args: defs))
conf_data.set('HAVE_JRAND48', compiler.has_function('jrand48', args: defs))
conf_data.set('HAVE_KQUEUE', compiler.has_function('kqueue', args: defs))
conf_data.set('HAVE_LOCALTIME_R', compiler.has_function('localtime_r', args: defs))
conf_data.set('HAVE_LSTAT', compiler.has_function('lstat', args: defs))
conf_data.set('HAVE_MADVISE', compiler.has_function('madvise', args: defs))
conf_data.set('HAVE_MALLOC_TRIM', compiler.has_function('malloc_trim', args: defs))
conf_data.set('HAVE_MALLOPT', compiler.has_function('mallopt', args: defs))
conf_data.set('HAVE_MEMPCPY', compiler.has_function('mempcpy', args: defs, prefix: '#include <string.h>'))
conf_data.set('HAVE_MKOSTEMP', compiler.has_function('mkostemp', args: defs))
conf_data.set('HAVE_MMAP', compiler.has_function('mmap', args: defs))
conf_data.set('HAVE_PIPE2', compiler.has_function('pipe2', args: defs))
conf_data.set('HAVE_POLL', compiler.has_function('poll', args: defs))
conf_data.set('HAVE_PREAD', compiler.has_function('pread', args: defs))
conf_data.set('HAVE_PREADV', compiler.has_function('preadv', args: defs))
conf_data.set('HAVE_PWRITE', compiler.has_function('pwrite', args: defs))
conf_data.set('HAVE_PWRITEV', compiler.has_function('pwritev', args: defs))
conf_data.set('HAVE_SELECT', compiler.has_function('select', args: defs))
conf_data.set('HAVE_SENDFILE', compiler.has_function('sendfile', args: defs))
conf_data.set('HAVE_SEND_FILE', compiler.has_function('send_file', args: defs))
conf_data.set('HAVE_SENDFILE64', compiler.has_function('sendfile64', args: defs))
conf_data.set('HAVE_SIGACTION', compiler.has_function('sigaction', args: defs))
conf_data.set('HAVE_SIGNAL', compiler.has_function('signal', args: defs))
conf_data.set('HAVE_SPLICE', compiler.has_function('splice', args: defs))
conf_data.set('HAVE_SRANDOM', compiler.has_function('srandom', args: defs))
conf_data.set('HAVE_STRERROR_R', compiler.has_function('strerror_r', args: defs))
conf_data.set('HAVE_TIMEGM', compiler.has_function('timegm', args: defs))
conf_data.set('HAVE_WRITEV', compiler.has_function('writev', args: defs))
conf_data.set('HAVE_ISSETUGID', compiler.has_function('issetugid', args: defs))
conf_data.set('HAVE_MEMSET_S', compiler.has_function('memset_s', args: defs))
conf_data.set('HAVE_EXPLICIT_BZERO', compiler.has_function('explicit_bzero', args: defs))

Loading…
Cancel
Save