Re: [PATCH] Fix for clock_gettime() detection without librt

Alexander Strasser <[email protected]> Sun, 7 Nov 2021 00:50:05 +0100
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
On 2021-11-06 12:16 +0100, Reimar Döffinger wrote:
>
> > On 29 Oct 2021, at 23:03, Brad Smith <[email protected]> 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
_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng