From 719e58740ba84f2c9e9a051fd6826f92f212565f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 2 Feb 2014 08:34:53 -0700 Subject: [PATCH] Fix clock_gettime() detection when it lives in librt. Some systems have inet_aton() in libresolv (older Solaris). --- configure | 10 +++++++--- configure.ac | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 8547fa417..d1a6def87 100755 --- a/configure +++ b/configure @@ -1703,7 +1703,7 @@ Optional Packages: --without-interfaces don't try to read the ip addr of ether interfaces --with-stow deprecated --with-askpass=PATH Fully qualified pathname of askpass helper - --with-plugindir set directory to load plugins from + --with-plugindir=DIR set directory to load plugins from --with-man manual pages use man macros --with-mdoc manual pages use mdoc macros --with-selinux enable SELinux support @@ -17937,7 +17937,11 @@ 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 : - SUDOERS_LIBS="${SUDOERS_LIBS} -lrt" + + $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + + SUDOERS_LIBS="${SUDOERS_LIBS} -lrt" + else case " $LIBOBJS " in *" clock_gettime.$ac_objext "* ) ;; @@ -18603,7 +18607,7 @@ if test "x$ac_cv_func_inet_aton" = xyes; then : else - for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do + for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do _libs= for lib in $libs; do case "$NET_LIBS" in diff --git a/configure.ac b/configure.ac index 091292b44..4657409ef 100644 --- a/configure.ac +++ b/configure.ac @@ -2409,7 +2409,10 @@ SUDO_FUNC_ISBLANK AC_REPLACE_FUNCS(memrchr memset_s pw_dup strlcpy strlcat strtonum) AC_CHECK_FUNCS(clock_gettime, [], [ # On Solaris, clock_gettime is in librt - AC_CHECK_LIB(rt, clock_gettime, [SUDOERS_LIBS="${SUDOERS_LIBS} -lrt"], [AC_LIBOBJ(clock_gettime)]) + AC_CHECK_LIB(rt, clock_gettime, [ + AC_DEFINE(HAVE_CLOCK_GETTIME) + SUDOERS_LIBS="${SUDOERS_LIBS} -lrt" + ], [AC_LIBOBJ(clock_gettime)]) ]) AC_CHECK_FUNCS(getopt_long, [], [AC_LIBOBJ(getopt_long) AC_MSG_CHECKING([for optreset]) @@ -2526,9 +2529,10 @@ AC_CHECK_FUNC(socket, [], [ dnl dnl If inet_aton(3) not in libc, check -lnsl and -linet dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols +dnl Some systems have inet_aton() in libresolv (older Solaris). dnl AC_CHECK_FUNC(inet_aton, [], [ - for libs in "-lsocket" "-linet" "-lsocket -lnsl"; do + for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do _libs= for lib in $libs; do case "$NET_LIBS" in -- 2.40.0