dclib-system.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /***************************************************************************
  2. * *
  3. * _____ ____ *
  4. * | __ \ / __ \ _ _ _____ *
  5. * | | \ \ / / \_\ | | | | _ \ *
  6. * | | \ \| | | | | | |_| | *
  7. * | | | || | | | | | ___/ *
  8. * | | / /| | __ | | | | _ \ *
  9. * | |__/ / \ \__/ / | |___| | |_| | *
  10. * |_____/ \____/ |_____|_|_____/ *
  11. * *
  12. * Wiimms source code library *
  13. * *
  14. ***************************************************************************
  15. * *
  16. * Copyright (c) 2012-2022 by Dirk Clemens <wiimm@wiimm.de> *
  17. * *
  18. ***************************************************************************
  19. * *
  20. * This library is free software; you can redistribute it and/or modify *
  21. * it under the terms of the GNU General Public License as published by *
  22. * the Free Software Foundation; either version 2 of the License, or *
  23. * (at your option) any later version. *
  24. * *
  25. * This library is distributed in the hope that it will be useful, *
  26. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  27. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  28. * GNU General Public License for more details. *
  29. * *
  30. * See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt *
  31. * *
  32. ***************************************************************************/
  33. #ifndef DCLIB_SYSTEM_H
  34. #define DCLIB_SYSTEM_H 1
  35. #ifndef PRINT_SYSTEM_SETTINGS
  36. #include <stdio.h>
  37. #endif
  38. ///////////////////////////////////////////////////////////////////////////////
  39. #ifndef PRINT_SYSTEM_SETTINGS
  40. typedef enum enumSystemID
  41. {
  42. SYSID_UNKNOWN = 0x00000000,
  43. SYSID_I386 = 0x01000000,
  44. SYSID_X86_64 = 0x02000000,
  45. SYSID_CYGWIN32 = 0x03000000,
  46. SYSID_CYGWIN64 = 0x04000000,
  47. SYSID_MAC_I386 = 0x05000000,
  48. SYSID_MAC_X64 = 0x06000000,
  49. SYSID_MAC_ARM = 0x07000000,
  50. SYSID_LINUX = 0x08000000,
  51. SYSID_UNIX = 0x09000000,
  52. } enumSystemID;
  53. #endif
  54. ///////////////////////////////////////////////////////////////////////////////
  55. #undef SYSTEM_LINUX
  56. #ifdef __CYGWIN__
  57. #define SYSTEM_LINUX 0
  58. #define SYSTEM "cygwin"
  59. #ifdef __x86_64
  60. #define SYSTEM2 "cygwin64"
  61. #define SYSTEMID SYSID_CYGWIN64
  62. #else
  63. #define SYSTEM2 "cygwin32"
  64. #define SYSTEMID SYSID_CYGWIN32
  65. #endif
  66. #elif __APPLE__
  67. #define SYSTEM_LINUX 0
  68. #define SYSTEM "mac"
  69. #ifdef __aarch64__
  70. #define SYSTEM2 "mac/arm"
  71. #define SYSTEMID SYSID_MAC_ARM
  72. #elif __x86_64__
  73. #define SYSTEM2 "mac/x64"
  74. #define SYSTEMID SYSID_MAC_X64
  75. #else
  76. #define SYSTEM2 "mac/i386"
  77. #define SYSTEMID SYSID_MAC_I386
  78. #endif
  79. #elif __linux__
  80. #define SYSTEM_LINUX 1
  81. #ifdef __i386__
  82. #define SYSTEM "i386"
  83. #define SYSTEMID SYSID_I386
  84. #elif __x86_64__
  85. #define SYSTEM "x86_64"
  86. #define SYSTEMID SYSID_X86_64
  87. #else
  88. #define SYSTEM "linux"
  89. #define SYSTEMID SYSID_LINUX
  90. #endif
  91. #elif __unix__
  92. #define SYSTEM_LINUX 0
  93. #define SYSTEM "unix"
  94. #define SYSTEMID SYSID_UNIX
  95. #else
  96. #define SYSTEM "unknown"
  97. #define SYSTEMID SYSID_UNKNOWN
  98. #endif
  99. #ifndef SYSTEM2
  100. #define SYSTEM2 SYSTEM
  101. #endif
  102. ///////////////////////////////////////////////////////////////////////////////
  103. #ifndef PRINT_SYSTEM_SETTINGS
  104. static inline void dclibPrintSystem ( FILE * f )
  105. {
  106. fprintf(f,
  107. "SYSTEM\t\t:= %s\n"
  108. "SYSTEM2\t\t:= %s\n"
  109. "SYSTEMID\t:= 0x%x\n"
  110. #ifdef SYSTEM_LINUX
  111. "SYSTEM_LINUX\t:= 1\n"
  112. #endif
  113. ,SYSTEM
  114. ,SYSTEM2
  115. ,SYSTEMID
  116. );
  117. }
  118. #endif
  119. ///////////////////////////////////////////////////////////////////////////////
  120. #ifdef PRINT_SYSTEM_SETTINGS
  121. result_SYSTEM=SYSTEM
  122. result_SYSTEM2=SYSTEM2
  123. result_SYSTEM_LINUX=SYSTEM_LINUX
  124. #endif
  125. #endif // DCLIB_SYSTEM_H 1