tsrm_config_common.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef TSRM_CONFIG_COMMON_H
  2. #define TSRM_CONFIG_COMMON_H
  3. #ifndef __CYGWIN__
  4. # ifdef _WIN32
  5. # define TSRM_WIN32
  6. # endif
  7. #endif
  8. #ifdef TSRM_WIN32
  9. # include "tsrm_config.w32.h"
  10. #else
  11. # include <tsrm_config.h>
  12. # include <sys/param.h>
  13. #endif
  14. #if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
  15. # include <alloca.h>
  16. #endif
  17. /* AIX requires this to be the first thing in the file. */
  18. #ifndef __GNUC__
  19. # ifndef HAVE_ALLOCA_H
  20. # ifdef _AIX
  21. #pragma alloca
  22. # else
  23. # ifndef alloca /* predefined by HP cc +Olibcalls */
  24. char *alloca ();
  25. # endif
  26. # endif
  27. # endif
  28. #endif
  29. #if HAVE_UNISTD_H
  30. #include <unistd.h>
  31. #endif
  32. #if HAVE_LIMITS_H
  33. #include <limits.h>
  34. #endif
  35. #ifndef MAXPATHLEN
  36. # if _WIN32
  37. # include "win32/ioutil.h"
  38. # define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
  39. # elif PATH_MAX
  40. # define MAXPATHLEN PATH_MAX
  41. # elif defined(MAX_PATH)
  42. # define MAXPATHLEN MAX_PATH
  43. # else
  44. # define MAXPATHLEN 256
  45. # endif
  46. #endif
  47. #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
  48. # define TSRM_ALLOCA_MAX_SIZE 4096
  49. # define TSRM_ALLOCA_FLAG(name) \
  50. int name;
  51. # define tsrm_do_alloca_ex(size, limit, use_heap) \
  52. ((use_heap = ((size) > (limit))) ? malloc(size) : alloca(size))
  53. # define tsrm_do_alloca(size, use_heap) \
  54. tsrm_do_alloca_ex(size, TSRM_ALLOCA_MAX_SIZE, use_heap)
  55. # define tsrm_free_alloca(p, use_heap) \
  56. do { if (use_heap) free(p); } while (0)
  57. #else
  58. # define TSRM_ALLOCA_FLAG(name)
  59. # define tsrm_do_alloca(p, use_heap) malloc(p)
  60. # define tsrm_free_alloca(p, use_heap) free(p)
  61. #endif
  62. #endif /* TSRM_CONFIG_COMMON_H */
  63. /*
  64. * Local variables:
  65. * tab-width: 4
  66. * c-basic-offset: 4
  67. * End:
  68. * vim600: sw=4 ts=4 fdm=marker
  69. * vim<600: sw=4 ts=4
  70. */