Browse Source

[build_cmake] clock_gettime() -lrt w/ glibc < 2.17 (fixes #2737)

clock_gettime() needs -lrt with glibc < 2.17,
and possibly other platforms

This commit contains fixes for CMake and SCONS
See also commit:4d920466 which updated configure.ac for same

x-ref:
  "1.4.40 compiling issuses on Debian Wheezy"
  https://redmine.lighttpd.net/issues/2737
personal/stbuehler/mod-csrf-old
Glenn Strauss 5 years ago
parent
commit
1ebc83f11f
  1. 5
      SConstruct
  2. 5
      src/CMakeLists.txt

5
SConstruct

@ -210,7 +210,7 @@ if 1:
gethostbyname poll epoll_ctl getrlimit chroot \
getuid select signal pathconf madvise prctl\
writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton \
memset_s explicit_bzero'))
memset_s explicit_bzero clock_gettime'))
checkTypes(autoconf, Split('pid_t size_t off_t'))
@ -232,6 +232,9 @@ if 1:
else:
checkFuncs(autoconf, ['crypt', 'crypt_r']);
if autoconf.CheckLibWithHeader('rt', 'time.h', 'c', 'clock_gettime(CLOCK_MONOTONIC, (struct timespec*)0);'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_CLOCK_GETTIME' ], LIBS = [ 'rt' ])
if autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ], LIBUUID = 'uuid')

5
src/CMakeLists.txt

@ -1,6 +1,7 @@
include(CheckCSourceCompiles)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckVariableExists)
include(CheckTypeSize)
include(CheckLibraryExists)
@ -157,6 +158,10 @@ check_function_exists(issetugid HAVE_ISSETUGID)
check_function_exists(inet_pton HAVE_INET_PTON)
check_function_exists(memset_s HAVE_MEMSET_S)
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if (NOT HAVE_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
endif()
check_c_source_compiles("
#include <sys/types.h>
#include <sys/socket.h>

Loading…
Cancel
Save