1 /* ---------------------------------------------------------------------------------------------- */
2 /* MHash-384 - Simple fast portable secure hashing library */
3 /* Copyright(c) 2016-2020 LoRd_MuldeR <mulder2@gmx.de> */
5 /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software */
6 /* and associated documentation files (the "Software"), to deal in the Software without */
7 /* restriction, including without limitation the rights to use, copy, modify, merge, publish, */
8 /* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the */
9 /* Software is furnished to do so, subject to the following conditions: */
11 /* The above copyright notice and this permission notice shall be included in all copies or */
12 /* substantial portions of the Software. */
14 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING */
15 /* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
16 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
17 /* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
18 /* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
19 /* ---------------------------------------------------------------------------------------------- */
21 #ifndef INC_MHASH384_SYSINFO_H
22 #define INC_MHASH384_SYSINFO_H
25 * Detect operating system
28 # define SYSTEM_NAME "Windows"
29 #elif defined(__CYGWIN__)
30 # define SYSTEM_NAME "Cygwin"
31 #elif defined(__linux__)
32 # define SYSTEM_NAME "Linux"
33 #elif defined(__FreeBSD__)
34 # define SYSTEM_NAME "FreeBSD"
35 #elif defined(__NetBSD__)
36 # define SYSTEM_NAME "NetBSD"
37 #elif defined(__OpenBSD__)
38 # define SYSTEM_NAME "OpenBSD"
40 # define SYSTEM_NAME "Solaris"
41 #elif defined(__unix__)
42 # define SYSTEM_NAME "Unix"
44 # error Unknonw platform!
48 * Detect CPU architecture
50 #if defined(_M_X64) || defined(__x86_64__) || defined(__x86_64) || defined(__amd64)
51 # define SYSTEM_ARCH "x64"
52 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(__X86__) || defined(_X86_)
53 # define SYSTEM_ARCH "x86"
54 #elif defined(_M_ARM) || defined(__arm__) || defined(__arm) || defined(_ARM)
55 # define SYSTEM_ARCH "ARM"
56 #elif defined(_M_ARM64) || defined(__aarch64__)
57 # define SYSTEM_ARCH "ARM64"
58 #elif defined(_M_PPC) || defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC)
59 # define SYSTEM_ARCH "PPC"
60 #elif defined(__powerpc64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
61 # define SYSTEM_ARCH "PPC64"
63 # error Unknonw architecture!
67 * Detect compiler and version
69 #if defined(__clang__)
70 # if defined(__llvm__)
71 # define COMPILER_FMT "Clang/LLVM %u.%u.%u"
72 # elif defined(__c2__)
73 # define COMPILER_FMT "Clang/C2 %u.%u.%u"
75 # error Unknown Clang-based compiler detected!
77 # define COMPILER_ARG __clang_major__, __clang_minor__, __clang_patchlevel__
78 #elif defined(__INTEL_COMPILER)
79 # if defined(__INTEL_COMPILER_UPDATE) && (__INTEL_COMPILER_UPDATE > 0)
80 # define COMPILER_FMT "Intel C++ Compiler %u.%02u.%u"
81 # define COMPILER_ARG __INTEL_COMPILER / 100U, (__INTEL_COMPILER % 100U), __INTEL_COMPILER_UPDATE
83 # define COMPILER_FMT "Intel C++ Compiler %u.%02u"
84 # define COMPILER_ARG __INTEL_COMPILER / 100U, (__INTEL_COMPILER % 100U)
86 #elif defined(__GNUC__)
87 # if defined(__MINGW32__)
88 # define COMPILER_FMT "MinGW/GCC %u.%u.%u"
89 # elif defined(__CYGWIN__)
90 # define COMPILER_FMT "Cygwin/GCC %u.%u.%u"
92 # define COMPILER_FMT "GNU C++ Compiler %u.%u.%u"
94 # define COMPILER_ARG __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
95 #elif defined(_MSC_VER)
96 # if defined(_MSC_BUILD) && (_MSC_BUILD > 0)
97 # define COMPILER_FMT "Microsoft C++ Compiler %u.%02u.%u.%u"
98 # define COMPILER_ARG _MSC_VER / 100U, _MSC_VER % 100U, _MSC_FULL_VER % 1000000U, _MSC_BUILD
100 # define COMPILER_FMT "Microsoft C++ Compiler %u.%02u.%u"
101 # define COMPILER_ARG _MSC_VER / 100U, _MSC_VER % 100U, _MSC_FULL_VER % 1000000U
104 # error Unknonw compiler type!
107 #endif /*INC_MHASH384_SYSINFO_H*/