Code

configure: also check for clockgettime()
authorYann E. MORIN <yann.morin.1998@free.fr>
Tue, 5 Jul 2016 13:31:28 +0000 (15:31 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Thu, 14 Jul 2016 09:48:02 +0000 (11:48 +0200)
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" <yann.morin.1998@free.fr>
configure.ac
src/Makefile.am

index f83f5ab7a15667e263c1a6f30f5a7f8395af3296..aea4efba1b9d9c0d92ad30af0d89dfe3692d5f06 100644 (file)
@@ -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"], [])
index ec4c398e933f2f06f3ba675035a574217eeea3b0..090d1b2947dda30682d811398a7e526ea640e452 100644 (file)
@@ -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: