setup.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #ifndef __SETUP_H
  2. #define __SETUP_H
  3. /*****************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2000, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * In order to be useful for every potential user, curl and libcurl are
  13. * dual-licensed under the MPL and the MIT/X-derivate licenses.
  14. *
  15. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. * copies of the Software, and permit persons to whom the Software is
  17. * furnished to do so, under the terms of the MPL or the MIT/X-derivate
  18. * licenses. You may pick one of these licenses.
  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. #if !defined(WIN32) && defined(_WIN32)
  26. /* This _might_ be a good Borland fix. Please report whether this works or
  27. not! */
  28. #define WIN32
  29. #endif
  30. #ifdef HAVE_CONFIG_H
  31. #ifdef VMS
  32. #include "config-vms.h"
  33. #else
  34. #include "config.h" /* the configure script results */
  35. #endif
  36. #else
  37. #ifdef WIN32
  38. /* hand-modified win32 config.h! */
  39. #include "config-win32.h"
  40. #endif
  41. #ifdef macintosh
  42. /* hand-modified MacOS config.h! */
  43. #include "config-mac.h"
  44. #endif
  45. #endif
  46. #ifndef __cplusplus /* (rabe) */
  47. typedef unsigned char bool;
  48. #define typedef_bool
  49. #endif /* (rabe) */
  50. #ifdef NEED_REENTRANT
  51. /* Solaris machines needs _REENTRANT set for a few function prototypes and
  52. things to appear in the #include files. We need to #define it before all
  53. #include files */
  54. #define _REENTRANT
  55. #endif
  56. #include <stdio.h>
  57. #ifndef OS
  58. #ifdef WIN32
  59. #define OS "win32"
  60. #else
  61. #define OS "unknown"
  62. #endif
  63. #endif
  64. #if defined(HAVE_X509_H) && defined(HAVE_SSL_H) && defined(HAVE_RSA_H) && \
  65. defined(HAVE_PEM_H) && defined(HAVE_ERR_H) && defined(HAVE_CRYPTO_H) && \
  66. defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
  67. /* the six important includes files all exist and so do both libs,
  68. defined SSLeay usage */
  69. #define USE_SSLEAY 1
  70. #endif
  71. #if defined(HAVE_OPENSSL_X509_H) && defined(HAVE_OPENSSL_SSL_H) && \
  72. defined(HAVE_OPENSSL_RSA_H) && defined(HAVE_OPENSSL_PEM_H) && \
  73. defined(HAVE_OPENSSL_ERR_H) && defined(HAVE_OPENSSL_CRYPTO_H) && \
  74. defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
  75. /* the six important includes files all exist and so do both libs,
  76. defined SSLeay usage */
  77. #define USE_SSLEAY 1
  78. #define USE_OPENSSL 1
  79. #endif
  80. #ifndef STDC_HEADERS /* no standard C headers! */
  81. #ifdef VMS
  82. #include "../include/curl/stdcheaders.h"
  83. #else
  84. #include <curl/stdcheaders.h>
  85. #endif
  86. #else
  87. #ifdef _AIX
  88. #include <curl/stdcheaders.h>
  89. #endif
  90. #endif
  91. /* Below we define four functions. They should
  92. 1. close a socket
  93. 2. read from a socket
  94. 3. write to a socket
  95. 4. set the SIGALRM signal timeout
  96. 5. set dir/file naming defines
  97. */
  98. #ifdef WIN32
  99. #if !defined(__GNUC__) || defined(__MINGW32__)
  100. #define sclose(x) closesocket(x)
  101. #define sread(x,y,z) recv(x,y,z,0)
  102. #define swrite(x,y,z) (size_t)send(x,y,z,0)
  103. #undef HAVE_ALARM
  104. #else
  105. /* gcc-for-win is still good :) */
  106. #define sclose(x) close(x)
  107. #define sread(x,y,z) recv(x,y,z,0)
  108. #define swrite(x,y,z) send(x,y,z,0)
  109. #define HAVE_ALARM
  110. #endif
  111. #define PATH_CHAR ";"
  112. #define DIR_CHAR "\\"
  113. #define DOT_CHAR "_"
  114. #else
  115. #define sclose(x) close(x)
  116. #define sread(x,y,z) recv(x,y,z,0)
  117. #define swrite(x,y,z) send(x,y,z,0)
  118. #define HAVE_ALARM
  119. #define PATH_CHAR ":"
  120. #define DIR_CHAR "/"
  121. #define DOT_CHAR "."
  122. #ifdef HAVE_STRCASECMP
  123. /* this is for "-ansi -Wall -pedantic" to stop complaining! */
  124. extern int (strcasecmp)(const char *s1, const char *s2);
  125. extern int (strncasecmp)(const char *s1, const char *s2, size_t n);
  126. #ifndef fileno /* sunos 4 have this as a macro! */
  127. int fileno( FILE *stream);
  128. #endif
  129. #endif
  130. #endif
  131. /*
  132. * Curl_addrinfo MUST be used for name resolving information.
  133. * Information regarding a single IP witin a Curl_addrinfo MUST be stored in
  134. * a Curl_ipconnect struct.
  135. */
  136. #ifdef ENABLE_IPV6
  137. typedef struct addrinfo Curl_addrinfo;
  138. typedef struct addrinfo Curl_ipconnect;
  139. #else
  140. typedef struct hostent Curl_addrinfo;
  141. typedef struct in_addr Curl_ipconnect;
  142. #endif
  143. #endif /* __CONFIG_H */