## @id $Id: makefile.am 38 2009-05-06 07:13:50Z admin $

##       1         2         3         4         5         6         7         8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890

TESTS_ENVIRONMENT = LD_LIBRARY_PATH=${top_builddir}/test/.libs

VALGRIND_CHECKS = auto_test smartpointer_test stdext_test \
                  tokenizer_test string_test
NO_VALGRIND_CHECKS = 
if HAVE_DIR
  VALGRIND_CHECKS += configfile_test
#  dist_check_SCRIPTS = configfile_check.sh
endif
if HAVE_REGEXP
  VALGRIND_CHECKS += regexp_test
endif
if HAVE_EXEC
  VALGRIND_CHECKS += exec_test
endif
if HAVE_LTDL
  VALGRIND_CHECKS += dynamiclibrary_test
endif
if HAVE_LOG4CXX
  VALGRIND_CHECKS += functiontrace_test
endif
if HAVE_STACKTRACE
  NO_VALGRIND_CHECKS += stacktrace_test
  VALGRIND_CHECKS += mrwexcstderr_test
if HAVE_LOG4CXX
    VALGRIND_CHECKS += mrwexclog4cxx_test
if AUTOFNTRACE
# @bug Actually, the following test fails; to be repaired, see
# 
#      NO_VALGRIND_CHECKS += mrwautofunctiontracelog4cxx_test
if HAVE_THREADS
if HAVE_BOOST_THREAD
# @bug Actually, the following test fails; to be repaired, see
# 
#        NO_VALGRIND_CHECKS += mrwautofunctiontracelog4cxx_test-mt
endif
endif
endif
endif
endif

auto_test_SOURCES = auto_test.cxx
auto_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
auto_test_CXXFLAGS = -g3 -O0
auto_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
auto_test_LDADD = -lmrw
if HAVE_STACKTRACE
  auto_test_LDADD += -lmrwexcstderr
endif
smartpointer_test_SOURCES = smartpointer_test.cxx
smartpointer_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
smartpointer_test_CXXFLAGS = -g3 -O0
smartpointer_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
smartpointer_test_LDADD = -lmrw
if HAVE_STACKTRACE
  smartpointer_test_LDADD += -lmrwexcstderr
endif
if HAVE_EXEC
exec_test_SOURCES = exec_test.cxx
exec_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
exec_test_CXXFLAGS = -g3 -O0
exec_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
exec_test_LDADD = -lmrw
if HAVE_STACKTRACE
  exec_test_LDADD += -lmrwexcstderr
endif
endif
stdext_test_SOURCES = stdext_test.cxx
stdext_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
stdext_test_CXXFLAGS = -g3 -O0
stdext_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
stdext_test_LDADD = -lmrw
if HAVE_STACKTRACE
  stdext_test_LDADD += -lmrwexcstderr
endif
string_test_SOURCES = string_test.cxx
string_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
string_test_CXXFLAGS = -g3 -O0
string_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
string_test_LDADD = -lmrw
if HAVE_STACKTRACE
  string_test_LDADD += -lmrwexcstderr
endif
if HAVE_REGEXP
  regexp_test_SOURCES = regexp_test.cxx
  regexp_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  regexp_test_CXXFLAGS = -g3 -O0
  regexp_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  regexp_test_LDADD = -lmrw
if HAVE_STACKTRACE
    regexp_test_LDADD += -lmrwexcstderr
endif
endif
tokenizer_test_SOURCES = tokenizer_test.cxx
tokenizer_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
tokenizer_test_CXXFLAGS = -g3 -O0
tokenizer_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
tokenizer_test_LDADD = -lmrw
if HAVE_STACKTRACE
  tokenizer_test_LDADD += -lmrwexcstderr
endif
if HAVE_DIR
  configfile_test_SOURCES = configfile_test.cxx
  configfile_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  configfile_test_CXXFLAGS = -g3 -O0
  configfile_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  configfile_test_LDADD = -lmrw
if HAVE_STACKTRACE
    configfile_test_LDADD += -lmrwexcstderr
endif
endif
if HAVE_LTDL
  check_LTLIBRARIES = libdynamiclibrary_testlib.la
  libdynamiclibrary_testlib_la_SOURCES = dynamiclibrary_testlib.cxx
  libdynamiclibrary_testlib_la_LDFLAGS = -module -rpath /bullshit
  dynamiclibrary_test_SOURCES = dynamiclibrary_test.cxx
  dynamiclibrary_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  dynamiclibrary_test_CXXFLAGS = -g3 -O0
  dynamiclibrary_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  dynamiclibrary_test_LDADD = -lmrw -lltdl
endif
if HAVE_LOG4CXX
  functiontrace_test_SOURCES = functiontrace_test.cxx
  functiontrace_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  functiontrace_test_CXXFLAGS = -g3 -O0
  functiontrace_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  functiontrace_test_LDADD = -lmrw -llog4cxx
if HAVE_STACKTRACE
  functiontrace_test_LDADD += -lmrwexcstderr
endif
endif
if HAVE_STACKTRACE
  stacktrace_test_SOURCES = stacktrace_test.cxx
  stacktrace_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  stacktrace_test_CXXFLAGS = -g3 -O0
  stacktrace_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  stacktrace_test_LDADD = -lmrw -lmrwexcstderr
  mrwexcstderr_test_SOURCES = mrwexcstderr_test.cxx
  mrwexcstderr_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
  mrwexcstderr_test_CXXFLAGS = -g3 -O0
  mrwexcstderr_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
  mrwexcstderr_test_LDADD = -lmrw -lmrwexcstderr
if HAVE_LOG4CXX
    mrwexclog4cxx_test_SOURCES = mrwexclog4cxx_test.cxx
    mrwexclog4cxx_test_CPPFLAGS = -I ${top_srcdir}/src @CPPUNIT_CFLAGS@ -g3 -O0
    mrwexclog4cxx_test_CXXFLAGS = -g3 -O0
    mrwexclog4cxx_test_LDFLAGS = @CPPUNIT_LIBS@ -L${top_builddir}/src
    mrwexclog4cxx_test_LDADD = -lmrw -lmrwexclog4cxx -llog4cxx
if AUTOFNTRACE
# @bug Actually, the following test fails; to be repaired, see
# 
#      mrwautofunctiontracelog4cxx_test_SOURCES = \
#        mrwautofunctiontracelog4cxx_test.cxx
#      mrwautofunctiontracelog4cxx_test_CPPFLAGS = -I ${top_srcdir}/src \
#        @CPPUNIT_CFLAGS@ -finstrument-functions -g3 -O0
#      mrwautofunctiontracelog4cxx_test_CXXFLAGS = -g3 -O0 -finstrument-functions
#      mrwautofunctiontracelog4cxx_test_LDFLAGS = \
#        @CPPUNIT_LIBS@ -L${top_builddir}/src -finstrument-functions
#      mrwautofunctiontracelog4cxx_test_LDADD = \
#        -llog4cxx -lmrwautofunctiontracelog4cxx -lmrw
if HAVE_THREADS
if HAVE_BOOST_THREAD
# @bug Actually, the following test fails; to be repaired, see
# 
#        mrwautofunctiontracelog4cxx_test_mt_SOURCES = \
#          mrwautofunctiontracelog4cxx_test.cxx
#        mrwautofunctiontracelog4cxx_test_mt_CPPFLAGS = -I ${top_srcdir}/src \
#          @CPPUNIT_CFLAGS@ -finstrument-functions -g3 -O0
#        mrwautofunctiontracelog4cxx_test_mt_CXXFLAGS = -g3 -O0 \
#	  -finstrument-functions @THREADS@
#        mrwautofunctiontracelog4cxx_test_mt_LDFLAGS = \
#          @CPPUNIT_LIBS@ -L${top_builddir}/src @THREADS@ -finstrument-functions
#        mrwautofunctiontracelog4cxx_test_mt_LDADD = \
#         -llog4cxx -lmrwautofunctiontracelog4cxx-mt -lmrw @BOOST_THREAD_LIB@
endif
endif
endif
endif
endif

dist_check_DATA = test.dat configfile.ini configfile.ini.result
if HAVE_VALGRIND
VALTESTS=$(VALGRIND_CHECKS:%=valcheck_%)
TESTS = $(VALTESTS) $(NO_VALGRIND_CHECKS) $(dist_check_SCRIPTS)
valcheck_%: %
	echo "LD_LIBRARY_PATH=.libs $(top_srcdir)/valcheck.sh .libs/$<" > $@
	chmod ugo+x $@
else
TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS)
endif
check_PROGRAMS = $(VALGRIND_CHECKS) $(NO_VALGRIND_CHECKS)

CLEANFILES = 
DISTCLEANFILES = configfile2.ini
MAINTAINERCLEANFILES = makefile.in
