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.

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