autofs-5.1.2 - build: check for clock_gettime in librt From: Gustavo Zacarias Glibc versions older than 2.17 define clock_gettime() in librt, so add a check for this. Signed-off-by: Gustavo Zacarias Signed-off-by: Ian Kent --- CHANGELOG | 1 + Makefile.conf.in | 3 +++ Makefile.rules | 2 ++ configure | 44 ++++++++++++++++++++++++++++++++++++++++++++ configure.in | 4 ++++ 5 files changed, 54 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d31bb80..2e51f62 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ xx/xx/2016 autofs-5.1.3 ======================= - fix release date in CHANGELOG. +- build: check for clock_gettime in librt. 15/06/2016 autofs-5.1.2 ======================= diff --git a/Makefile.conf.in b/Makefile.conf.in index cb53e66..2bc3202 100644 --- a/Makefile.conf.in +++ b/Makefile.conf.in @@ -11,6 +11,9 @@ DAEMON_CFLAGS = @DAEMON_CFLAGS@ DAEMON_LDFLAGS = @DAEMON_LDFLAGS@ +# Glibc < 2.17 requires librt for clock_gettime() +LIBCLOCK_GETTIME = @LIBCLOCK_GETTIME@ + # Special parameters for glibc (libc 6) LIBNSL = @LIBNSL@ LIBRESOLV = @LIBRESOLV@ diff --git a/Makefile.rules b/Makefile.rules index 6fa3e02..7d1af2e 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -56,6 +56,8 @@ endif LIBS += $(LIBNSL) +LIBS += $(LIBCLOCK_GETTIME) + # Standard rules .SUFFIXES: .c .o .s .so diff --git a/configure b/configure index 3e2de6f..6ae1f97 100755 --- a/configure +++ b/configure @@ -644,6 +644,7 @@ LIBHESIOD HAVE_HESIOD LIBRESOLV LIBNSL +LIBCLOCK_GETTIME KRB5_CONFIG XML_CONFIG sssldir @@ -4206,6 +4207,49 @@ $as_echo "#define WITHOUT_VERSIONSORT 1" >>confdefs.h fi +# glibc < 2.17 needs librt for clock_gettime() +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : + LIBCLOCK_GETTIME="-lrt" +fi + + + # # glibc/libc 6 new libraries # diff --git a/configure.in b/configure.in index 25d7c4e..a4318e8 100644 --- a/configure.in +++ b/configure.in @@ -177,6 +177,10 @@ if test "$ac_cv_search_versionsort" = "no"; then [Define if your C library does not provide versionsort]) fi +# glibc < 2.17 needs librt for clock_gettime() +AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt") +AC_SUBST(LIBCLOCK_GETTIME) + # # glibc/libc 6 new libraries #