lt_system.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* lt_system.h -- system portability abstraction layer
  2. Copyright (C) 2004, 2007, 2010-2015 Free Software Foundation, Inc.
  3. Written by Gary V. Vaughan, 2004
  4. NOTE: The canonical source of this file is maintained with the
  5. GNU Libtool package. Report bugs to bug-libtool@gnu.org.
  6. GNU Libltdl is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2 of the License, or (at your option) any later version.
  10. As a special exception to the GNU Lesser General Public License,
  11. if you distribute this file as part of a program or library that
  12. is built using GNU Libtool, you may include this file under the
  13. same distribution terms that you use for the rest of that program.
  14. GNU Libltdl is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. GNU Lesser General Public License for more details.
  18. You should have received a copy of the GNU Lesser General Public
  19. License along with GNU Libltdl; see the file COPYING.LIB. If not, a
  20. copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
  21. or obtained by writing to the Free Software Foundation, Inc.,
  22. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  23. */
  24. #if !defined LT_SYSTEM_H
  25. #define LT_SYSTEM_H 1
  26. #include <stddef.h>
  27. #include <stdlib.h>
  28. #include <sys/types.h>
  29. /* Some systems do not define EXIT_*, even with STDC_HEADERS. */
  30. #if !defined EXIT_SUCCESS
  31. # define EXIT_SUCCESS 0
  32. #endif
  33. #if !defined EXIT_FAILURE
  34. # define EXIT_FAILURE 1
  35. #endif
  36. /* Just pick a big number... */
  37. #define LT_FILENAME_MAX 2048
  38. /* Saves on those hard to debug '\0' typos.... */
  39. #define LT_EOS_CHAR '\0'
  40. /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations,
  41. so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at
  42. the end of C declarations. */
  43. #if defined __cplusplus
  44. # define LT_BEGIN_C_DECLS extern "C" {
  45. # define LT_END_C_DECLS }
  46. #else
  47. # define LT_BEGIN_C_DECLS /* empty */
  48. # define LT_END_C_DECLS /* empty */
  49. #endif
  50. /* LT_STMT_START/END are used to create macros that expand to a
  51. a single compound statement in a portable way. */
  52. #if defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __cplusplus
  53. # define LT_STMT_START (void)(
  54. # define LT_STMT_END )
  55. #else
  56. # if (defined sun || defined __sun__)
  57. # define LT_STMT_START if (1)
  58. # define LT_STMT_END else (void)0
  59. # else
  60. # define LT_STMT_START do
  61. # define LT_STMT_END while (0)
  62. # endif
  63. #endif
  64. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  65. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  66. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  67. relocations are performed -- see ld's documentation on pseudo-relocs. */
  68. # define LT_DLSYM_CONST
  69. #elif defined __osf__
  70. /* This system does not cope well with relocations in const data. */
  71. # define LT_DLSYM_CONST
  72. #else
  73. # define LT_DLSYM_CONST const
  74. #endif
  75. /* Canonicalise Windows and Cygwin recognition macros.
  76. To match the values set by recent Cygwin compilers, make sure that if
  77. __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
  78. #if defined __CYGWIN32__ && !defined __CYGWIN__
  79. # define __CYGWIN__ __CYGWIN32__
  80. #endif
  81. #if defined __CYGWIN__
  82. # if defined __WINDOWS__
  83. # undef __WINDOWS__
  84. # endif
  85. #elif defined _WIN32
  86. # define __WINDOWS__ _WIN32
  87. #elif defined WIN32
  88. # define __WINDOWS__ WIN32
  89. #endif
  90. #if defined __CYGWIN__ && defined __WINDOWS__
  91. # undef __WINDOWS__
  92. #endif
  93. /* DLL building support on win32 hosts; mostly to workaround their
  94. ridiculous implementation of data symbol exporting. */
  95. #if !defined LT_SCOPE
  96. # if defined __WINDOWS__ || defined __CYGWIN__
  97. # if defined DLL_EXPORT /* defined by libtool (if required) */
  98. # define LT_SCOPE extern __declspec(dllexport)
  99. # endif
  100. # if defined LIBLTDL_DLL_IMPORT /* define if linking with this dll */
  101. /* note: cygwin/mingw compilers can rely instead on auto-import */
  102. # define LT_SCOPE extern __declspec(dllimport)
  103. # endif
  104. # endif
  105. # if !defined LT_SCOPE /* static linking or !__WINDOWS__ */
  106. # define LT_SCOPE extern
  107. # endif
  108. #endif
  109. #if defined __WINDOWS__
  110. /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
  111. separator when it is set. */
  112. # define LT_DIRSEP_CHAR '\\'
  113. # define LT_PATHSEP_CHAR ';'
  114. #else
  115. # define LT_PATHSEP_CHAR ':'
  116. #endif
  117. #if defined _MSC_VER /* Visual Studio */
  118. # define R_OK 4
  119. #endif
  120. /* fopen() mode flags for reading a text file */
  121. #undef LT_READTEXT_MODE
  122. #if defined __WINDOWS__ || defined __CYGWIN__
  123. # define LT_READTEXT_MODE "rt"
  124. #else
  125. # define LT_READTEXT_MODE "r"
  126. #endif
  127. /* The extra indirection to the LT__STR and LT__CONC macros is required so
  128. that if the arguments to LT_STR() (or LT_CONC()) are themselves macros,
  129. they will be expanded before being quoted. */
  130. #ifndef LT_STR
  131. # define LT__STR(arg) #arg
  132. # define LT_STR(arg) LT__STR(arg)
  133. #endif
  134. #ifndef LT_CONC
  135. # define LT__CONC(a, b) a##b
  136. # define LT_CONC(a, b) LT__CONC(a, b)
  137. #endif
  138. #ifndef LT_CONC3
  139. # define LT__CONC3(a, b, c) a##b##c
  140. # define LT_CONC3(a, b, c) LT__CONC3(a, b, c)
  141. #endif
  142. #endif /*!defined LT_SYSTEM_H*/