Skip to content

Commit 57a23a1

Browse files
author
Sebastiano Merlino
committed
Trying to make coverage work with coveralls
1 parent 56d22f0 commit 57a23a1

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

configure.ac

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ AC_CONFIG_MACRO_DIR([m4])
3333
OLD_CXXFLAGS=$CXXFLAGS
3434
LT_INIT
3535
AC_PROG_CC
36-
AC_PROG_CXX([clang])
36+
AC_PROG_CXX([clang++])
3737
AC_PROG_LN_S
3838
CXXFLAGS=$OLD_CXXFLAGS
3939
AC_LANG([C++])
@@ -122,18 +122,25 @@ AC_MSG_RESULT([$debugit])
122122

123123
AM_CONDITIONAL([COND_GCOV],[test x"$debugit" = x"yes"])
124124

125+
AM_LDFLAGS="-lstdc++"
126+
125127
if test x"$debugit" = x"yes"; then
128+
AC_CHECK_PROG(GCOV, gcov, gcov)
129+
126130
AC_DEFINE([DEBUG],[],[Debug Mode])
127131
AM_CXXFLAGS="$AM_CXXFLAGS -DDEBUG -g -Wall -Wno-uninitialized -O0"
128-
# LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
129-
# LIBS="-lgcov"
132+
AM_CFLAGS="$AM_CXXFLAGS -DDEBUG -g -Wall -Wno-uninitialized -O0"
133+
134+
AC_SUBST(GCOV)
130135
else
131136
AC_DEFINE([NDEBUG],[],[No-debug Mode])
132137
AM_CXXFLAGS="$AM_CXXFLAGS -O3"
138+
AM_CFLAGS="$AM_CXXFLAGS -O3"
133139
fi
134140

135141
if test x"have_gnutls" = x"yes"; then
136142
AM_CXXFLAGS="$AM_CXXFLAGS -DHAVE_GNUTLS"
143+
AM_CFLAGS="$AM_CXXFLAGS -DHAVE_GNUTLS"
137144
fi
138145

139146
AC_MSG_CHECKING([whether to use c++0x std classes])
@@ -147,6 +154,7 @@ AC_MSG_RESULT([$cpp11])
147154
if test x"$cpp11" = x"yes"; then
148155
AC_DEFINE([CPP11],[],[c++11 Mode])
149156
AM_CXXFLAGS="$AM_CXXFLAGS -DUSE_CPP_11 --std=c++11"
157+
AM_CFLAGS="$AM_CXXFLAGS -DUSE_CPP_11 --std=c++11"
150158
else
151159
AC_DEFINE([NCPP11],[],[standard Mode])
152160
fi
@@ -165,6 +173,8 @@ LDFLAGS="$LDFLAGS -version-number libhttpserver_LDF_VERSION"
165173

166174
AC_SUBST(LHT_LIBDEPS)
167175
AC_SUBST(AM_CXXFLAGS)
176+
AC_SUBST(AM_CFLAGS)
177+
AC_SUBST(AM_LDFLAGS)
168178
AC_SUBST(CPPFLAGS)
169179
AC_SUBST(LIBS)
170180
AC_SUBST(LDFLAGS)

src/Makefile.am

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@ lib_LTLIBRARIES = libhttpserver.la
2222
libhttpserver_la_SOURCES = string_utilities.cpp webserver.cpp http_utils.cpp http_request.cpp http_response.cpp http_resource.cpp details/comet_manager.cpp details/http_endpoint.cpp
2323
noinst_HEADERS = httpserver/string_utilities.hpp httpserver/details/modded_request.hpp httpserver/details/http_response_ptr.hpp httpserver/details/cache_entry.hpp httpserver/details/comet_manager.hpp gettext.h
2424
nobase_include_HEADERS = httpserver.hpp httpserver/create_webserver.hpp httpserver/webserver.hpp httpserver/http_utils.hpp httpserver/details/http_endpoint.hpp httpserver/http_request.hpp httpserver/http_response.hpp httpserver/http_resource.hpp httpserver/binders.hpp httpserver/event_supplier.hpp httpserver/details/event_tuple.hpp httpserver/details/http_resource_mirror.hpp httpserver/http_response_builder.hpp
25+
2526
AM_CXXFLAGS += -fPIC -Wall
27+
28+
if COND_GCOV
29+
AM_CFLAGS += -O0 --coverage
30+
AM_CXXFLAGS += -O0 --coverage
31+
AM_LDFLAGS += -O0 --coverage -lgcov
32+
endif
33+
2634
libhttpserver_la_LIBADD = -lmicrohttpd
27-
libhttpserver_la_LDFLAGS =
35+
libhttpserver_la_CFLAGS = $(AM_CFLAGS)
36+
libhttpserver_la_CXXFLAGS = $(AM_CXXFLAGS)
37+
libhttpserver_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined
2838

2939
install-data-hook:
3040
(mkdir -p $(DESTDIR)$(includedir) && cd $(DESTDIR)$(includedir) && $(LN_S) -f httpserver.hpp httpserverpp)

0 commit comments

Comments
 (0)