## @file
##
## $Id$
##
## $Date$
## $Author$
##
## @copy © Marc Wäckerlin
## @license LGPL, see file <a href="license.html">COPYING</a>
##
# init
AC_INIT([mrw/mrw.hpp.in])
PACKAGENAME=mrw-c++
m4_define(x_major, 1)
m4_define(x_minor, 6)
m4_define(x_least, 0)
AM_INIT_AUTOMAKE(@PACKAGENAME@, @MAJOR@.@MINOR@.@LEAST@, [marc@waeckerlin.org])
# copy M4 to shell
MAJOR=x_major
MINOR=x_minor
LEAST=x_least
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(LEAST)
# libtool versioning
LIB_MAJOR=m4_eval(x_major+x_minor)
LIB_MINOR=x_least
LIB_LEAST=x_minor
LIB_VERSION="${LIB_MAJOR}:${LIB_MINOR}:${LIB_LEAST}"
AC_SUBST(LIB_VERSION)
# macros
README=README
AC_SUBST_FILE(README)
CHANGE_LOG=ChangeLog
AC_SUBST_FILE(CHANGE_LOG)
# languages
AC_LANG(C++)
# programs
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_CHECK_PROG(have_doxygen, doxygen, yes, no)
AC_CHECK_PROG(have_dot, dot, yes, no)
# solaris?
AC_CHECK_HEADER(sys/old_procfs.h, [AM_CPPFLAGS=-D__solaris__])
# libraries
AC_CHECK_HEADER(log4cxx/logger.h, [have_log4cxx=yes])
# Arguments
AM_MAINTAINER_MODE
AC_ARG_WITH(tracer,
[ --with-tracer=name add additional tracing output to this library itself],
[with_tracer="$withval"], [with_tracer="no"])
AM_CONDITIONAL(TRACER, test "$with_tracer" == "yes")
if test "$with_tracer" != "no"; then
if test "$with_tracer" != "yes"; then
TRACE=$with_tracer
else
TRACE="trace"
fi
AC_SUBST(TRACE)
fi
AC_ARG_ENABLE(pedantic,
[ --enable-pedantic enable all warnings and checks, abort on warnings],
[have_pedantic="$enableval"; test "$enableval" = "yes" && \
AM_CXXFLAGS="${AM_CXXFLAGS:-} -pedantic-errors -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wpacked -Wredundant-decls -Werror -Wshadow -Wcast-qual -Wno-ctor-dtor-privacy"])
dnl problem in libs: -Wshadow -Wcast-qual
dnl auto.hpp: -Wno-ctor-dtor-privacy (removed)
AM_CONDITIONAL(PEDANTIC, test "$enableval" = "yes")
AC_ARG_ENABLE(dot,
[ --disable-dot disable dot graphic tools for documentation],
[have_dot="$enableval"])
test "$enableval" = "yes" && HAVE_DOT="YES" || HAVE_DOT="NO";
AC_ARG_ENABLE(log4cxx,
[ --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(stacktrace,
[ --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"], [have_stacktrace="yes"])
AM_CONDITIONAL(HAVE_STACKTRACE, test "$have_stacktrace" = "yes")
if test "$have_stacktrace" = "yes"; then
AC_SEARCH_LIBS(cplus_demangle, [demangle iberty],
[AC_MSG_RESULT([OK, found cplus_demangle])],
[AC_MSG_ERROR([Library iberty is required!])])
AC_SEARCH_LIBS(bfd_arch_list, bfd,
[have_bfd="yes";
AC_MSG_RESULT([OK, found bfd, no need for additional libs])],
[have_bfd="no"])
if test "$have_bfd" != "yes"; then
unset ac_cv_search_bfd_arch_list
AC_SEARCH_LIBS(bfd_arch_list, bfd,
[AC_MSG_RESULT([OK, found bfd, but require more libs])
LIBS="${LIBS:-} -lintl -liberty"],
[AC_MSG_ERROR([BFD library libbfd is required])],
[-lintl -liberty])
fi
fi
# export macros
AC_SUBST(HAVE_DOT)
AC_SUBST(PACKAGENAME)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(LIBS)
# create output
AC_CONFIG_FILES([makefile mrw-c++.spec
mrw/makefile mrw/doxyfile mrw/mrw.hpp mrw/version.cpp])
AC_OUTPUT
# infos and warnings
if test "$have_doxygen" = "no"; then
AC_MSG_WARN([Missing program doxygen!
- you cannot rebuild the documentation with make doc
- there are precompiled derieved files in the distribution]); fi
if test "$have_dot" = "no"; then
AC_MSG_WARN([Missing program dot!
- when you rebild documentation with make doc, there are no generated images
- there are precompiled derieved files in the distribution]); fi
if test "$have_pedantic" == "yes"; then
AC_MSG_NOTICE([Pedantic compile mode enabled!
- all warnings for GNU g++ are enabled
- all warnings result in an error
- doxygen warnings are treated as error too]); fi
if test "$with_tracer" != "no"; then
AC_MSG_NOTICE([Verbose tracing is enabled!
- function traces will be printed for all methods in the library
- tracer is: $TRACE]); 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