This module provides portable runtime operating-system detection facilities used throughout the fpx preprocessor.
Supported platforms include:
Detection is performed lazily on first use and cached using OpenMP threadprivate storage, ensuring negligible overhead for repeated queries.
The implementation relies primarily on environment variables, with fallback detection through the presence of well-known operating-system specific files.
This strategy is designed to work reliably in native installations, containers, WSL environments, and most cross-compilation setups.
| integer, parameter, public os_cygwin = 4 |
| integer, parameter, public os_freebsd = 6 |
| integer, parameter, public os_linux = 1 |
| integer, parameter, public os_macos = 2 |
| integer, parameter, public os_solaris = 5 |
| integer, parameter, public os_unknown = 0 |
| integer, parameter, public os_windows = 3 |
| integer, parameter, public os_windowsx86 = 8 |
Native Microsoft Windows running on 32-bit x86 architecture.
This value is returned when the operating system is identified as Windows and the PROCESSOR_ARCHITECTURE environment variable indicates an x86 target.
It can be used when architecture-specific behavior is required.
| integer function, public get_os_type |
Determine the current operating system type Returns one of the OS_* constants.
Detection strategy:
Returns OS_UNKNOWN if no reliable indicator is found.
Examples
| logical function, public os_is_unix | ( | integer, intent(in), optional | os | ) |
Return .true. if the current (or supplied) OS is Unix-like Convenience wrapper that returns .true. for any non-Windows platform. Useful for writing portable code that needs different handling on Windows.
| [in] | os | Optional OS identifier; if absent get_os_type() is called |
Examples
| pure character(:) function, allocatable, public os_name | ( | integer, intent(in) | os | ) |
Return a human-readable string describing the OS type flag Converts any of the OS_* integer constants into its corresponding name. Accepted values include:
| [in] | os | OS identifier from get_os_type() |