Browse Source

Fix detection of clock_gettime() and clock_nanosleep()

glibc above 2.17 has these functions builtin, so no need to link against librt.

When the macro succeeds, it needs to set the define to 1, not 0.

Also clarify the text message if librt is linked in.
tags/0.126.0
Adrian Knoth 8 years ago
parent
commit
3e26d4ff92
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      configure.ac

+ 4
- 4
configure.ac View File

@@ -258,28 +258,28 @@ AC_EGREP_CPP( ppoll,

AC_CHECK_FUNC(clock_gettime,
[
AC_DEFINE(HAVE_CLOCK_GETTIME,0,"Whether or not clock_gettime can be found in system libraries")
AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries")
],
#
# if not found, check librt specifically
#
AC_CHECK_LIB(rt, clock_gettime,
[
AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries")
AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries (via -lrt)")
OS_LDFLAGS="$OS_LDFLAGS -lrt"
])
)

AC_CHECK_FUNC(clock_nanosleep,
[
AC_DEFINE(HAVE_CLOCK_NANOSLEEP,0,"Whether or not clock_nanosleep can be found in system libraries")
AC_DEFINE(HAVE_CLOCK_NANOSLEEP,1,"Whether or not clock_nanosleep can be found in system libraries")
],
#
# if not found, check librt specifically
#
AC_CHECK_LIB(rt, clock_nanosleep,
[
AC_DEFINE(HAVE_CLOCK_NANOSLEEP,1,"Whether or not clock_nanosleep can be found in system libraries")
AC_DEFINE(HAVE_CLOCK_NANOSLEEP,1,"Whether or not clock_nanosleep can be found in system libraries (via -lrt)")
OS_LDFLAGS="$OS_LDFLAGS -lrt"
])
)


Loading…
Cancel
Save