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.

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