From: Yann E. MORIN Date: Tue, 5 Jul 2016 13:31:28 +0000 (+0200) Subject: configure: also check for clockgettime() X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6e83f8b261a05afe7bf9fdb9005c4c1aa3e97fed;p=liboping.git configure: also check for clockgettime() clock_gettime() is also in -lrt so we also need to check for it. Use AC_SEARCH_LIBS() instead of our canned combo of AC_CHECK_FUNC() + AC_CHECK_LIB(). AC_SEARCH_LIBS() will automatically add the necessary -l flags to the LIBS variable, so we don't need out AM_CONDITIONAL() construct either, now. Signed-off-by: "Yann E. MORIN" --- diff --git a/configure.ac b/configure.ac index f83f5ab..aea4efb 100644 --- a/configure.ac +++ b/configure.ac @@ -199,12 +199,10 @@ fi AC_SUBST(LIBOPING_PC_LIBS_PRIVATE) -nanosleep_needs_rt="no" -AC_CHECK_FUNCS(nanosleep, [], - AC_CHECK_LIB(rt, nanosleep, - [nanosleep_needs_rt="yes"], - AC_MSG_ERROR(cannot find nanosleep))) -AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes") +AC_SEARCH_LIBS([nanosleep],[rt],[], + [AC_MSG_ERROR([cannot find nanosleep])]) +AC_SEARCH_LIBS([clock_gettime],[rt],[], + [AC_MSG_ERROR([cannot find clock_gettime])]) with_ncurses="no" AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], []) diff --git a/src/Makefile.am b/src/Makefile.am index ec4c398..090d1b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,9 +35,6 @@ bin_PROGRAMS = oping oping_SOURCES = oping.c oping_LDADD = liboping.la -lm -if BUILD_WITH_LIBRT -oping_LDADD += -lrt -endif if BUILD_WITH_LIBNCURSES bin_PROGRAMS += noping @@ -45,9 +42,6 @@ bin_PROGRAMS += noping noping_SOURCES = oping.c noping_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_NCURSES=1 noping_LDADD = liboping.la -lm $(NCURSES_LIB) -if BUILD_WITH_LIBRT -noping_LDADD += -lrt -endif endif # BUILD_WITH_LIBNCURSES install-exec-hook: