setup.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #ifndef __SRC_CURL_SETUP_H
  2. #define __SRC_CURL_SETUP_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id$
  24. ***************************************************************************/
  25. #define CURL_NO_OLDIES
  26. /*
  27. * Define WIN32 when build target is Win32 API
  28. */
  29. #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__)
  30. #define WIN32
  31. #endif
  32. /*
  33. * Include configuration script results or hand-crafted
  34. * configuration file for platforms which lack config tool.
  35. */
  36. #ifdef HAVE_CONFIG_H
  37. #include "curl_config.h"
  38. #else
  39. #ifdef WIN32
  40. #include "config-win32.h"
  41. #endif
  42. #if defined(macintosh) && defined(__MRC__)
  43. # include "config-mac.h"
  44. #endif
  45. #ifdef __riscos__
  46. #include "config-riscos.h"
  47. #endif
  48. #ifdef __AMIGA__
  49. #include "config-amigaos.h"
  50. #endif
  51. #ifdef __SYMBIAN32__
  52. #include "config-symbian.h"
  53. #endif
  54. #ifdef TPF
  55. #include "config-tpf.h"
  56. #endif
  57. #endif /* HAVE_CONFIG_H */
  58. /*
  59. * AIX 4.3 and newer needs _THREAD_SAFE defined to build
  60. * proper reentrant code. Others may also need it.
  61. */
  62. #ifdef NEED_THREAD_SAFE
  63. # ifndef _THREAD_SAFE
  64. # define _THREAD_SAFE
  65. # endif
  66. #endif
  67. /*
  68. * Tru64 needs _REENTRANT set for a few function prototypes and
  69. * things to appear in the system header files. Unixware needs it
  70. * to build proper reentrant code. Others may also need it.
  71. */
  72. #ifdef NEED_REENTRANT
  73. # ifndef _REENTRANT
  74. # define _REENTRANT
  75. # endif
  76. #endif
  77. /*
  78. * Include header files for windows builds before redefining anything.
  79. * Use this preproessor block only to include or exclude windows.h,
  80. * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
  81. * to any other further and independent block. Under Cygwin things work
  82. * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
  83. * never be included when __CYGWIN__ is defined. configure script takes
  84. * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
  85. * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
  86. */
  87. #ifdef HAVE_WINDOWS_H
  88. # ifndef WIN32_LEAN_AND_MEAN
  89. # define WIN32_LEAN_AND_MEAN
  90. # endif
  91. # include <windows.h>
  92. # ifdef HAVE_WINSOCK2_H
  93. # include <winsock2.h>
  94. # ifdef HAVE_WS2TCPIP_H
  95. # include <ws2tcpip.h>
  96. # endif
  97. # else
  98. # ifdef HAVE_WINSOCK_H
  99. # include <winsock.h>
  100. # endif
  101. # endif
  102. #endif
  103. /*
  104. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  105. * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
  106. * undefine USE_WINSOCK.
  107. */
  108. #undef USE_WINSOCK
  109. #ifdef HAVE_WINSOCK2_H
  110. # define USE_WINSOCK 2
  111. #else
  112. # ifdef HAVE_WINSOCK_H
  113. # define USE_WINSOCK 1
  114. # endif
  115. #endif
  116. #ifdef TPF
  117. # include <sys/socket.h>
  118. /* change which select is used for the curl command line tool */
  119. # define select(a,b,c,d,e) tpf_select_bsd(a,b,c,d,e)
  120. /* and turn off the progress meter */
  121. # define CONF_DEFAULT (0|CONF_NOPROGRESS)
  122. #endif
  123. #include <stdio.h>
  124. #ifdef __TANDEM
  125. #include <floss.h>
  126. #endif
  127. #ifndef OS
  128. #define OS "unknown"
  129. #endif
  130. #if !defined(fileno) && !defined(WIN32) /* sunos 4 have this as a macro! */
  131. int fileno( FILE *stream);
  132. #endif
  133. #ifdef WIN32
  134. #define DIR_CHAR "\\"
  135. #define DOT_CHAR "_"
  136. #else
  137. #ifdef __EMX__
  138. /* 20000318 mgs
  139. * OS/2 supports leading dots in filenames if the volume is formatted
  140. * with JFS or HPFS. */
  141. #define DIR_CHAR "\\"
  142. #define DOT_CHAR "."
  143. #else
  144. #ifdef DJGPP
  145. #include <tcp.h>
  146. #ifdef word
  147. #undef word
  148. #endif
  149. #define DIR_CHAR "/"
  150. #define DOT_CHAR "_"
  151. #else
  152. #define DIR_CHAR "/"
  153. #define DOT_CHAR "."
  154. #endif /* !DJGPP */
  155. #endif /* !__EMX__ */
  156. #endif /* !WIN32 */
  157. #ifdef __riscos__
  158. #define USE_ENVIRONMENT
  159. #endif
  160. #ifdef __BEOS__
  161. #define typedef_bool
  162. #endif
  163. #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
  164. #include <sys/timeval.h>
  165. #endif
  166. #ifndef UNPRINTABLE_CHAR
  167. /* define what to use for unprintable characters */
  168. #define UNPRINTABLE_CHAR '.'
  169. #endif
  170. #ifndef HAVE_STRDUP
  171. #include "strdup.h"
  172. #define strdup(ptr) curlx_strdup(ptr)
  173. #endif
  174. /*
  175. * Include macros and defines that should only be processed once.
  176. */
  177. #ifndef __SETUP_ONCE_H
  178. #include "setup_once.h"
  179. #endif
  180. #endif /* __SRC_CURL_SETUP_H */