IdCompilerDefines_FPC.inc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // detect compiler version
  2. {$MACRO ON} // must be on in order to use versioning macros
  3. {$IF FPC_FULLVERSION < 30000}
  4. {$Error Unsupported compiler version detected!}
  5. {$IFEND}
  6. {$IF FPC_FULLVERSION >= 30301}
  7. {$DEFINE FPC_3_3_1_OR_ABOVE}
  8. {$IFEND}
  9. {$IF FPC_FULLVERSION >= 30101}
  10. {$DEFINE FPC_3_1_1_OR_ABOVE}
  11. {$IFEND}
  12. {$DEFINE FPC_3_0_0_OR_ABOVE}
  13. // In FreePascal 3.0.0+, a Delphi-like UnicodeString type is supported.
  14. // String/(P)Char map to UnicodeString/(P)WideChar if {$MODE DelphiUnicode}
  15. // or {$MODESWITCH UnicodeStrings} is used. We are enabling them so Indy
  16. // uses the same Unicode logic in Delphi 2009+ and FreePascal 3.0.0+ and
  17. // reduces IFDEFs (in particular, STRING_UNICODE_MISMATCH, see further below).
  18. // However, FreePascal's RTL is largely not UnicodeString-enabled yet, so we
  19. // will have to deal with that as needed...
  20. {$MODE DelphiUnicode}
  21. {$CODEPAGE UTF8} // needed for Unicode string literals to work properly
  22. //note that we may need further defines for widget types depending on
  23. //what we do and what platforms we support in FPC.
  24. //I'll let Marco think about that one.
  25. {$IFDEF UNIX}
  26. //In Linux for I386, you can choose between a Kylix-libc API or
  27. //the standard RTL Unix API. Just pass -dKYLIXCOMPAT to the FPC compiler.
  28. //I will see what I can do about the Makefile.
  29. {$IF DEFINED(LINUX) AND DEFINED(KYLIXCOMPAT) AND DEFINED(CPUI386)}
  30. {$UNDEF USE_BASEUNIX}
  31. {$ELSE}
  32. {$DEFINE USE_BASEUNIX}
  33. {$IFEND}
  34. {$IFDEF USE_BASEUNIX}
  35. {$UNDEF KYLIXCOMPAT}
  36. {$ENDIF}
  37. {$ENDIF}
  38. // FreePascal's RTL mimic D7's RTL
  39. // TODO: replace these with appropriate HAS_xxx defines instead...
  40. {.$DEFINE DCC_7)
  41. {.$DEFINE DELPHI_7)
  42. {.$DEFINE DCC_7_OR_ABOVE)
  43. // available features
  44. {.$DEFINE HAS_RemoveFreeNotification}
  45. {.$DEFINE HAS_IInterface}
  46. {.$DEFINE HAS_TSelectionEditor}
  47. {.$DEFINE HAS_TStringList_CaseSensitive}
  48. {.$DEFINE HAS_SYMBOL_PLATFORM}
  49. {.$DEFINE HAS_UNIT_PLATFORM}
  50. {$DEFINE USE_INLINE}
  51. {$DEFINE USE_CLASSINLINE}
  52. {$DEFINE USE_TBitBtn} //use Bit Buttons instead of Buttons
  53. {$DEFINE FPC_REINTRODUCE_BUG}
  54. {$DEFINE FPC_CIRCULAR_BUG}
  55. {$DEFINE NO_REDECLARE}
  56. {$DEFINE BYTE_COMPARE_SETS}
  57. {$DEFINE HAS_QWord}
  58. {$DEFINE HAS_PQWord}
  59. {$DEFINE HAS_InterlockedCompareExchange_Pointers}
  60. {$DEFINE HAS_SharedSuffix}
  61. // these types are only available on Unix systems (FreeBSD, Linux, etc)
  62. {$IFDEF UNIX}
  63. {$DEFINE HAS_UNIT_UnixType}
  64. {$DEFINE HAS_SIZE_T}
  65. {$DEFINE HAS_PSIZE_T}
  66. {$DEFINE HAS_SSIZE_T}
  67. {$DEFINE HAS_PSSIZE_T}
  68. {$DEFINE HAS_TIME_T}
  69. {$DEFINE HAS_PTIME_T}
  70. {$ENDIF}
  71. {$DEFINE HAS_PtrInt}
  72. {$DEFINE HAS_PtrUInt}
  73. {$DEFINE HAS_LPGUID}
  74. {$DEFINE HAS_PPAnsiChar}
  75. {$IFDEF WINDOWS}
  76. {$DEFINE HAS_ULONG_PTR}
  77. {.$DEFINE HAS_ULONGLONG} // TODO: is this defined?
  78. {$ENDIF}
  79. {$DEFINE HAS_UNIT_ctypes}
  80. {$IFNDEF FPUNONE}
  81. {$DEFINE HAS_TIMEUNITS} // TODO: when were they introduced?
  82. {$ENDIF}
  83. {$DEFINE HAS_TThread_NameThreadForDebugging}
  84. {$DEFINE DEPRECATED_TThread_SuspendResume}
  85. {$DEFINE HAS_NativeInt}
  86. {$DEFINE HAS_NativeUInt}
  87. {$DEFINE HAS_PInt8}
  88. {$DEFINE HAS_PUInt8}
  89. {$DEFINE HAS_PInt16}
  90. {$DEFINE HAS_PUInt16}
  91. {$DEFINE HAS_PInt32}
  92. {$DEFINE HAS_PUInt32}
  93. {$DEFINE HAS_GetLocalTimeOffset}
  94. {$DEFINE HAS_UniversalTimeToLocal}
  95. {$DEFINE HAS_LocalTimeToUniversal}
  96. {$IFDEF FPC_3_1_1_OR_ABOVE}
  97. {$DEFINE HAS_STATIC_TThread_ForceQueue} // requires rev 37359+
  98. {$DEFINE HAS_PRawByteString}
  99. {$DEFINE HAS_UIntToStr} // requires rev 40529+
  100. {$ENDIF}
  101. {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
  102. {$DEFINE REQUIRES_PROPER_ALIGNMENT}
  103. {$ENDIF}
  104. //IMPORTANT!!!!
  105. //
  106. //In DCC, MACOS means OS X. In FreePascal, MACOS means MacIntosh System OS Classic.
  107. //FPC defines DARWIN for both OSX and iOS, need to differentiate
  108. {$IF DEFINED(DARWIN) AND (NOT DEFINED(IOS))}
  109. {$DEFINE OSX}
  110. {$IFEND}
  111. {$IFDEF MACOS}
  112. {$DEFINE MACOS_CLASSIC}
  113. {$ENDIF}
  114. {$DEFINE WIDGET_LCL}
  115. {$IFDEF KYLIXCOMPAT}
  116. {$linklib c}
  117. {$ENDIF}