source: m4/ax_log4cxx.m4@ 4890

Last change on this file since 4890 was 4890, checked in by Christoph Mayer, 15 years ago

gcc 4 fixes

File size: 1.3 KB
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# 2008-12-11
14
15AC_DEFUN([AX_LOG4CXX],
16[
17 AC_LANG_PUSH([C++])
18
19 AC_CHECK_HEADERS([[log4cxx/logger.h]],,
20 [AC_MSG_ERROR([Could not find log4cxx headers (http://logging.apache.org/log4cxx/index.html)])
21 ])
22
23 AC_MSG_CHECKING([log4cxx library files (version >=0.10.0)])
24
25 dnl Save old $LIBS to eventually restore it.
26 ax_log4cxx_save_libs="$LIBS"
27 LIBS="$LIBS -llog4cxx"
28
29 AC_LINK_IFELSE([AC_LANG_PROGRAM(
30 [[
31#include <log4cxx/logger.h>
32#include <log4cxx/basicconfigurator.h>
33 ]], [
34 log4cxx::BasicConfigurator::configure();
35 log4cxx::LoggerPtr logger = log4cxx::Logger::getRootLogger();
36 logger->setLevel(log4cxx::Level::getDebug());
37 LOG4CXX_INFO(logger, "Simple message text.");])],
38 dnl Success
39 AC_MSG_RESULT(yes)
40 [LIBS="-llog4cxx $LIBS"]
41 AC_DEFINE(HAVE_LIBLOG4CXX, [1], "Define to 1 if you have log4cxx library installed")
42 , dnl failed
43 AC_MSG_RESULT(no)
44 AC_MSG_FAILURE([[Could not find log4cxx library.
45Version 0.10.0 or greater is required.
46(http://logging.apache.org/log4cxx/index.html)]])
47 dnl restore old lib state
48 LIBS="$ax_log4cxx_save_libs")
49
50 AC_LANG_POP
51])
Note: See TracBrowser for help on using the repository browser.