mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
added build support for the Elephant memory monitoring library
This commit is contained in:
parent
7dd33fdd50
commit
46d9064040
3 changed files with 61 additions and 3 deletions
|
@ -19,6 +19,8 @@ ARABICA_CHECK_SOCKETS
|
|||
ARABICA_HAS_BOOST([1.33])
|
||||
ARABICA_WANT_DOM
|
||||
|
||||
HAS_LIB_ELEPHANT
|
||||
|
||||
AC_CONFIG_HEADERS([include/SAX/ArabicaConfig.hpp])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([arabica.pc])
|
||||
|
|
53
m4/has_elephant.m4
Normal file
53
m4/has_elephant.m4
Normal file
|
@ -0,0 +1,53 @@
|
|||
AC_DEFUN([HAS_LIB_ELEPHANT],
|
||||
[ AC_ARG_WITH([elephant],
|
||||
AS_HELP_STRING([--with-elephant=PREFIX],[Specify elephant library location]),
|
||||
[],
|
||||
[with_elephant=yes])
|
||||
|
||||
ELEPHANT_CFLAGS=
|
||||
ELEPHANT_LIBS=
|
||||
if test $with_elephant != no; then
|
||||
if test $with_elephant != yes; then
|
||||
elephant_possible_path="$with_elephant"
|
||||
else
|
||||
elephant_possible_path="/usr/local /usr /opt /var"
|
||||
fi
|
||||
AC_MSG_CHECKING([for Elephant headers])
|
||||
elephant_save_CXXFLAGS="$CXXFLAGS"
|
||||
elephant_found=no
|
||||
for elephant_path_tmp in $elephant_possible_path ; do
|
||||
CXXFLAGS="$CXXFLAGS -I$elephant_path_tmp/include"
|
||||
AC_COMPILE_IFELSE([@%:@include <elephant/memorymonitor.h>],
|
||||
[ELEPHANT_CFLAGS="-I$elephant_path_tmp/include"
|
||||
ELEPHANT_LIBS="-L$elephant_path_tmp/lib"
|
||||
elephant_found=yes]
|
||||
[])
|
||||
CXXFLAGS="$elephant_save_CXXFLAGS"
|
||||
if test $elephant_found = yes; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
AC_MSG_RESULT($elephant_found)
|
||||
if test $elephant_found = yes; then
|
||||
AC_MSG_CHECKING([for elephant::MemoryMonitorHolder in -lelephant])
|
||||
elephant_save_LIBS="$LDFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $ELEPHANT_CFLAGS"
|
||||
LIBS="$LIBS $ELEPHANT_LIBS -lelephant"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <elephant/memorymonitorholder.h>]],
|
||||
[[elephant::MemoryMonitorHolder().Instance().AddObserver(0)]])],
|
||||
[ ELEPHANT_LIBS="$ELEPHANT_LIBS -lelephant"
|
||||
elephant_found=yes],
|
||||
[ elephant_found=no])
|
||||
CXXFLAGS="$elephant_save_CXXFLAGS"
|
||||
LIBS="$elephant_save_LIBS"
|
||||
AC_MSG_RESULT($elephant_found)
|
||||
LIBS="$elephant_save_LIBS"
|
||||
if test "$elephant_found" = "yes"; then
|
||||
HAVE_ELEPHANT=1
|
||||
fi
|
||||
AC_DEFINE([HAVE_ELEPHANT], ,[define to use the Elephant memory leak detector])
|
||||
AC_SUBST([ELEPHANT_INCLUDES], $ELEPHANT_CFLAGS)
|
||||
AC_SUBST([ELEPHANT_LIBS], $ELEPHANT_LIBS)
|
||||
fi
|
||||
fi
|
||||
])
|
|
@ -2,16 +2,19 @@
|
|||
check_PROGRAMS = xslt_test
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@
|
||||
ELEPHANT_INCLUDE = @ELEPHANT_INCLUDES@
|
||||
LIBELEPHANT = @ELEPHANT_LIBS@
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@ $(ELEPHANT_INCLUDE)
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = scope_test.hpp \
|
||||
xslt_test.hpp
|
||||
|
||||
xslt_test_SOURCES = main.cpp \
|
||||
$(test_sources)
|
||||
xslt_test_LDADD = $(TESTLIBS)
|
||||
xslt_test_LDADD = $(TESTLIBS) $(LIBELEPHANT)
|
||||
xslt_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue