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

Alexander Strasser eclipse7 at gmx.net
Sun Nov 7 01:50:05 EET 2021


On 2021-11-06 12:16 +0100, Reimar Döffinger wrote:
>
> > 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.

I have committed a fix as SVN r38326 .

Implemented with a for loop as mentioned by Reimar.

Brad, could you confirm it works for your use case?


Best regards,
  Alexander


More information about the MPlayer-dev-eng mailing list