This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=a96229021f8f5fbccae7dfeb7aa194d21d532ce5 commit a96229021f8f5fbccae7dfeb7aa194d21d532ce5 (HEAD -> main) Author: Guillem Jover <[email protected]> AuthorDate: Sun Mar 26 23:39:31 2023 +0200 build: Detect whether we need librt for clock_gettime() On some systems clock_gettime() is part of the librt real-time library, on some others it is part of libc (including latest glibc releases). --- configure.ac | 2 ++ lib/dpkg/Makefile.am | 2 +- m4/dpkg-libs.m4 | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6864405fb..63982ea67 100644 --- a/configure.ac +++ b/configure.ac @@ -93,6 +93,7 @@ DPKG_CODE_COVERAGE AC_SYS_LARGEFILE # Checks for libraries. +DPKG_LIB_RT DPKG_LIB_MD DPKG_LIB_Z DPKG_LIB_BZ2 @@ -297,6 +298,7 @@ Configuration: dselect . . . . . . . . . . . : $build_dselect System Libraries: + librt . . . . . . . . . . . . : $have_librt libsocket . . . . . . . . . . : ${have_libsocket:-no} libps . . . . . . . . . . . . : ${have_libps:-no} libkvm . . . . . . . . . . . : ${have_libkvm:-no} diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am index 5b33351e5..c21106502 100644 --- a/lib/dpkg/Makefile.am +++ b/lib/dpkg/Makefile.am @@ -237,7 +237,7 @@ test_data = \ # EOL BENCHMARK_LDADD_FLAGS = \ - -lrt \ + $(RT_LIBS) \ $(LDADD) \ # EOL diff --git a/m4/dpkg-libs.m4 b/m4/dpkg-libs.m4 index 556446a54..f1eba330b 100644 --- a/m4/dpkg-libs.m4 +++ b/m4/dpkg-libs.m4 @@ -198,6 +198,23 @@ AC_DEFUN([DPKG_LIB_CURSES], [ have_libcurses=yes ])# DPKG_LIB_CURSES +# DPKG_LIB_RT +# ----------- +# Check for rt library +AC_DEFUN([DPKG_LIB_RT], [ + AC_ARG_VAR([RT_LIBS], [linker flags for rt library])dnl + have_librt="no" + dpkg_save_librt_LIBS=$LIBS + AC_SEARCH_LIBS([clock_gettime], [rt]) + LIBS=$dpkg_save_librt_LIBS + AS_IF([test "x$ac_cv_search_clock_gettime" = "xnone required"], [ + have_librt="builtin" + ], [test "x$ac_cv_search_clock_gettime" != "xno"], [ + have_librt="yes" + RT_LIBS="$ac_cv_search_clock_gettime" + ]) +])# DPKG_LIB_RT + # DPKG_LIB_SOCKET # --------------- # Check for socket library -- Dpkg.Org's dpkg

