lt_system.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* lt_system.h -- system portability abstraction layer
  2. Copyright (C) 2004, 2007 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 which 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. /* Canonicalise Windows and Cygwin recognition macros.
  65. To match the values set by recent Cygwin compilers, make sure that if
  66. __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
  67. #if defined(__CYGWIN32__) && !defined(__CYGWIN__)
  68. # define __CYGWIN__ __CYGWIN32__
  69. #endif
  70. #if defined(__CYGWIN__)
  71. # if defined(__WINDOWS__)
  72. # undef __WINDOWS__
  73. # endif
  74. #elif defined(_WIN32)
  75. # define __WINDOWS__ _WIN32
  76. #elif defined(WIN32)
  77. # define __WINDOWS__ WIN32
  78. #endif
  79. #if defined(__CYGWIN__) && defined(__WINDOWS__)
  80. # undef __WINDOWS__
  81. #endif
  82. /* DLL building support on win32 hosts; mostly to workaround their
  83. ridiculous implementation of data symbol exporting. */
  84. #if !defined(LT_SCOPE)
  85. # if defined(__WINDOWS__) || defined(__CYGWIN__)
  86. # if defined(DLL_EXPORT) /* defined by libtool (if required) */
  87. # define LT_SCOPE extern __declspec(dllexport)
  88. # endif
  89. # if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */
  90. /* note: cygwin/mingw compilers can rely instead on auto-import */
  91. # define LT_SCOPE extern __declspec(dllimport)
  92. # endif
  93. # endif
  94. # if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */
  95. # define LT_SCOPE extern
  96. # endif
  97. #endif
  98. #if defined(__WINDOWS__)
  99. /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
  100. separator when it is set. */
  101. # define LT_DIRSEP_CHAR '\\'
  102. # define LT_PATHSEP_CHAR ';'
  103. #else
  104. # define LT_PATHSEP_CHAR ':'
  105. #endif
  106. #if defined(_MSC_VER) /* Visual Studio */
  107. # define R_OK 4
  108. #endif
  109. /* fopen() mode flags for reading a text file */
  110. #undef LT_READTEXT_MODE
  111. #if defined(__WINDOWS__) || defined(__CYGWIN__)
  112. # define LT_READTEXT_MODE "rt"
  113. #else
  114. # define LT_READTEXT_MODE "r"
  115. #endif
  116. /* The extra indirection to the LT__STR and LT__CONC macros is required so
  117. that if the arguments to LT_STR() (or LT_CONC()) are themselves macros,
  118. they will be expanded before being quoted. */
  119. #ifndef LT_STR
  120. # define LT__STR(arg) #arg
  121. # define LT_STR(arg) LT__STR(arg)
  122. #endif
  123. #ifndef LT_CONC
  124. # define LT__CONC(a, b) a##b
  125. # define LT_CONC(a, b) LT__CONC(a, b)
  126. #endif
  127. #ifndef LT_CONC3
  128. # define LT__CONC3(a, b, c) a##b##c
  129. # define LT_CONC3(a, b, c) LT__CONC3(a, b, c)
  130. #endif
  131. #endif /*!defined(LT_SYSTEM_H)*/