• Austin Seipp's avatar
    Fix autoconf's check for create_timer() · edc059a4
    Austin Seipp authored
    GHC build system have custom autoconf check for `create_timer()`
    function from librt. Check description says that it checks for
    `CLOCK_REALTIME` timer, but checking code also checks for
    `CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for
    example, FreeBSD doesn't have it). This makes whole check fail despite
    the fact that FreeBSD have `create_timer()` call and supports
    `CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM
    for its timing machinery. Not only it's very ancient codepath, it also
    break some FFI bindings to C code that isn't prepared for syscall
    interruption caused by SIGALRM delivery.
    
    Grepping through ghc source code reveals that `USE_TIMER_CREATE`
    defininition in the config.h doesn't imply having
    `CLOCK_PROCESS_CPUTIME_ID`. The only place where
    `CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code
    handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully.
    
    This patch makes autoconf checking code to check only for
    `timer_create(CLOCK_REALTIME, ...)` and fixes check description.
    
    Reviewed By: austin
    
    Differential Revision: https://phabricator.haskell.org/D831
    edc059a4
aclocal.m4 71.2 KB