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.

551 lines
20 KiB

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl This version of log4cplus requires the follwing autotools versions:
  3. dnl autoconf-2.69
  4. dnl automake-1.12
  5. dnl libtool-2.4.2
  6. AC_INIT([log4cplus],[1.1.0])
  7. AC_CANONICAL_TARGET
  8. AC_CONFIG_SRCDIR([src/logger.cxx])
  9. AC_CONFIG_MACRO_DIR([m4])
  10. AM_INIT_AUTOMAKE([1.12 no-define nostdinc gnu -Wall])
  11. AM_PROG_AR
  12. #
  13. # +1 : ? : +1 == new interface that does not break old one
  14. # +1 : ? : 0 == new interface that breaks old one
  15. # ? : ? : 0 == no new interfaces, but breaks apps
  16. # ? :+1 : ? == just some internal changes, nothing breaks but might work
  17. # better
  18. # CURRENT : REVISION : AGE
  19. LT_VERSION=5:0:0
  20. LT_RELEASE=1.1
  21. AC_SUBST([LT_VERSION])
  22. AC_SUBST([LT_RELEASE])
  23. dnl Use C++ std::locale and std::codecvt facet for string conversion.
  24. AH_TEMPLATE([LOG4CPLUS_WORKING_LOCALE],
  25. [Define for compilers/standard libraries that support more than
  26. just the "C" locale.])
  27. AC_ARG_WITH([working-locale],
  28. [AS_HELP_STRING([--with-working-locale],
  29. [Use std::locale for char->wchar_t conversion.])],
  30. [LOG4CPLUS_CHECK_YESNO([${withval}], [--with-working-locale])],
  31. [with_working_locale=no])
  32. AS_IF([test "x$with_working_locale" = "xyes"],
  33. [AC_DEFINE([LOG4CPLUS_WORKING_LOCALE], [1])],
  34. [])
  35. dnl Use C99 wcsrtombs() etc. functions for string conversion.
  36. AH_TEMPLATE([LOG4CPLUS_WORKING_C_LOCALE],
  37. [Define for C99 compilers/standard libraries that support more than
  38. just the "C" locale.])
  39. AC_ARG_WITH([working-c-locale],
  40. [AS_HELP_STRING([--with-working-c-locale],
  41. [Use C99 locale facilities for char->wchar_t conversion.])],
  42. [LOG4CPLUS_CHECK_YESNO([${withval}], [--with-working-c-locale])],
  43. [with_working_c_locale=no])
  44. AS_IF([test "x$with_working_c_locale" = "xyes"],
  45. [AC_DEFINE([LOG4CPLUS_WORKING_C_LOCALE], [1])],
  46. [])
  47. dnl Use iconv() function for string conversion.
  48. AH_TEMPLATE([LOG4CPLUS_WITH_ICONV],
  49. [Define when iconv() is available.])
  50. AC_ARG_WITH([iconv],
  51. [AS_HELP_STRING([--with-iconv],
  52. [Use iconv() for char->wchar_t conversion.])],
  53. [LOG4CPLUS_CHECK_YESNO([${withval}], [--with-iconv])],
  54. [with_iconv=no])
  55. AS_IF([test "x$with_iconv" = "xyes"],
  56. [AC_DEFINE([LOG4CPLUS_WITH_ICONV], [1])],
  57. [])
  58. dnl Debugging or release build?
  59. AC_ARG_ENABLE([debugging],
  60. [AS_HELP_STRING([--enable-debugging],
  61. [Turns off optimization and adds switches that generate debugging
  62. information.])],
  63. [LOG4CPLUS_CHECK_YESNO([${enableval}], [--enable-debugging])],
  64. [enable_debugging=no])
  65. AH_TEMPLATE([LOG4CPLUS_DEBUGGING],
  66. [Defined for --enable-debugging builds.])
  67. AS_IF([test "x$enable_debugging" = "xyes"],
  68. [AC_DEFINE([LOG4CPLUS_DEBUGGING])
  69. LOG4CPLUS_NDEBUG=-UNDEBUG
  70. AS_CASE(["$target_os"],
  71. [linux*],
  72. [dnl The -U_FORTIFY_SOURCE bit is here to avoid redefinition
  73. dnl warning on Ubuntu where _FORTIFY_SOURCE is enabled by
  74. dnl default.
  75. AS_VAR_APPEND([CPPFLAGS], [" -U_FORTIFY_SOURCE"])
  76. AS_VAR_APPEND([CPPFLAGS], [" -D_FORTIFY_SOURCE=1"])])],
  77. [LOG4CPLUS_NDEBUG=-DNDEBUG])
  78. AC_SUBST([LOG4CPLUS_NDEBUG])
  79. dnl Turn warnings on/off?
  80. AC_ARG_ENABLE([warnings],
  81. [AC_HELP_STRING([--enable-warnings],
  82. [Use compiler warnings option, e.g. -Wall. Enabled by default.])],
  83. [LOG4CPLUS_CHECK_YESNO([${enableval}], [--enable-warnings])],
  84. [enable_warnings=yes])
  85. dnl Check for c/c++ compilers.
  86. AC_PROG_CXX
  87. AC_PROG_CXXCPP
  88. AC_LANG([C++])
  89. AS_VAR_APPEND([CPPFLAGS], [" -D_GNU_SOURCE=1"])
  90. AS_CASE(["$target_os"],
  91. [mingw*],
  92. [dnl Undefining __STRICT_ANSI__ is a workaround for MinGW
  93. dnl compilation problem. C++ <cwchar> header does not compile in
  94. dnl GCC 4.4.0 because some functions like swprintf() are not
  95. dnl visible.
  96. AS_VAR_APPEND([CPPFLAGS], [" -U__STRICT_ANSI__"])
  97. AS_VAR_APPEND([CPPFLAGS], [" -DWIN32"])
  98. AS_VAR_APPEND([CPPFLAGS], [" -D_WIN32"])
  99. AS_VAR_APPEND([CPPFLAGS], [" -DMINGW_HAS_SECURE_API=1"])],
  100. [cygwin*],
  101. [dnl Undefining __STRICT_ANSI__ is a workaround for compilation
  102. dnl problem. C <stdio.h> header does not define vsnprintf() or
  103. dnl _vsnprintf().
  104. AS_VAR_APPEND([CPPFLAGS], [" -U__STRICT_ANSI__"])])
  105. AC_ARG_ENABLE([profiling],
  106. [AS_HELP_STRING([--enable-profiling],
  107. [Compile with profiling compiler options.])],
  108. [LOG4CPLUS_CHECK_YESNO([${enableval}], [--enable-profiling])],
  109. [enable_profiling=no])
  110. LOG4CPLUS_PROFILING_LDFLAGS=
  111. LOG4CPLUS_PROFILING_CXXFLAGS=
  112. dnl Checks for programs.
  113. AX_COMPILER_VENDOR
  114. AS_IF([test "x$enable_warnings" = "xyes"],
  115. [AS_CASE([$ax_cv_cxx_compiler_vendor],
  116. dnl Skip all warnings detection for Solaris Studio compilers. It
  117. dnl adds the -v option and that breaks PIC support detection.
  118. [sun], [],
  119. [AX_CXXFLAGS_WARN_ALL])])
  120. AS_CASE([$ax_cv_cxx_compiler_vendor],
  121. [gnu|clang],
  122. [AS_IF([test "x$enable_warnings" = "xyes"],
  123. [AX_CXXFLAGS_GCC_OPTION([-Wextra])
  124. dnl The -ansi switch sets __STRICT_ANSI__ which disables some
  125. dnl useful function declarations in MinGW and Cygwin headers.
  126. dnl AX_CXXFLAGS_GCC_OPTION([-ansi])
  127. AX_CXXFLAGS_GCC_OPTION([-pedantic])
  128. AX_CXXFLAGS_GCC_OPTION([-Wstrict-aliasing])
  129. AX_CXXFLAGS_GCC_OPTION([-Wstrict-overflow])
  130. dnl AX_CXXFLAGS_GCC_OPTION([-Weffc++])
  131. AX_CXXFLAGS_GCC_OPTION([-Woverloaded-virtual])
  132. AS_CASE(["$target_os"],
  133. dnl Disable -Wold-style-cast for MinGW as it generates too
  134. dnl much noise there.
  135. [mingw*], [],
  136. [AX_CXXFLAGS_GCC_OPTION([-Wold-style-cast])])
  137. dnl AX_CXXFLAGS_GCC_OPTION([-Wabi])
  138. AX_CXXFLAGS_GCC_OPTION([-Wc++0x-compat])
  139. AX_CXXFLAGS_GCC_OPTION([-Wc++11-compat])
  140. dnl AX_CXXFLAGS_GCC_OPTION([-Wconversion])
  141. AX_CXXFLAGS_GCC_OPTION([-Wundef])
  142. AX_CXXFLAGS_GCC_OPTION([-Wshadow])
  143. AX_CXXFLAGS_GCC_OPTION([-Wformat])
  144. AX_CXXFLAGS_GCC_OPTION([-Wsuggest-attribute=format])
  145. dnl AX_CXXFLAGS_GCC_OPTION([-Wsuggest-attribute=pure])
  146. dnl AX_CXXFLAGS_GCC_OPTION([-Wsuggest-attribute=const])
  147. AX_CXXFLAGS_GCC_OPTION([-Wsuggest-attribute=noreturn])
  148. AX_CXXFLAGS_GCC_OPTION([-Wno-variadic-macros])])
  149. AS_IF([test "x$enable_debugging" = "xyes"],
  150. [AX_CXXFLAGS_GCC_OPTION([-g3])
  151. AX_CXXFLAGS_GCC_OPTION([-fkeep-inline-functions])
  152. AX_CXXFLAGS_GCC_OPTION([-fstack-check])
  153. AX_CXXFLAGS_GCC_OPTION([-fstack-protector])
  154. dnl -Wstack-protector results into not too interesting warnings.
  155. dnl AX_CXXFLAGS_GCC_OPTION([-Wstack-protector])
  156. AX_CXXFLAGS_GCC_OPTION([-ftrapv])],
  157. [AC_REQUIRE([AC_PROG_GREP])
  158. AS_IF([AS_ECHO_N(["$CXXFLAGS"]) dnl
  159. | $GREP -e ['\(^\|[[:space:]]\)-O\([^[:space:]]*\([[:space:]]\|$\)\)'] >/dev/null],
  160. [],
  161. [AX_CXXFLAGS_GCC_OPTION([-O2])])])
  162. dnl Try -pg profiling option.
  163. AS_IF([test "x$enable_profiling" = "xyes"],
  164. [AX_CXXFLAGS_GCC_OPTION([-pg],[],
  165. [LOG4CPLUS_PROFILING_LDFLAGS="-pg"
  166. LOG4CPLUS_PROFILING_CXXFLAGS="-pg"])
  167. AX_CXXFLAGS_GCC_OPTION([-g3])])
  168. dnl The --enable-auto-import and --enable-runtime-pseudo-reloc
  169. dnl options are required for log4cplus to work when compiled with
  170. dnl Cygwin's GCC 4.3.x.
  171. AS_CASE(["$target_os"],
  172. [cygwin*|mingw*],
  173. [LDFLAGS="${LDFLAGS} -Wl,--enable-auto-import"
  174. LDFLAGS="${LDFLAGS} -Wl,--enable-runtime-pseudo-reloc"])],
  175. [sun],
  176. [AS_IF([test "x$enable_warnings" = "xyes"],
  177. [dnl This test is disabled. See comment before
  178. dnl AX_CXXFLAGS_WARN_ALL invocation.
  179. dnl AX_CXXFLAGS_SUN_OPTION([-v])
  180. AX_CXXFLAGS_SUN_OPTION([+w])])
  181. dnl Sun CC does support -g flag.
  182. AS_IF([test "x$enable_debugging" = "xyes"],
  183. [AX_CXXFLAGS_SUN_OPTION([-g])])
  184. dnl Try -pg profiling option.
  185. AS_IF([test "x$enable_profiling" = "xyes"],
  186. [AX_CXXFLAGS_SUN_OPTION([-pg],[],
  187. [LOG4CPLUS_PROFILING_LDFLAGS="-pg"
  188. LOG4CPLUS_PROFILING_CXXFLAGS="-pg"])
  189. AX_CXXFLAGS_SUN_OPTION([-g])])
  190. dnl This is here for compilation with _GNU_SOURCE=1 on Linux. Their
  191. dnl headers then use zero length arrays which are not supported by
  192. dnl C++ itself.
  193. AX_CXXFLAGS_SUN_OPTION([-features=zla])
  194. dnl This is for __func__ symbol. However it is disabled as it would
  195. dnl force user code to use the switch as well.
  196. dnl AX_CXXFLAGS_SUN_OPTION([-features=extensions])
  197. dnl log4cplus does not work with the default C++ library
  198. dnl implementation from Sun everywhere. E.g., on Linux it seems to
  199. dnl be missing std::FILE, etc., in the std:: namespace but on
  200. dnl Solaris it works. Thus we use the available STLport that they
  201. dnl also ship unless the user specifies own
  202. dnl -library=(stlport4|stdcxx4|Cstd) switch.
  203. AC_REQUIRE([AC_PROG_GREP])
  204. AS_IF([AS_ECHO_N(["$CXXFLAGS"]) dnl
  205. | $GREP -e '-library=\(stlport4\|stdcxx4\|Cstd\)' >/dev/null],
  206. [],
  207. [AX_CXXFLAGS_SUN_OPTION([-library=stlport4])])
  208. dnl Adding -library=Crun is always necessary.
  209. AX_CXXFLAGS_SUN_OPTION([-library=Crun])])
  210. AX_DECLSPEC([LOG4CPLUS_DECLSPEC])
  211. AS_IF([test "x$ac_cv_declspec" = "xyes" dnl
  212. || test "x$ac_cv__attribute__visibility" = "xyes" dnl
  213. || test "x$ac_cv__global" = "xyes"],
  214. [AS_CASE([$ax_cv_cxx_compiler_vendor],
  215. [gnu|clang],
  216. [AX_CXXFLAGS_GCC_OPTION([-fvisibility=hidden])],
  217. [sun],
  218. [AX_CXXFLAGS_SUN_OPTION([-xldscope=hidden])])])
  219. AX_C99_VARIADIC_MACROS
  220. AH_TEMPLATE([LOG4CPLUS_HAVE_C99_VARIADIC_MACROS])
  221. AS_IF([test "x$ac_cv_c99_variadic_macros" = "xyes"],
  222. [AC_DEFINE([LOG4CPLUS_HAVE_C99_VARIADIC_MACROS])])
  223. AX_GNU_VARIADIC_MACROS
  224. AH_TEMPLATE([LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS])
  225. AS_IF([test "x$ac_cv_gnu_variadic_macros" = "xyes"],
  226. [AC_DEFINE([LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS])])
  227. AX___FUNCTION___MACRO
  228. AH_TEMPLATE([LOG4CPLUS_HAVE_FUNCTION_MACRO])
  229. AS_IF([test "x$ac_cv_have___function___macro" = "xyes"],
  230. [AC_DEFINE([LOG4CPLUS_HAVE_FUNCTION_MACRO])])
  231. AX___PRETTY_FUNCTION___MACRO
  232. AH_TEMPLATE([LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO])
  233. AS_IF([test "x$ac_cv_have___pretty_function___macro" = "xyes"],
  234. [AC_DEFINE([LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO])])
  235. AX___FUNC___SYMBOL
  236. AH_TEMPLATE([LOG4CPLUS_HAVE_FUNC_SYMBOL])
  237. AS_IF([test "x$ac_cv_have___func___symbol" = "xyes"],
  238. [AC_DEFINE([LOG4CPLUS_HAVE_FUNC_SYMBOL])])
  239. dnl Checks for libraries.
  240. AC_SEARCH_LIBS([strerror], [cposix])
  241. AC_SEARCH_LIBS([nanosleep], [rt])
  242. AC_SEARCH_LIBS([clock_nanosleep], [rt posix4])
  243. AC_SEARCH_LIBS([clock_gettime], [rt posix4])
  244. dnl On some systems libcompat exists only as a static library which
  245. dnl breaks compilation of shared library log4cplus.
  246. dnl AC_SEARCH_LIBS([ftime], [compat])
  247. AC_SEARCH_LIBS([gethostbyname], [nsl])
  248. AC_SEARCH_LIBS([setsockopt], [socket])
  249. AS_IF([test "x$with_iconv" = "xyes"],
  250. [AC_SEARCH_LIBS([iconv_open], [iconv], [],
  251. [AC_SEARCH_LIBS([libiconv_open], [iconv])])])
  252. dnl Windows/MinGW specific.
  253. AC_LANG_PUSH([C])
  254. AC_HAVE_LIBRARY([kernel32])
  255. AC_HAVE_LIBRARY([advapi32])
  256. AC_HAVE_LIBRARY([ws2_32])
  257. AC_LANG_POP([C])
  258. dnl Checks for header files.
  259. AC_HEADER_STDC
  260. LOG4CPLUS_CHECK_HEADER([sys/types.h], [LOG4CPLUS_HAVE_SYS_TYPES_H])
  261. LOG4CPLUS_CHECK_HEADER([sys/socket.h], [LOG4CPLUS_HAVE_SYS_SOCKET_H])
  262. LOG4CPLUS_CHECK_HEADER([sys/time.h], [LOG4CPLUS_HAVE_SYS_TIME_H])
  263. LOG4CPLUS_CHECK_HEADER([sys/timeb.h], [LOG4CPLUS_HAVE_SYS_TIMEB_H])
  264. LOG4CPLUS_CHECK_HEADER([sys/stat.h], [LOG4CPLUS_HAVE_SYS_STAT_H])
  265. LOG4CPLUS_CHECK_HEADER([sys/syscall.h], [LOG4CPLUS_HAVE_SYS_SYSCALL_H])
  266. LOG4CPLUS_CHECK_HEADER([sys/file.h], [LOG4CPLUS_HAVE_SYS_FILE_H])
  267. LOG4CPLUS_CHECK_HEADER([syslog.h], [LOG4CPLUS_HAVE_SYSLOG_H])
  268. LOG4CPLUS_CHECK_HEADER([arpa/inet.h], [LOG4CPLUS_HAVE_ARPA_INET_H])
  269. LOG4CPLUS_CHECK_HEADER([netinet/in.h], [LOG4CPLUS_HAVE_NETINET_IN_H])
  270. LOG4CPLUS_CHECK_HEADER([netinet/tcp.h], [LOG4CPLUS_HAVE_NETINET_TCP_H])
  271. LOG4CPLUS_CHECK_HEADER([netdb.h], [LOG4CPLUS_HAVE_NETDB_H])
  272. LOG4CPLUS_CHECK_HEADER([unistd.h], [LOG4CPLUS_HAVE_UNISTD_H])
  273. LOG4CPLUS_CHECK_HEADER([fcntl.h], [LOG4CPLUS_HAVE_FCNTL_H])
  274. LOG4CPLUS_CHECK_HEADER([stdio.h], [LOG4CPLUS_HAVE_STDIO_H])
  275. LOG4CPLUS_CHECK_HEADER([stdarg.h], [LOG4CPLUS_HAVE_STDARG_H])
  276. LOG4CPLUS_CHECK_HEADER([stdlib.h], [LOG4CPLUS_HAVE_STDLIB_H])
  277. LOG4CPLUS_CHECK_HEADER([wchar.h], [LOG4CPLUS_HAVE_WCHAR_H])
  278. LOG4CPLUS_CHECK_HEADER([time.h], [LOG4CPLUS_HAVE_TIME_H])
  279. LOG4CPLUS_CHECK_HEADER([errno.h], [LOG4CPLUS_HAVE_ERRNO_H])
  280. LOG4CPLUS_CHECK_HEADER([limits.h], [LOG4CPLUS_HAVE_LIMITS_H])
  281. AS_IF([test "x$with_iconv" = "xyes"],
  282. [LOG4CPLUS_CHECK_HEADER([iconv.h], [LOG4CPLUS_HAVE_ICONV_H])])
  283. dnl Check for the existance of type socklen_t.
  284. AX_TYPE_SOCKLEN_T
  285. dnl Check for single-threaded compilation
  286. AH_TEMPLATE([LOG4CPLUS_USE_PTHREADS])
  287. AC_ARG_ENABLE([threads],
  288. [AS_HELP_STRING([--enable-threads=yes/no],
  289. [Use this option to create a singled-threaded version of this library])],
  290. [LOG4CPLUS_CHECK_YESNO([${enableval}], [--enable-threads])],
  291. [enable_threads=yes])
  292. AS_IF([test "x$enable_threads" = "xyes"],
  293. dnl Multi threaded library.
  294. [AC_MSG_NOTICE([Creating a multi-threaded library.])
  295. AC_MSG_NOTICE([Threads support:])
  296. AS_VAR_APPEND([CPPFLAGS], [" -D_REENTRANT"])
  297. AS_CASE(["$target_os"],
  298. [mingw*], [],
  299. [AX_PTHREAD_CXX([],
  300. [AC_MSG_ERROR([Requested threads support but no threads were found.])])])
  301. AS_VAR_APPEND([CXXFLAGS], [" $PTHREAD_CXXFLAGS"])
  302. AS_VAR_APPEND([LIBS], [" $PTHREAD_LIBS"])
  303. dnl required on HP-UX
  304. AC_SEARCH_LIBS([sem_init], [rt])
  305. AS_CASE([$ax_cv_cxx_compiler_vendor],
  306. [gnu|clang],
  307. [dnl GCC, empty case to avoid false positive for -qtls check.
  308. ],
  309. [sun],
  310. [dnl Check for Sun's compiler's TLS option.
  311. AX_CXXFLAGS_SUN_OPTION([-xthreadvar])],
  312. [ibm],
  313. [dnl Check for IBM's compiler's TLS option.
  314. AX_CXXFLAGS_AIX_OPTION([-qtls])])
  315. AX__SYNC
  316. AH_TEMPLATE([LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH])
  317. AS_IF([test "x$ac_cv___sync_add_and_fetch" = "xyes"],
  318. [AC_DEFINE([LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH])])
  319. AH_TEMPLATE([LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH])
  320. AS_IF([test "x$ac_cv___sync_sub_and_fetch" = "xyes"],
  321. [AC_DEFINE([LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH])])
  322. AH_TEMPLATE([LOG4CPLUS_HAVE_CXX11_ATOMICS])
  323. AS_IF([test "x$ac_cv_cxx11_atomics" = "xyes"],
  324. [AC_DEFINE([LOG4CPLUS_HAVE_CXX11_ATOMICS])])
  325. AX_TLS_SUPPORT
  326. AH_TEMPLATE([LOG4CPLUS_HAVE_TLS_SUPPORT])
  327. AH_TEMPLATE([LOG4CPLUS_THREAD_LOCAL_VAR])
  328. AS_IF([test "x$ac_cv_declspec_thread" = "xyes"],
  329. [AC_DEFINE([LOG4CPLUS_HAVE_TLS_SUPPORT])
  330. AC_DEFINE([LOG4CPLUS_THREAD_LOCAL_VAR], [__declspec(thread)])],
  331. [AS_IF([test "x$ac_cv__thread_keyword" = "xyes"],
  332. [AC_DEFINE([LOG4CPLUS_HAVE_TLS_SUPPORT])
  333. AC_DEFINE([LOG4CPLUS_THREAD_LOCAL_VAR], [__thread])])])],
  334. dnl Single threaded library.
  335. [AC_MSG_NOTICE([Creating a single-threaded library])
  336. AC_DEFINE([LOG4CPLUS_SINGLE_THREADED], [1],
  337. [Define if this is a single-threaded library.])])
  338. AM_CONDITIONAL([MULTI_THREADED], [test "x$enable_threads" = "xyes"])
  339. dnl Library functions checks are here because preprocessor symbols
  340. dnl like _REENTRANT can influence availability of some functions.
  341. dnl Checks for library functions.
  342. LOG4CPLUS_CHECK_FUNCS([gmtime_r], [LOG4CPLUS_HAVE_GMTIME_R])
  343. LOG4CPLUS_CHECK_FUNCS([localtime_r], [LOG4CPLUS_HAVE_LOCALTIME_R])
  344. LOG4CPLUS_CHECK_FUNCS([gettimeofday], [LOG4CPLUS_HAVE_GETTIMEOFDAY])
  345. LOG4CPLUS_CHECK_FUNCS([nanosleep], [LOG4CPLUS_HAVE_NANOSLEEP])
  346. LOG4CPLUS_CHECK_FUNCS([clock_nanosleep], [LOG4CPLUS_HAVE_CLOCK_NANOSLEEP])
  347. LOG4CPLUS_CHECK_FUNCS([clock_gettime], [LOG4CPLUS_HAVE_CLOCK_GETTIME])
  348. LOG4CPLUS_CHECK_FUNCS([getpid], [LOG4CPLUS_HAVE_GETPID])
  349. LOG4CPLUS_CHECK_FUNCS([ftime], [LOG4CPLUS_HAVE_FTIME])
  350. LOG4CPLUS_CHECK_FUNCS([stat], [LOG4CPLUS_HAVE_STAT])
  351. LOG4CPLUS_CHECK_FUNCS([lstat], [LOG4CPLUS_HAVE_LSTAT])
  352. LOG4CPLUS_CHECK_FUNCS([fcntl], [LOG4CPLUS_HAVE_FCNTL])
  353. LOG4CPLUS_CHECK_FUNCS([lockf], [LOG4CPLUS_HAVE_LOCKF])
  354. LOG4CPLUS_CHECK_FUNCS([flock], [LOG4CPLUS_HAVE_FLOCK])
  355. LOG4CPLUS_CHECK_FUNCS([htons], [LOG4CPLUS_HAVE_HTONS])
  356. LOG4CPLUS_CHECK_FUNCS([ntohs], [LOG4CPLUS_HAVE_NTOHS])
  357. LOG4CPLUS_CHECK_FUNCS([htonl], [LOG4CPLUS_HAVE_HTONL])
  358. LOG4CPLUS_CHECK_FUNCS([ntohl], [LOG4CPLUS_HAVE_NTOHL])
  359. LOG4CPLUS_CHECK_FUNCS([mbstowcs], [LOG4CPLUS_HAVE_MBSTOWCS])
  360. LOG4CPLUS_CHECK_FUNCS([wcstombs], [LOG4CPLUS_HAVE_WCSTOMBS])
  361. AS_IF([test "x$with_iconv" = "xyes"],
  362. [LOG4CPLUS_CHECK_FUNCS([iconv_open], [LOG4CPLUS_HAVE_ICONV_OPEN])
  363. LOG4CPLUS_CHECK_FUNCS([iconv_close], [LOG4CPLUS_HAVE_ICONV_CLOSE])
  364. LOG4CPLUS_CHECK_FUNCS([iconv], [LOG4CPLUS_HAVE_ICONV])
  365. LOG4CPLUS_CHECK_FUNCS([libiconv_open], [LOG4CPLUS_HAVE_ICONV_OPEN])
  366. LOG4CPLUS_CHECK_FUNCS([libiconv_close], [LOG4CPLUS_HAVE_ICONV_CLOSE])
  367. LOG4CPLUS_CHECK_FUNCS([libiconv], [LOG4CPLUS_HAVE_ICONV])])
  368. dnl Various functions used by snprintf.cxx.
  369. LOG4CPLUS_CHECK_FUNCS([vsnprintf], [LOG4CPLUS_HAVE_VSNPRINTF])
  370. LOG4CPLUS_CHECK_FUNCS([_vsnprintf], [LOG4CPLUS_HAVE__VSNPRINTF])
  371. LOG4CPLUS_CHECK_FUNCS([vsprintf_s], [LOG4CPLUS_HAVE_VSPRINTF_S])
  372. LOG4CPLUS_CHECK_FUNCS([vswprintf_s], [LOG4CPLUS_HAVE_VSWPRINTF_S])
  373. LOG4CPLUS_CHECK_FUNCS([vfprintf_s], [LOG4CPLUS_HAVE_VFPRINTF_S])
  374. LOG4CPLUS_CHECK_FUNCS([vfwprintf_s], [LOG4CPLUS_HAVE_VFWPRINTF_S])
  375. LOG4CPLUS_CHECK_FUNCS([_vsnprintf_s], [LOG4CPLUS_HAVE__VSNPRINTF_S])
  376. LOG4CPLUS_CHECK_FUNCS([_vsnwprintf_s], [LOG4CPLUS_HAVE__VSNWPRINTF_S])
  377. dnl These should not be necessary, they ought to be in std:: namespace
  378. dnl via the <cstdio>, <cwchar> headers.
  379. dnl AH_TEMPLATE([LOG4CPLUS_HAVE_VSPRINTF])
  380. dnl AC_CHECK_FUNCS([vsprintf], [AC_DEFINE([LOG4CPLUS_HAVE_VSPRINTF])])
  381. dnl AH_TEMPLATE([LOG4CPLUS_HAVE_VFPRINTF])
  382. dnl AC_CHECK_FUNCS([vfprintf], [AC_DEFINE([LOG4CPLUS_HAVE_VFPRINTF])])
  383. dnl AH_TEMPLATE([LOG4CPLUS_HAVE_VSWPRINTF])
  384. dnl AC_CHECK_FUNCS([vswprintf], [AC_DEFINE([LOG4CPLUS_HAVE_VSWPRINTF])])
  385. AH_TEMPLATE([LOG4CPLUS_HAVE_ENAMETOOLONG])
  386. AC_CACHE_CHECK([for ENAMETOOLONG], [ax_cv_have_enametoolong],
  387. [AC_COMPILE_IFELSE(
  388. [AC_LANG_PROGRAM([#include <errno.h>], [int value = ENAMETOOLONG;])],
  389. [ax_cv_have_enametoolong=yes],
  390. [ax_cv_have_enametoolong=no])])
  391. AS_IF([test "x$ax_cv_have_enametoolong" = "xyes"],
  392. [AC_DEFINE([LOG4CPLUS_HAVE_ENAMETOOLONG])])
  393. AH_TEMPLATE([LOG4CPLUS_HAVE_GETADDRINFO])
  394. AX_GETADDRINFO
  395. AS_IF([test "x$ax_cv_have_getaddrinfo" = "xyes"],
  396. [AC_DEFINE([LOG4CPLUS_HAVE_GETADDRINFO])])
  397. AH_TEMPLATE([LOG4CPLUS_HAVE_GETHOSTBYNAME_R])
  398. AX_GETHOSTBYNAME_R
  399. AS_IF([test "x$ax_cv_have_gethostbyname_r" = "xyes"],
  400. [AC_DEFINE([LOG4CPLUS_HAVE_GETHOSTBYNAME_R])])
  401. AH_TEMPLATE([LOG4CPLUS_HAVE_GETTID])
  402. AC_CACHE_CHECK([for gettid], [ax_cv_have_gettid],
  403. [AC_COMPILE_IFELSE(
  404. [AC_LANG_PROGRAM([#include <sys/types.h>
  405. #include <sys/syscall.h>
  406. #include <unistd.h>], [int rv = syscall(SYS_gettid);])],
  407. [ax_cv_have_gettid=yes],
  408. [ax_cv_have_gettid=no])])
  409. AS_IF([test "x$ax_cv_have_gettid" = "xyes"],
  410. [AC_DEFINE([LOG4CPLUS_HAVE_GETTID])])
  411. dnl Qt4 setup using pkg-config.
  412. PKG_PROG_PKG_CONFIG
  413. AC_ARG_WITH([qt],
  414. [AS_HELP_STRING([--with-qt],
  415. [Build liblog4cplusqt4debugappender.])],
  416. [LOG4CPLUS_CHECK_YESNO([${withval}], [--with-qt])],
  417. [with_qt=no])
  418. AS_IF([test "x$with_qt" = "xyes"],
  419. [PKG_CHECK_MODULES([QT], [QtCore >= 4.0.0])],
  420. [QT_CFLAGS=
  421. QT_LIBS=])
  422. AM_CONDITIONAL([QT], [test "x$with_qt" = "xyes"])
  423. AC_SUBST([QT_CFLAGS])
  424. AC_SUBST([QT_LIBS])
  425. dnl Libtool setup.
  426. dnl Must be latest to catch rpath compiled in by changes made during
  427. dnl checks before.
  428. LT_PREREQ([2.4.2])
  429. LT_INIT([win32-dll])
  430. AH_TOP([#ifndef LOG4CPLUS_CONFIG_H])
  431. AH_TOP([#define LOG4CPLUS_CONFIG_H])
  432. AH_BOTTOM([#endif // LOG4CPLUS_CONFIG_H])
  433. AC_CONFIG_HEADERS([include/log4cplus/config.h])
  434. AC_CONFIG_HEADERS([include/log4cplus/config/defines.hxx])
  435. AC_CONFIG_FILES([Makefile
  436. include/Makefile
  437. src/Makefile
  438. loggingserver/Makefile
  439. qt4debugappender/Makefile
  440. tests/Makefile
  441. tests/appender_test/Makefile
  442. tests/configandwatch_test/Makefile
  443. tests/customloglevel_test/Makefile
  444. tests/fileappender_test/Makefile
  445. tests/filter_test/Makefile
  446. tests/hierarchy_test/Makefile
  447. tests/loglog_test/Makefile
  448. tests/ndc_test/Makefile
  449. tests/ostream_test/Makefile
  450. tests/patternlayout_test/Makefile
  451. tests/performance_test/Makefile
  452. tests/priority_test/Makefile
  453. tests/propertyconfig_test/Makefile
  454. tests/socket_test/Makefile
  455. tests/thread_test/Makefile
  456. tests/timeformat_test/Makefile])
  457. AC_SUBST([LOG4CPLUS_PROFILING_LDFLAGS])
  458. AC_SUBST([LOG4CPLUS_PROFILING_CXXFLAGS])
  459. AC_OUTPUT([log4cplus.pc])