diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2009-01-29 17:00:40 +0100 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2009-01-29 17:00:40 +0100 |
| commit | ef401997d311c8ba84f5c36bf94a9239ecaf9a5f (patch) | |
| tree | d7641c141461fef62395cf1c6651c0dc52524109 /configure.ac | |
| parent | f0bd2f35ce061a104cd3f220903b16eac95cba39 (diff) | |
| download | btpd-ef401997d311c8ba84f5c36bf94a9239ecaf9a5f.tar.gz btpd-ef401997d311c8ba84f5c36bf94a9239ecaf9a5f.zip | |
Make the timer code work on MacOS as well.
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 8fd64e4..e56a971 100644 --- a/configure.ac +++ b/configure.ac @@ -41,15 +41,32 @@ AC_ARG_WITH(evloop-method, old_LIBS=$LIBS LIBS="" -AC_SEARCH_LIBS(clock_gettime, rt,,AC_MSG_FAILURE(btpd needs clock_gettime)) -AC_SUBST(CLOCKLIB,$LIBS) -LIBS="" AC_SEARCH_LIBS(inet_ntop, nsl,,AC_MSG_FAILURE(btpd needs inet_ntop)) AC_SEARCH_LIBS(bind, socket,,AC_MSG_FAILURE(btpd needs bind)) AC_SUBST(INETLIBS,$LIBS) LIBS=$old_LIBS AC_CHECK_FUNCS(asprintf) +AC_MSG_CHECKING(for CLOCK_MONOTONIC) +AC_COMPILE_IFELSE([ + #include <sys/time.h> + #include <time.h> + int main(void) { return clock_gettime(CLOCK_MONOTONIC, (void *)0); } +], clock_gettime=yes, clock_gettime=no) +AC_MSG_RESULT($clock_gettime) +if test $clock_gettime == yes; then + old_LIBS=$LIBS + LIBS="" + AC_SEARCH_LIBS(clock_gettime,rt,clock_gettime=yes,clock_gettime=no) + AC_SUBST(CLOCKLIB,$LIBS) + LIBS=$old_LIBS + AC_DEFINE(HAVE_CLOCK_MONOTONIC) +fi +if test $clock_gettime == no; then + AC_CHECK_FUNCS(mach_absolute_time,, + AC_MSG_FAILURE(no supported time mechanism found)) +fi + AC_MSG_CHECKING(whether compiler accepts -Wno-pointer-sign) CC_ARGS_OK_IFELSE(-Wno-pointer-sign, AC_SUBST(WARNNPS,"-Wno-pointer-sign") |