GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgm2

libgm2: Update clock_gettime configuration to match libstdc++ for broader compatibility.

libgm2's configuration now probes for clock_gettime even on non-POSIX compliant systems, improving cross-platform support.

This commit modifies libgm2’s configuration process to align with libstdc++, allowing it to detect and use clock_gettime and nanosleep even on platforms that do not strictly claim POSIX compliance. Previously, the configuration tests were gated by POSIX compliance flags, preventing the discovery of these APIs on systems like Darwin where they have long been available.

By removing this strict gating, libgm2 can now leverage these modern time-keeping functions on a wider range of operating systems, improving its portability and reliability.

In Details

The configure.ac and acinclude.m4 scripts for libgm2 are updated to allow detection of clock_gettime and nanosleep on platforms like Darwin, even when these platforms do not strictly define _POSIX_TIMERS or _POSIX_MONOTONIC_CLOCK. This change aligns libgm2's configuration probes with those of libstdc++, ensuring that these timing functionalities are correctly identified and utilized when available, regardless of the system's declared POSIX compliance level.

For Context
libgm2
A library within GCC, likely for the GNU Modula-2 language, that includes runtime and configuration components.
clock_gettime
A POSIX function that provides a high-resolution timestamp from a specified clock, such as the system's real-time clock or a monotonic clock.
nanosleep
A POSIX function used to suspend execution for a specified interval of nanoseconds.
autoconf
A tool that automatically configures source code packages to adapt to a particular operating system when compiling them. It generates shell scripts to probe system characteristics.
Darwin
The Darwin operating system is the open-source core of macOS, iOS, and other Apple operating systems.
Filed Under: libgm2configureportabilitytime