What are possible values for the "os" function from the System.Info package in the Standard Libraries?
Also: Are these values reliable, are they portable across many compilers? Will Hugs on windows return the same value as ghc on windows?
Are there better ways for sniffing for the operating system?
The variables for GHC are taken from the "autotools" tool suite, the tool suite that produces the well-known "configure" scripts that are almost always used when compiling something (./configure; make; make install
). configure
uses a standard "compiler identification string" like x86_64-unknown-linux-gnu
for C compilers, and additionally computes a more detailed set of variables that identify the host platform. These variables are used in the generated Makefile
of GHC, and this file further produces the ghcplatform.h
file you see in the Info.hs
file.
Almost the exact same procedure is used by HUGS to get the platform variables, except that the header file is named differently (as you are able to see in the source code that you linked).
Since both GHC and HUGS98 on Windows are compiled with MinGW and autotools as well, the variables are consistent on that platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With