Last change
on this file since 8609 was 7727, checked in by stud-florian, 15 years ago |
Added support for compiling without log4cxx. If log4cxx is not present, all logging is sent directly to stdout.
|
File size:
1.4 KB
|
Rev | Line | |
---|
| 1 | # SYNOPSIS
|
---|
| 2 | #
|
---|
| 3 | # AX_LOG4CXX()
|
---|
| 4 | #
|
---|
| 5 | # DESCRIPTION
|
---|
| 6 | #
|
---|
| 7 | # Check installation of Apache C++ logging library log4cxx, version
|
---|
| 8 | # 0.10.0 or greater.
|
---|
| 9 | #
|
---|
| 10 | #
|
---|
| 11 | # LAST MODIFICATION
|
---|
| 12 | #
|
---|
| 13 | # 2010-03-09
|
---|
| 14 |
|
---|
| 15 | AC_DEFUN([AX_LOG4CXX],
|
---|
| 16 | [
|
---|
| 17 | AC_LANG_PUSH([C++])
|
---|
| 18 |
|
---|
| 19 | AC_CHECK_HEADERS([[log4cxx/logger.h]],
|
---|
| 20 | [
|
---|
| 21 |
|
---|
| 22 | AC_MSG_CHECKING([log4cxx library files (version >=0.10.0)])
|
---|
| 23 |
|
---|
| 24 | dnl Save old $LIBS to eventually restore it.
|
---|
| 25 | ax_log4cxx_save_libs="$LIBS"
|
---|
| 26 | LIBS="$LIBS -llog4cxx"
|
---|
| 27 |
|
---|
| 28 | AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
---|
| 29 | [[
|
---|
| 30 | #include <log4cxx/logger.h>
|
---|
| 31 | #include <log4cxx/basicconfigurator.h>
|
---|
| 32 | ]], [
|
---|
| 33 | log4cxx::BasicConfigurator::configure();
|
---|
| 34 | log4cxx::LoggerPtr logger = log4cxx::Logger::getRootLogger();
|
---|
| 35 | logger->setLevel(log4cxx::Level::getDebug());
|
---|
| 36 | LOG4CXX_INFO(logger, "Simple message text.");])],
|
---|
| 37 | dnl Success
|
---|
| 38 | AC_MSG_RESULT(yes)
|
---|
| 39 | [LIBS="-llog4cxx $LIBS"]
|
---|
| 40 | AC_DEFINE(HAVE_LIBLOG4CXX, [1], "Define to 1 if you have log4cxx library installed")
|
---|
| 41 | , dnl failed
|
---|
| 42 | AC_MSG_RESULT(no)
|
---|
| 43 | AC_MSG_ERROR([[Could not find log4cxx library.
|
---|
| 44 | Version 0.10.0 or greater is required.
|
---|
| 45 | (http://logging.apache.org/log4cxx/index.html)]])
|
---|
| 46 | dnl restore old lib state
|
---|
| 47 | LIBS="$ax_log4cxx_save_libs")
|
---|
| 48 |
|
---|
| 49 | AC_LANG_POP
|
---|
| 50 | ]
|
---|
| 51 |
|
---|
| 52 | ,[AC_MSG_WARN([Could not find log4cxx headers (http://logging.apache.org/log4cxx/index.html), logging will be directly to STDOUT])])
|
---|
| 53 |
|
---|
| 54 | ])
|
---|
Note:
See
TracBrowser
for help on using the repository browser.