Re: [PATCH] Fix for clock_gettime() detection without librt
Reimar Döffinger <[email protected]> Sat, 6 Nov 2021 12:16:24 +0100
| Newsgroups | gmane.comp.video.mplayer.devel |
|---|---|
| Message-ID | <[email protected]> |
> 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. _______________________________________________ MPlayer-dev-eng mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng