C++ Library containing a lot of needful things: Stack Trace, Command Line Parser, Resource Handling, Configuration Files, Unix Command Execution, Directories, Regular Expressions, Tokenizer, Function Trace, Standard Extensions.
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.

configure.ac 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. ## @id $Id$
  2. #
  3. # This file has been added by bootstrap.sh on Tue, 28 July 2015 11:31:59 +0200
  4. # Feel free to change it or even remove and rebuild it, up to your needs
  5. #
  6. ## 1 2 3 4 5 6 7 8
  7. ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
  8. PROJECT_URL="https://dev.marc.waeckerlin.org/projects/mrw-c++"
  9. m4_define(x_package_name, mrw-c++) # project's name
  10. m4_define(x_major, 5) # project's major version
  11. m4_define(x_minor, 0) # project's minor version
  12. m4_define(x_least_diff, 488) # diff in minor
  13. m4_include(ax_init_standard_project.m4)
  14. AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
  15. AM_INIT_AUTOMAKE([1.9 tar-pax])
  16. AX_INIT_STANDARD_PROJECT
  17. # requirements, uncomment, what you need:
  18. AX_USE_CXX_11
  19. AX_USE_LIBTOOL
  20. #AX_USE_SCRIPTS
  21. AX_USE_DOXYGEN
  22. AX_USE_DEBIAN_PACKAGING
  23. AX_USE_RPM_PACKAGING
  24. AX_USE_CPPUNIT
  25. AX_BUILD_EXAMPLES
  26. #AX_BUILD_HTML
  27. # qt features, uncomment, what you need:
  28. #AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
  29. #AX_QT_NO_KEYWORDS
  30. # libraries
  31. AC_CHECK_HEADER(log4cxx/logger.h, [have_log4cxx=yes])
  32. AC_CHECK_HEADER(ltdl.h, [have_ltdl=yes])
  33. AC_CHECK_HEADER(regex.h, [have_regex=yes])
  34. AC_CHECK_HEADERS(unistd.h fcntl.h, [have_exec=yes])
  35. AC_CHECK_HEADER(dirent.h, [have_dir=yes])
  36. # solaris?
  37. AC_CHECK_HEADER(sys/old_procfs.h, [AM_CPPFLAGS+="-D__solaris__"])
  38. # Arguments
  39. AC_ARG_ENABLE(valgrind,
  40. AS_HELP_STRING([--enable-valgrind],
  41. [runs all checks with valgrind enabled]),
  42. [have_valgrind="$enableval"], [have_valgrind="no"])
  43. AM_CONDITIONAL(HAVE_VALGRIND, test "$have_valgrind" = "yes")
  44. AC_ARG_ENABLE(threads,
  45. AS_HELP_STRING([--disable-threads], [disable multithreading]),
  46. [with_threads="$enableval"], [with_threads="yes"])
  47. AM_CONDITIONAL(HAVE_THREADS, test "$with_threads" = "yes")
  48. AC_ARG_ENABLE(autofntrace,
  49. AS_HELP_STRING([--disable-autofntrace],
  50. [disable automated function trace (requires gcc)]),
  51. [with_autofntrace="$enableval"], [with_autofntrace="yes"])
  52. AM_CONDITIONAL(AUTOFNTRACE, test "$with_autofntrace" = "yes" -a -n "$GCC")
  53. AC_ARG_ENABLE(dir,
  54. AS_HELP_STRING([--disable-dir], [disable POSIX directory access]),
  55. [have_dir="$enableval"])
  56. AM_CONDITIONAL(HAVE_DIR, test "$have_dir" = "yes")
  57. AC_ARG_ENABLE(exec,
  58. AS_HELP_STRING([--disable-exec],
  59. [disable UNIX fork and execute with pipes]),
  60. [have_exec="$enableval"],
  61. [if test "$MINGW" = "1"; then have_exec="no"; else have_exec="yes"; fi])
  62. AM_CONDITIONAL(HAVE_EXEC, test "$have_exec" = "yes")
  63. AC_ARG_ENABLE(regexp,
  64. AS_HELP_STRING([--disable-regexp],
  65. [disable use of regular expressions]),
  66. [have_regex="$enableval"])
  67. AM_CONDITIONAL(HAVE_REGEXP, test "$have_regex" = "yes")
  68. AC_ARG_ENABLE(log4cxx,
  69. AS_HELP_STRING([--disable-log4cxx],
  70. [disable use of log4cxx library in automated stack trace]),
  71. [have_log4cxx="$enableval"])
  72. AM_CONDITIONAL(HAVE_LOG4CXX, test "$have_log4cxx" = "yes")
  73. AC_ARG_ENABLE(ltdl,
  74. AS_HELP_STRING([--disable-ltdl],
  75. [enable use of libtool library dynamic loading Note: For automated stack trace, you need either ltdl or the libbfd BFD library from the binutils package at compile time.]),
  76. [have_ltdl="$enableval"], [have_ltdl="$have_ltdl"])
  77. AM_CONDITIONAL(HAVE_LTDL, test "$have_ltdl" = "yes")
  78. AC_ARG_ENABLE(dynamicstack,
  79. AS_HELP_STRING([--enable-dynamic-stack],
  80. [enable use of libtool library dynamic loading for stacktrace, this means the code is not linked to libbfd, instead a dynamical version of libbfd is loaded at runtime - this prevents dependency on the bfd library (which is part of the GNU binutils). Note: For automated stack trace, you need either ltdl or the libbfd BFD library from the GNU binutils package at compile time.]),
  81. [have_dynamicstack="$enableval"], [have_dynamicstack="no"])
  82. AC_ARG_ENABLE(stacktrace,
  83. AS_HELP_STRING([--disable-stacktrace],
  84. [disable stack trace, use this if you cannot compile the library on your system otherwise and you still want to use the other parts]),
  85. [have_stacktrace="$enableval"],
  86. [if test "$MINGW" = "1"; then have_stacktrace="no"; else have_stacktrace="yes"; fi])
  87. AM_CONDITIONAL(HAVE_STACKTRACE, test "$have_stacktrace" = "yes")
  88. if test "$have_stacktrace" = "yes"; then
  89. # Hack for bug:
  90. # /usr/include/libiberty.h:106:36:
  91. # error: new declaration 'char* basename(const char*)'
  92. # /usr/include/string.h:603:28: error:
  93. # ambiguates old declaration 'const char* basename(const char*)'
  94. # bug {
  95. old_ac_includes_default=$ac_includes_default
  96. ac_includes_default=""
  97. # } bug
  98. AC_CHECK_HEADER([demangle.h],
  99. [AC_DEFINE([HAVE_DEMANGLE_H])],
  100. [AC_MSG_WARN([Header "demangle.h" from the binutils not found!
  101. - unfortunately, the bintils do not install this header
  102. (even though they should)
  103. - the required symbols are now declared in stacktrace.cxx according to my
  104. own binutils version (binutils-2.16.1) it may or may not be compatible to
  105. yours])])
  106. AC_SEARCH_LIBS(cplus_demangle, [demangle iberty_pic iberty],
  107. [AC_MSG_RESULT([OK, found cplus_demangle])],
  108. [AC_MSG_WARN([Function cplus_demangle not found!
  109. - I looked in libdemangle and libiberty
  110. - Try "find /usr/lib -name 'libdemangle*' -o -name 'libiberty*'"
  111. - is one of them installed?
  112. - If yes, try: "nm <filename> | grep cplus_demangle"
  113. -> is the symbol defined?
  114. - on Ubuntu (trusty) install libiberty-dev
  115. - Try to compile with option --disable-stacktrace
  116. If you are not a developer, you perhaps don't need it...?])])
  117. if test "$have_dynamicstack" != "yes" -a "$have_cplus_demangle" = "yes"; then
  118. AC_DEFINE([NO_LTDL])
  119. AC_SEARCH_LIBS(compress, z,
  120. [AC_MSG_RESULT([OK, found libz])],
  121. [AC_MSG_ERROR([zlib (libz) not found!
  122. It is required for stack trace!
  123. - install zlib development package
  124. - or configure with option --enable-ltdl
  125. - or configure with option --disable-stacktrace])])
  126. AC_SEARCH_LIBS(dlopen, dl,
  127. [AC_MSG_RESULT([OK, found libdl])],
  128. [AC_MSG_ERROR([libdl not found!
  129. It is required for stack trace!
  130. - install libdl development package
  131. - or configure with option --enable-ltdl
  132. - or configure with option --disable-stacktrace])])
  133. AC_SEARCH_LIBS(bfd_openr, bfd,
  134. [AC_MSG_RESULT([OK, found libbfd])],
  135. [AC_MSG_ERROR([BFD library from the binutils package not found!
  136. It is required for stack trace!
  137. - install binutils or binutils-devel
  138. - or configure with option --enable-ltdl
  139. - or configure with option --disable-stacktrace])])
  140. fi
  141. # bug {
  142. ac_includes_default=$old_ac_includes_default
  143. # } bug
  144. fi
  145. AC_ARG_WITH([boost-thread],
  146. AS_HELP_STRING([--with-boost-thread],
  147. [specify the boost thread library or suffix to use]),
  148. [if test "$with_boost_thread" != "no"; then
  149. if test "$with_boost_thread" != "yes"; then
  150. chk_libs="$with_boost_thread boost_thread-$with_boost_thread"
  151. else
  152. chk_libs="boost_thread boost_thread-mt boost_thread-gcc-mt"
  153. fi
  154. else
  155. chk_libs=""
  156. fi],
  157. [chk_libs=( "boost_thread boost_thread-mt boost_thread-${CXX} boost_thread-${CC} boost_thread-${CXX}-mt boost_thread-${CC}-mt" "boost_system" )])
  158. for (( i=0; i<${#chk_libs[*]}; ++i )); do rnd=${chk_libs[$i]}
  159. for ax_lib in $rnd; do
  160. AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIB="${BOOST_THREAD_LIB} -l$ax_lib" break])
  161. done
  162. done
  163. AC_SUBST(BOOST_THREAD_LIB)
  164. AM_CONDITIONAL(HAVE_BOOST_THREAD, test -n "$BOOST_THREAD_LIB")
  165. # special dependencies for specific distros
  166. AX_ALL_BUILD_DEPEND_DEV(binutils)
  167. AX_ALL_DEPEND_IFEXISTS_DEV(libiberty)
  168. AX_ALL_DEPEND_IFEXISTS_DEV(liblog4cxx liblog4cxx10)
  169. AX_DEB_BUILD_DEPEND(libboost-dev)
  170. AX_DEB_BUILD_DEPEND(libz-dev)
  171. AX_RPM_BUILD_DEPEND(boost-devel)
  172. AX_RPM_BUILD_DEPEND(zlib-devel)
  173. # thread options
  174. THREADS="-pthread -D_MT"
  175. AC_SUBST(THREADS)
  176. # create output
  177. AX_OUTPUT
  178. # infos and warnings
  179. if test "$have_valgrind" != "yes"; then
  180. AC_MSG_WARN([Feature Valgrind is disabled, to use it --enable-valgrind])
  181. fi
  182. if test "$with_threads" != "yes"; then
  183. AC_MSG_WARN([Feature Threads is disabled, to use it --enable-threads])
  184. fi
  185. if test "$with_autofntrace" != "yes"; then
  186. AC_MSG_WARN([Feature Automatic Function Trace is disabled, to use it --enable-autofntrace])
  187. fi
  188. if test "$have_dir" != "yes"; then
  189. AC_MSG_WARN([Feature POSIX Directory Access is disabled, to use it --enable-dir])
  190. fi
  191. if test "$have_exec" != "yes"; then
  192. AC_MSG_WARN([Feature UNIX Fork Execute is disabled, to use it --enable-exec])
  193. fi
  194. if test "$have_regex" != "yes"; then
  195. AC_MSG_WARN([Feature Regular Expressions is disabled, to use it --enable-regex])
  196. fi
  197. if test "$have_log4cxx" != "yes"; then
  198. AC_MSG_WARN([Feature Log4cxx Logging is disabled, to use it --enable-log4cxx])
  199. fi
  200. if test "$have_ltdl" != "yes"; then
  201. AC_MSG_WARN([Feature LibTool Library is disabled, to use it --enable-ltdl])
  202. fi
  203. if test "$have_dynamicstack" != "yes"; then
  204. AC_MSG_WARN([Feature Dynamic Stack is disabled, to use it --enable-dynamicstack])
  205. fi
  206. if test "$have_stacktrace" != "yes"; then
  207. AC_MSG_WARN([Feature Stack Trace is disabled, to use it --enable-stacktrace])
  208. fi
  209. if test "$with_threads" = "no"; then
  210. AC_MSG_WARN([Multithreading support is disabled!
  211. - use --enable-threads to enable it
  212. - actually, there's only support for automated function trace]); fi
  213. if test "$have_dir" != "yes"; then
  214. AC_MSG_WARN([POSIX directory access is disabled!
  215. - you need a UNIX/Posix environment if you want to use it]); fi
  216. if test "$have_exec" != "yes"; then
  217. AC_MSG_WARN([UNIX fork/exec with pipes will not be used!
  218. - you need a UNIX/Posix environment if you want to use it]); fi
  219. if test "$have_regex" != "yes"; then
  220. AC_MSG_WARN([GNU regular expression library will not be used!
  221. - if you want it, install it]); fi
  222. if test "$have_log4cxx" != "yes"; then
  223. AC_MSG_WARN([Library log4cxx will not be used!
  224. - if you want it, download it from:
  225. http://logging.apache.org/log4cxx]); fi
  226. if test "$have_stacktrace" != "yes"; then
  227. AC_MSG_WARN([mrw::StackTrace is disabled!]); fi
  228. if test "$have_ltdl" != "yes"; then
  229. AC_MSG_WARN([mrw::DynamicLibrary dynamic library loading is disabled!
  230. - install the GNU libtool, if you need mrw::DynamicLibrary]);fi
  231. if test "$with_autofntrace" != "yes" -o -z "$GCC"; then
  232. AC_MSG_WARN([Automated GNU gcc function tracing is disabled!
  233. - libmrwautofunctiontracestdout won't be built
  234. - libmrwautofunctiontracelog4cxx won't be built]);fi
  235. if test -z "$BOOST_THREAD_LIB"; then
  236. AC_MSG_WARN([Boost thread library not found!
  237. - multithreading is based on boost thread library
  238. - support for multithreading is disabled
  239. - try to pass the library name, e.g.
  240. --with-boost-thread=boost_thread-icc-mt]);fi
  241. if test "$have_dynamicstack" = "yes" -a \
  242. \( "$have_stacktrace" != "yes" -o "$have_ltdl" != "yes" \); then
  243. AC_MSG_ERROR([Option --enable-dynamic-stack was given, but either
  244. stacktrace is disabled or ltdl is disabled.
  245. --enable-dynamic-stack should always be used together with options
  246. --enable-stacktrace and
  247. --enable-ltdl]);fi
  248. AC_MSG_NOTICE([configuration done for ${PACKAGE_STRING}])