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 "Win"
29 #elif defined(__CYGWIN__)
30 # define SYSTEM_NAME "Cygwin"
31 #elif defined(__linux__)
32 # define SYSTEM_NAME "Linux"
34 # error Unknonw platform!
38 * Detect CPU architecture
40 #if defined(_M_X64) || defined(__x86_64__) || defined(__x86_64) || defined(__amd64)
41 # define SYSTEM_ARCH "x64"
42 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(__X86__) || defined(_X86_)
43 # define SYSTEM_ARCH "x86"
44 #elif defined(_M_ARM) || defined(__arm__) || defined(__arm) || defined(_ARM)
45 # define SYSTEM_ARCH "ARM"
46 #elif defined(_M_ARM64) || defined(__aarch64__)
47 # define SYSTEM_ARCH "ARM64"
48 #elif defined(_M_PPC) || defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC)
49 # define SYSTEM_ARCH "PPC"
50 #elif defined(__powerpc64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
51 # define SYSTEM_ARCH "PPC64"
53 # error Unknonw architecture!
57 * Detect compiler and version
59 #if defined(__clang__)
60 # if defined(__llvm__)
61 # define COMPILER_FMT "Clang/LLVM %u.%u.%u"
62 # elif defined(__c2__)
63 # define COMPILER_FMT "Clang/C2 %u.%u.%u"
65 # error Unknown Clang-based compiler detected!
67 # define COMPILER_ARG __clang_major__, __clang_minor__, __clang_patchlevel__
68 #elif defined(__INTEL_COMPILER)
69 # if defined(__INTEL_COMPILER_UPDATE) && (__INTEL_COMPILER_UPDATE > 0)
70 # define COMPILER_FMT "Intel C++ Compiler %u.%02u.%u"
71 # define COMPILER_ARG __INTEL_COMPILER / 100U, (__INTEL_COMPILER % 100U), __INTEL_COMPILER_UPDATE
73 # define COMPILER_FMT "Intel C++ Compiler %u.%02u"
74 # define COMPILER_ARG __INTEL_COMPILER / 100U, (__INTEL_COMPILER % 100U)
76 #elif defined(__GNUC__)
77 # if defined(__MINGW32__)
78 # define COMPILER_FMT "MinGW/GCC %u.%u.%u"
79 # elif defined(__CYGWIN__)
80 # define COMPILER_FMT "Cygwin/GCC %u.%u.%u"
82 # define COMPILER_FMT "GNU C++ Compiler %u.%u.%u"
84 # define COMPILER_ARG __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
85 #elif defined(_MSC_VER)
86 # if defined(_MSC_BUILD) && (_MSC_BUILD > 0)
87 # define COMPILER_FMT "Microsoft C++ Compiler %u.%02u.%u.%u"
88 # define COMPILER_ARG _MSC_VER / 100U, _MSC_VER % 100U, _MSC_FULL_VER % 1000000U, _MSC_BUILD
90 # define COMPILER_FMT "Microsoft C++ Compiler %u.%02u.%u"
91 # define COMPILER_ARG _MSC_VER / 100U, _MSC_VER % 100U, _MSC_FULL_VER % 1000000U
94 # error Unknonw compiler type!
97 #endif /*INC_MHASH384_SYSINFO_H*/