File tree Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,31 @@ AC_PROG_LIBTOOL
99AC_PROG_INSTALL
1010AC_PROG_MAKE_SET
1111
12+ if [ [ "$GCC" = "yes" ] ] ; then
13+ is_gcc=true
14+ else
15+ is_gcc=false
16+ fi
17+
18+ TEST_CFLAGS=""
19+
20+ # Turn on all warnings for gcc. Turn off optimisation for the test build.
21+
22+ if $is_gcc; then
23+ CFLAGS="$CFLAGS -Wall"
24+ TEST_CFLAGS="$TEST_CFLAGS -Wall -O0"
25+ fi
26+
1227# Support for coverage analysis via gcov:
1328
1429coverage=no
1530AC_ARG_ENABLE ( coverage ,
1631[ --enable-coverage Enable coverage testing. ] ,
1732[ coverage=yes ] )
1833
19- COV_FLAGS=""
20-
2134if [ [ "$coverage" = "yes" ] ] ; then
22- if [ [ "$GCC" = "yes" ] ] ; then
23- COV_FLAGS=" -fprofile-arcs -ftest-coverage"
35+ if $is_gcc ; then
36+ TEST_CFLAGS="$TEST_CFLAGS -fprofile-arcs -ftest-coverage"
2437 else
2538 AC_MSG_ERROR ( [ Can only enable coverage when using gcc.] )
2639 fi
4356
4457AM_CONDITIONAL(USE_VALGRIND, $use_valgrind)
4558
59+ # Save the default CFLAGS and clear them, so that the test build
60+ # of the library doesn't get the optimisation flags.
61+
62+ MAIN_CFLAGS="$CFLAGS"
63+ CFLAGS=""
64+
4665AM_CONFIG_HEADER(config.h:config.h.in)
4766
48- AC_SUBST ( COV_FLAGS )
67+ AC_SUBST ( MAIN_CFLAGS )
68+ AC_SUBST ( TEST_CFLAGS )
4969AC_SUBST ( ac_aux_dir )
5070
5171AC_OUTPUT ([
Original file line number Diff line number Diff line change 11
2- AM_CFLAGS = -Wall
3-
42check_LIBRARIES =libcalgtest.a
53lib_LTLIBRARIES =libcalg.la
64
@@ -18,9 +16,10 @@ avl-tree.c compare-string.c hash-string.c queue.c trie.c \
1816compare-int.c hash-int.c hash-table.c set.c binary-heap.c \
1917bloom-filter.c binomial-heap.c
2018
21- libcalgtest_a_CFLAGS =$(COV_FLAGS ) -O0 -DALLOC_TESTING -I../test
19+ libcalgtest_a_CFLAGS =$(TEST_CFLAGS ) -DALLOC_TESTING -I../test
2220libcalgtest_a_SOURCES =$(SRC ) $(MAIN_HEADERFILES )
2321
22+ libcalg_la_CFLAGS =$(MAIN_CFLAGS )
2423libcalg_la_SOURCES =$(SRC ) $(MAIN_HEADERFILES ) $(CALG_HEADERFILES )
2524
2625headerfilesdir =$(includedir ) /libcalg-1.0
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ libtestframework_a_SOURCES=\
2727alloc-testing.c alloc-testing.h \
2828framework.c framework.h
2929
30- AM_CFLAGS = $(COV_FLAGS ) -I../src -Wall
30+ AM_CFLAGS = $(TEST_CFLAGS ) -I../src
3131LDADD = $(top_builddir ) /src/libcalgtest.a libtestframework.a
3232
3333EXTRA_DIST =valgrind-wrapper
You can’t perform that action at this time.
0 commit comments