configure and clock_gettime for macOS

Jef Driesen jef at libdivecomputer.org
Fri Sep 7 08:07:13 CEST 2018


On 2018-09-04 19:00, Peter Balck wrote:
> Found a problem regarding the timer.c ifdefs in the dc_timer_new 
> function..
> When I build libdivecomputer on my mac running the latest version of
> macOS the configure script will find the clock_gettime function and
> define HAVE_CLOCK_GETTIME. This however, will cause anyone running my
> app on an older version of macOS where clock_gettime is not available
> to crash.

It seems the clock_gettime() function was added in Mac OS X 10.12 
(Sierra), but is not available in earlier versions. Thus when you build 
on Sierra (or later), the presence of the function is correctly detected 
and the build should run just fine. But when you try to run the same 
build on an older version, it fails because it will try to call a 
non-existing function.

> Is there an easy way to override the configure script without changing
> any of the source or config files ?

Yes, you can override the autoconf test as follows:

./configure ac_cv_func_clock_gettime=no

> I also found that logs downloaded from the Mares Smart Apnea have the
> max and min temperature mixed up.

I'll have a look at it. Can you provide some test data (e.g. a memory 
dump)?

Jef


More information about the devel mailing list