## @id $Id$
#
# This file has been added by bootstrap.sh on Tue, 28 July 2015 11:31:59 +0200
# Feel free to change it or even remove and rebuild it, up to your needs
#
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
PROJECT_URL="https://dev.marc.waeckerlin.org/projects/mrw-c++"
m4_define(x_package_name, mrw-c++) # project's name
m4_define(x_major, 4) # project's major version
m4_define(x_minor, 5) # project's minor version
m4_define(x_least_diff, 469) # diff in minor
m4_include(ax_init_standard_project.m4)
AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AX_INIT_STANDARD_PROJECT
# requirements, uncomment, what you need:
AX_USE_CXX
AX_USE_LIBTOOL
#AX_USE_SCRIPTS
AX_USE_DOXYGEN
AX_USE_DEBIAN_PACKAGING
AX_USE_RPM_PACKAGING
AX_USE_CPPUNIT
AX_BUILD_EXAMPLES
#AX_BUILD_HTML
# qt features, uncomment, what you need:
#AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
#AX_QT_NO_KEYWORDS
# libraries
AC_CHECK_HEADER(log4cxx/logger.h, [have_log4cxx=yes])
AC_CHECK_HEADER(ltdl.h, [have_ltdl=yes])
AC_CHECK_HEADER(regex.h, [have_regex=yes])
AC_CHECK_HEADERS(unistd.h fcntl.h, [have_exec=yes])
AC_CHECK_HEADER(dirent.h, [have_dir=yes])
# solaris?
AC_CHECK_HEADER(sys/old_procfs.h, [AM_CPPFLAGS+="-D__solaris__"])
# Arguments
AC_ARG_ENABLE(valgrind,
AS_HELP_STRING([--enable-valgrind],
[runs all checks with valgrind enabled]),
[have_valgrind="$enableval"], [have_valgrind="no"])
AM_CONDITIONAL(HAVE_VALGRIND, test "$have_valgrind" = "yes")
AC_ARG_ENABLE(threads,
AS_HELP_STRING([--disable-threads], [disable multithreading]),
[with_threads="$enableval"], [with_threads="yes"])
AM_CONDITIONAL(HAVE_THREADS, test "$with_threads" = "yes")
AC_ARG_ENABLE(autofntrace,
AS_HELP_STRING([--disable-autofntrace],
[disable automated function trace (requires gcc)]),
[with_autofntrace="$enableval"], [with_autofntrace="yes"])
AM_CONDITIONAL(AUTOFNTRACE, test "$with_autofntrace" = "yes" -a -n "$GCC")
AC_ARG_ENABLE(dir,
AS_HELP_STRING([--disable-dir], [disable POSIX directory access]),
[have_dir="$enableval"])
AM_CONDITIONAL(HAVE_DIR, test "$have_dir" = "yes")
AC_ARG_ENABLE(exec,
AS_HELP_STRING([--disable-exec],
[disable UNIX fork and execute with pipes]),
[have_exec="$enableval"],
[if test "$MINGW" = "1"; then have_exec="no"; else have_exec="yes"; fi])
AM_CONDITIONAL(HAVE_EXEC, test "$have_exec" = "yes")
AC_ARG_ENABLE(regexp,
AS_HELP_STRING([--disable-regexp],
[disable use of regular expressions]),
[have_regex="$enableval"])
AM_CONDITIONAL(HAVE_REGEXP, test "$have_regex" = "yes")
AC_ARG_ENABLE(log4cxx,
AS_HELP_STRING([--disable-log4cxx],
[disable use of log4cxx library in automated stack trace]),
[have_log4cxx="$enableval"])
AM_CONDITIONAL(HAVE_LOG4CXX, test "$have_log4cxx" = "yes")
AC_ARG_ENABLE(ltdl,
AS_HELP_STRING([--disable-ltdl],
[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.]),
[have_ltdl="$enableval"], [have_ltdl="$have_ltdl"])
AM_CONDITIONAL(HAVE_LTDL, test "$have_ltdl" = "yes")
AC_ARG_ENABLE(dynamicstack,
AS_HELP_STRING([--enable-dynamic-stack],
[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.]),
[have_dynamicstack="$enableval"], [have_dynamicstack="no"])
AC_ARG_ENABLE(stacktrace,
AS_HELP_STRING([--disable-stacktrace],
[disable stack trace, use this if you cannot compile the library on your system otherwise and you still want to use the other parts]),
[have_stacktrace="$enableval"],
[if test "$MINGW" = "1"; then have_stacktrace="no"; else have_stacktrace="yes"; fi])
AM_CONDITIONAL(HAVE_STACKTRACE, test "$have_stacktrace" = "yes")
if test "$have_stacktrace" = "yes"; then
# Hack for bug:
# /usr/include/libiberty.h:106:36:
# error: new declaration 'char* basename(const char*)'
# /usr/include/string.h:603:28: error:
# ambiguates old declaration 'const char* basename(const char*)'
# bug {
old_ac_includes_default=$ac_includes_default
ac_includes_default=""
# } bug
AC_CHECK_HEADER([demangle.h],
[AC_DEFINE([HAVE_DEMANGLE_H])],
[AC_MSG_WARN([Header "demangle.h" from the binutils not found!
- unfortunately, the bintils do not install this header
(even though they should)
- the required symbols are now declared in stacktrace.cxx according to my
own binutils version (binutils-2.16.1) it may or may not be compatible to
yours])])
AC_SEARCH_LIBS(cplus_demangle, [demangle iberty_pic iberty],
[AC_MSG_RESULT([OK, found cplus_demangle])],
[AC_MSG_WARN([Function cplus_demangle not found!
- I looked in libdemangle and libiberty
- Try "find /usr/lib -name 'libdemangle*' -o -name 'libiberty*'"
- is one of them installed?
- If yes, try: "nm <filename> | grep cplus_demangle"
-> is the symbol defined?
- on Ubuntu (trusty) install libiberty-dev
- Try to compile with option --disable-stacktrace
If you are not a developer, you perhaps don't need it...?])])
if test "$have_dynamicstack" != "yes" -a "$have_cplus_demangle" = "yes"; then
AC_DEFINE([NO_LTDL])
AC_SEARCH_LIBS(compress, z,
[AC_MSG_RESULT([OK, found libz])],
[AC_MSG_ERROR([zlib (libz) not found!
It is required for stack trace!
- install zlib development package
- or configure with option --enable-ltdl
- or configure with option --disable-stacktrace])])
AC_SEARCH_LIBS(dlopen, dl,
[AC_MSG_RESULT([OK, found libdl])],
[AC_MSG_ERROR([libdl not found!
It is required for stack trace!
- install libdl development package
- or configure with option --enable-ltdl
- or configure with option --disable-stacktrace])])
AC_SEARCH_LIBS(bfd_openr, bfd,
[AC_MSG_RESULT([OK, found libbfd])],
[AC_MSG_ERROR([BFD library from the binutils package not found!
It is required for stack trace!
- install binutils or binutils-devel
- or configure with option --enable-ltdl
- or configure with option --disable-stacktrace])])
fi
# bug {
ac_includes_default=$old_ac_includes_default
# } bug
fi
AC_ARG_WITH([boost-thread],
AS_HELP_STRING([--with-boost-thread],
[specify the boost thread library or suffix to use]),
[if test "$with_boost_thread" != "no"; then
if test "$with_boost_thread" != "yes"; then
chk_libs="$with_boost_thread boost_thread-$with_boost_thread"
else
chk_libs="boost_thread boost_thread-mt boost_thread-gcc-mt"
fi
else
chk_libs=""
fi],
[chk_libs=( "boost_thread boost_thread-mt boost_thread-${CXX} boost_thread-${CC} boost_thread-${CXX}-mt boost_thread-${CC}-mt" "boost_system" )])
for (( i=0; i<${#chk_libs[*]}; ++i )); do rnd=${chk_libs[$i]}
for ax_lib in $rnd; do
AC_CHECK_LIB($ax_lib, main, [BOOST_THREAD_LIB="${BOOST_THREAD_LIB} -l$ax_lib" break])
done
done
AC_SUBST(BOOST_THREAD_LIB)
AM_CONDITIONAL(HAVE_BOOST_THREAD, test -n "$BOOST_THREAD_LIB")
# special dependencies for specific distros
AX_ALL_BUILD_DEPEND_DEV(binutils)
AX_ALL_DEPEND_IFEXISTS_DEV(libiberty)
AX_ALL_DEPEND_IFEXISTS_DEV(liblog4cxx)
AX_ALL_DEPEND_IFEXISTS_DEV(liblog4cxx10)
AX_DEB_BUILD_DEPEND(libboost-dev)
AX_DEB_BUILD_DEPEND(libz-dev)
AX_RPM_BUILD_DEPEND(boost-devel)
AX_RPM_BUILD_DEPEND(zlib-devel)
# thread options
THREADS="-pthread -D_MT"
AC_SUBST(THREADS)
# create output
AX_OUTPUT
# infos and warnings
if test "$have_valgrind" != "yes"; then
AC_MSG_WARN([Feature Valgrind is disabled, to use it --enable-valgrind])
fi
if test "$with_threads" != "yes"; then
AC_MSG_WARN([Feature Threads is disabled, to use it --enable-threads])
fi
if test "$with_autofntrace" != "yes"; then
AC_MSG_WARN([Feature Automatic Function Trace is disabled, to use it --enable-autofntrace])
fi
if test "$have_dir" != "yes"; then
AC_MSG_WARN([Feature POSIX Directory Access is disabled, to use it --enable-dir])
fi
if test "$have_exec" != "yes"; then
AC_MSG_WARN([Feature UNIX Fork Execute is disabled, to use it --enable-exec])
fi
if test "$have_regex" != "yes"; then
AC_MSG_WARN([Feature Regular Expressions is disabled, to use it --enable-regex])
fi
if test "$have_log4cxx" != "yes"; then
AC_MSG_WARN([Feature Log4cxx Logging is disabled, to use it --enable-log4cxx])
fi
if test "$have_ltdl" != "yes"; then
AC_MSG_WARN([Feature LibTool Library is disabled, to use it --enable-ltdl])
fi
if test "$have_dynamicstack" != "yes"; then
AC_MSG_WARN([Feature Dynamic Stack is disabled, to use it --enable-dynamicstack])
fi
if test "$have_stacktrace" != "yes"; then
AC_MSG_WARN([Feature Stack Trace is disabled, to use it --enable-stacktrace])
fi
if test "$with_threads" = "no"; then
AC_MSG_WARN([Multithreading support is disabled!
- use --enable-threads to enable it
- actually, there's only support for automated function trace]); fi
if test "$have_dir" != "yes"; then
AC_MSG_WARN([POSIX directory access is disabled!
- you need a UNIX/Posix environment if you want to use it]); fi
if test "$have_exec" != "yes"; then
AC_MSG_WARN([UNIX fork/exec with pipes will not be used!
- you need a UNIX/Posix environment if you want to use it]); fi
if test "$have_regex" != "yes"; then
AC_MSG_WARN([GNU regular expression library will not be used!
- if you want it, install it]); fi
if test "$have_log4cxx" != "yes"; then
AC_MSG_WARN([Library log4cxx will not be used!
- if you want it, download it from:
http://logging.apache.org/log4cxx]); fi
if test "$have_stacktrace" != "yes"; then
AC_MSG_WARN([mrw::StackTrace is disabled!]); fi
if test "$have_ltdl" != "yes"; then
AC_MSG_WARN([mrw::DynamicLibrary dynamic library loading is disabled!
- install the GNU libtool, if you need mrw::DynamicLibrary]);fi
if test "$with_autofntrace" != "yes" -o -z "$GCC"; then
AC_MSG_WARN([Automated GNU gcc function tracing is disabled!
- libmrwautofunctiontracestdout won't be built
- libmrwautofunctiontracelog4cxx won't be built]);fi
if test -z "$BOOST_THREAD_LIB"; then
AC_MSG_WARN([Boost thread library not found!
- multithreading is based on boost thread library
- support for multithreading is disabled
- try to pass the library name, e.g.
--with-boost-thread=boost_thread-icc-mt]);fi
if test "$have_dynamicstack" = "yes" -a \
\( "$have_stacktrace" != "yes" -o "$have_ltdl" != "yes" \); then
AC_MSG_ERROR([Option --enable-dynamic-stack was given, but either
stacktrace is disabled or ltdl is disabled.
--enable-dynamic-stack should always be used together with options
--enable-stacktrace and
--enable-ltdl]);fi
AC_MSG_NOTICE([configuration done for ${PACKAGE_STRING}])