I need to check the platform I'm on, meaning: processor, operating system, and operating system version. An example I currently have is i686-apple-darwin10
. How can I obtain the similar string on Linux and Windows? I know that the autotools provide a detection script that produces that string, but I don't recall its name now, and since it's in bash, it won't work on windows.
A related question is: I've never really got to understand the techniques to detect a platform. Are there standards for this ? For example, "i686-apple-darwin10" is one, but also I saw the uname
-uname -p
style: "Linux-i386". What are the best-practices, standard strings and preferred context for each platform string?