You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.6 KiB

  1. # -------------------------------------------------------------
  2. # config.h
  3. # If we generate config.h by automake
  4. #include_directories(.)
  5. # Use cmake to generate config.h
  6. include(CheckIncludeFiles)
  7. include(CheckFunctionExists)
  8. include(CheckSymbolExists)
  9. include(CheckLibraryExists)
  10. include(CheckTypeSize)
  11. include(CheckCSourceCompiles)
  12. # Define if building universal (internal helper macro)
  13. # AC_APPLE_UNIVERSAL_BUILD
  14. set(CONNECT_IN_PROGRESS "EINPROGRESS")
  15. set(CONNECT_IN_PROGRESS "EINPROGRESS" CACHE STRING "")
  16. check_include_files(dlfcn.h HAVE_DLFCN_H)
  17. check_include_files(ev.h HAVE_EV_H)
  18. check_include_files(fcntl.h HAVE_FCNTL_H)
  19. check_function_exists(fork HAVE_FORK)
  20. check_function_exists(getpwnam_r HAVE_GETPWNAM_R)
  21. check_function_exists(inet_ntop HAVE_INET_NTOP)
  22. check_include_files(inttypes.h HAVE_INTTYPES_H)
  23. set(HAVE_IPv6 1)
  24. check_include_files(langinfo.h HAVE_LANGINFO_H)
  25. set(HAVE_LIBPCRE 1)
  26. check_library_exists(socket socket "" HAVE_LIBSOCKET)
  27. check_include_files(limits.h HAVE_LIMITS_H)
  28. check_include_files(linux/if.h HAVE_LINUX_IF_H)
  29. check_include_files(linux/netfilter_ipv4.h HAVE_LINUX_NETFILTER_IPV4_H)
  30. check_include_files(linux/netfilter_ipv6/ip6_tables.h HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H)
  31. check_include_files(locale.h HAVE_LOCALE_H)
  32. check_function_exists(malloc HAVE_MALLOC)
  33. check_include_files(memory.h HAVE_MEMORY_H)
  34. check_function_exists(memset HAVE_MEMSET)
  35. check_include_files(netdb.h HAVE_NETDB_H)
  36. check_include_files(netinet/in.h HAVE_NETINET_IN_H)
  37. check_include_files(netinet/tcp.h HAVE_NETINET_TCP_H)
  38. check_include_files(linux/tcp.h HAVE_LINUX_TCP_H)
  39. check_include_files(net/if.h HAVE_NET_IF_H)
  40. check_include_files(pcre.h HAVE_PCRE_H)
  41. check_include_files(pcre/pcre.h HAVE_PCRE_PCRE_H)
  42. check_symbol_exists(PTHREAD_PRIO_INHERIT pthread.h HAVE_PTHREAD_PRIO_INHERIT)
  43. check_function_exists(select HAVE_SELECT)
  44. check_function_exists(setresuid HAVE_SETRESUID)
  45. check_function_exists(setreuid HAVE_SETREUID)
  46. check_function_exists(setrlimit HAVE_SETRLIMIT)
  47. check_function_exists(socket HAVE_SOCKET)
  48. check_include_files(stdint.h HAVE_STDINT_H)
  49. check_include_files(stdlib.h HAVE_STDLIB_H)
  50. check_function_exists(strerror HAVE_STRERROR)
  51. check_include_files(strings.h HAVE_STRINGS_H)
  52. check_include_files(string.h HAVE_STRING_H)
  53. check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
  54. check_include_files(sys/select.h HAVE_SYS_SELECT_H)
  55. check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
  56. check_include_files(sys/stat.h HAVE_SYS_STAT_H)
  57. check_include_files(sys/types.h HAVE_SYS_TYPES_H)
  58. check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
  59. check_include_files(ares.h HAVE_ARES_H)
  60. check_include_files(unistd.h HAVE_UNISTD_H)
  61. check_function_exists(fork HAVE_FORK)
  62. check_function_exists(vfork HAVE_VFORK)
  63. check_include_files(vfork.h HAVE_VFORK_H)
  64. if (HAVE_VFORK)
  65. set(HAVE_WORKING_VFORK 1)
  66. endif ()
  67. if (HAVE_FORK)
  68. set(HAVE_WORKING_FORK 1)
  69. endif ()
  70. # Define to the sub-directory where libtool stores uninstalled libraries.
  71. set(LT_OBJDIR ".libs/")
  72. set(NDEBUG 1)
  73. set(PACKAGE ${PROJECT_NAME})
  74. set(PACKAGE_BUGREPORT max.c.lv@gmail.com)
  75. set(PACKAGE_NAME ${PROJECT_NAME})
  76. set(PACKAGE_VERSION ${PROJECT_VERSION})
  77. set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}")
  78. set(PACKAGE_TARNAME ${PROJECT_NAME})
  79. set(PACKAGE_URL "")
  80. #message(${PACKAGE_NAME} - v${PACKAGE_VERSION} - v${PROJECT_VERSION})
  81. # PTHREAD_CREATE_JOINABLE
  82. # Define as the return type of signal handlers (`int' or `void').
  83. set(RETSIGTYPE void)
  84. # Define to the type of arg 1 for `select'.
  85. set(SELECT_TYPE_ARG1 int)
  86. # Define to the type of args 2, 3 and 4 for `select'.
  87. set(SELECT_TYPE_ARG234 "(fd_set *)")
  88. # Define to the type of arg 5 for `select'.
  89. set(SELECT_TYPE_ARG5 "(struct timeval *)")
  90. # Define to 1 if you have the ANSI C header files.
  91. set(STDC_HEADERS 1)
  92. check_include_files("sys/time.h;time.h" TIME_WITH_SYS_TIME)
  93. # If the compiler supports a TLS storage class define it to that here
  94. check_c_source_compiles("
  95. __thread int tls;
  96. int main(void) { return 0; }"
  97. HAVE_GCC_THREAD_LOCAL_STORAGE)
  98. if (HAVE_GCC_THREAD_LOCAL_STORAGE)
  99. set(TLS __thread)
  100. endif ()
  101. set(_ALL_SOURCE 1)
  102. set(_GNU_SOURCE 1)
  103. set(_POSIX_PTHREAD_SEMANTICS 1)
  104. set(_TANDEM_SOURCE 1)
  105. set(__EXTENSIONS__ 1)
  106. # USE_SYSTEM_SHARED_LIB
  107. set(VERSION ${PACKAGE_VERSION})
  108. # TODO WORDS_BIGENDIAN
  109. # _MINIX
  110. # _POSIX_1_SOURCE
  111. # _POSIX_SOURCE
  112. # _UINT8_T
  113. # Define to empty if `const' does not conform to ANSI C.
  114. # undef const
  115. # Define to `__inline__' or `__inline' if that's what the C compiler
  116. # calls it, or to nothing if 'inline' is not supported under any name.
  117. #ifndef __cplusplus
  118. #undef inline
  119. #endif
  120. # TODO Assume we got inline support
  121. # https://cmake.org/Wiki/CMakeTestInline
  122. # Define to `int' if <sys/types.h> does not define.
  123. # undef pid_t
  124. # Define to the type of an unsigned integer type of width exactly 16 bits if
  125. # such a type exists and the standard includes do not define it.
  126. # undef uint16_t
  127. # Define to the type of an unsigned integer type of width exactly 8 bits if
  128. # such a type exists and the standard includes do not define it.
  129. # undef uint8_t
  130. set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h)
  131. check_type_size(pid_t PID_T)
  132. check_type_size(size_t SIZE_T)
  133. check_type_size(ssize_t SSIZE_T)
  134. set(CMAKE_EXTRA_INCLUDE_FILES)
  135. check_type_size(uint16_t UINT16_T)
  136. check_type_size(uint8_t UINT8_T)
  137. ## Inverse
  138. if (NOT HAVE_PID_T)
  139. set(pid_t int)
  140. endif ()
  141. if (NOT HAVE_SIZE_T)
  142. set(size_t "unsigned int")
  143. endif ()
  144. if (NOT HAVE_SSIZE_T)
  145. set(ssize_t int)
  146. endif ()
  147. if (NOT HAVE_UINT8_T)
  148. set(uint8_t "unsigned char")
  149. endif ()
  150. if (NOT HAVE_UINT16_T)
  151. set(uint16_t "unsigned short")
  152. endif ()
  153. # Define as `fork' if `vfork' does not work.
  154. if (NOT HAVE_WORKING_VFORK)
  155. set(vfork fork)
  156. endif ()