[MPlayer-dev-eng] [PATCH] Fix for clock_gettime() detection without librt

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Nov 6 13:16:24 EET 2021


> On 29 Oct 2021, at 23:03, Brad Smith <brad at comstyle.com> wrote:
> 
> Fix clock_gettime() detection on OS's that do not have librt such as OpenBSD.
> 
> -statement_check_broken stddef.h time.h 'struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp)' -lrt &&
> -    { clock_gettime=yes ; def_clock_gettime='#define HAVE_CLOCK_GETTIME 1' ; extra_ldflags="$extra_ldflags -lrt" ; }
> +statement_check_broken stddef.h time.h 'struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp)' &&
> +    { clock_gettime=yes ; def_clock_gettime='#define HAVE_CLOCK_GETTIME 1' ; }
> +if test "$clock_gettime" = no ; then
> +  statement_check_broken stddef.h time.h 'struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp)' -lrt &&
> +      { clock_gettime=yes ; def_clock_gettime='#define HAVE_CLOCK_GETTIME 1' ; extra_ldflags="$extra_ldflags -lrt" ; }
> +fi

We usually handle this with a loop instead of by duplicating the code.
Search for “for ld_tmp in” in configure for examples.



More information about the MPlayer-dev-eng mailing list