diff --git a/configure.ac b/configure.ac index a17bcb072c..b9357d1d8a 100644 --- a/configure.ac +++ b/configure.ac @@ -700,6 +700,9 @@ AC_ARG_ENABLE( debug, CFLAGS=`echo ${CFLAGS} | sed -e 's,-O.,,g'` # ...except for those the user wants. CFLAGS="${CFLAGS} -g ${USER_OPTIMIZATION}" + # Do the same for C++ + CXXFLAGS=`echo ${CXXFLAGS} | sed -e 's,-O.,,g'` + CXXFLAGS="${CXXFLAGS} -g ${USER_OPTIMIZATION}" LDFLAGS="${LDFLAGS} -g" AC_DEFINE(DEBUG_MEMORY,1,[Enable debug memory]) ], @@ -709,6 +712,7 @@ AC_ARG_ENABLE( debug, AC_ARG_ENABLE( profile, [AS_HELP_STRING([--enable-profile],[compile with profiling set])], CFLAGS="${CFLAGS} -pg" + CXXFLAGS="${CFLAGS} -pg" LDFLAGS="${LDFLAGS} -pg") ### -------------------------------------------------------------------------- @@ -1148,6 +1152,7 @@ else then # We should always see these errors... AM_CFLAGS="${AM_CFLAGS} -Wall" + AM_CXXFLAGS="${AM_CXXFLAGS} -Wall" fi fi @@ -1272,7 +1277,9 @@ AC_MSG_CHECKING(what extra warning flags to pass to the C compiler) if test ${GCC}x = yesx then warnFLAGS= + warnXXFLAGS= AM_CFLAGS="${AM_CFLAGS} -Wno-unused" + AM_CXXFLAGS="${AM_CXXFLAGS} -Wno-unused" # other flags... # These next two are included in the GNOME_COMPILE_WARNINGS #warnFLAGS="${warnFLAGS} -Wmissing-prototypes" @@ -1294,12 +1301,13 @@ then AC_ARG_ENABLE(error-on-warning, [AS_HELP_STRING([--disable-error-on-warning],[disable treating compile warnings as errors])], [case "${enableval}" in - yes) warnFLAGS="${warnFLAGS} -Werror" ; gnc_error_on_warning=yes ;; + yes) warnFLAGS="${warnFLAGS} -Werror" ; warnXXFLAGS="${warnXXFLAGS} -Werror" ; gnc_error_on_warning=yes ;; no) gnc_error_on_warning=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;; esac], [ if test "${error_on_warning_as_default}" = "yes"; then warnFLAGS="${warnFLAGS} -Werror"; + warnXXFLAGS="${warnXXFLAGS} -Werror"; gnc_error_on_warning=auto else gnc_error_on_warning=no @@ -1324,10 +1332,12 @@ then fi fi AM_CFLAGS="${warnFLAGS} ${AM_CFLAGS}" + AM_CXXFLAGS="${warnXXFLAGS} ${AM_CXXFLAGS}" else warnFLAGS=none fi AC_SUBST(AM_CFLAGS) +AC_SUBST(AM_CXXFLAGS) AC_MSG_RESULT($warnFLAGS) ### -------------------------------------------------------------------------- @@ -1551,6 +1561,7 @@ AC_MSG_RESULT([ Extra Warnings ....... : $warnFLAGS CPPFLAGS ............. : $CPPFLAGS CFLAGS ............... : $CFLAGS + CXXFLAGS ............. : $CXXFLAGS LDFLAGS .............. : $LDFLAGS prefix................ : ${prefix} diff --git a/src/engine/test/Makefile.am b/src/engine/test/Makefile.am index aedaf1f198..515a3a7984 100644 --- a/src/engine/test/Makefile.am +++ b/src/engine/test/Makefile.am @@ -114,8 +114,9 @@ noinst_PROGRAMS = ${TEST_PROGS} ${CHECK_PROGS} test_engine_SOURCES = \ test-engine.c \ utest-Account.c \ - utest-Budget.c \ - utest-Invoice.c + utest-Budget.c \ + utest-Invoice.c \ + dummy.cpp test_engine_LDADD = \ libutest-Split.la \ @@ -132,9 +133,9 @@ noinst_LTLIBRARIES = \ libutest-Trans.la libutest_Split_la_SOURCES = \ - utest-Split.c \ + utest-Split.cpp \ ${top_srcdir}/src/libqof/qof/gnc-numeric.cpp -libutest_Split_la_CFLAGS = -xc++ -Wno-deprecated-writable-strings +libutest_Split_la_CXXFLAGS = -Wno-write-strings $(AM_CXXFLAGS) libutest_Split_la_LIBADD = $(LDADD) diff --git a/src/engine/test/dummy.cpp b/src/engine/test/dummy.cpp new file mode 100644 index 0000000000..78752143ea --- /dev/null +++ b/src/engine/test/dummy.cpp @@ -0,0 +1,2 @@ +// This is a dummy source file since we need a C++ file in test_engine so +// it will be linked as a C++ program. diff --git a/src/engine/test/utest-Split.c b/src/engine/test/utest-Split.cpp similarity index 100% rename from src/engine/test/utest-Split.c rename to src/engine/test/utest-Split.cpp diff --git a/src/libqof/qof/Makefile.am b/src/libqof/qof/Makefile.am index a86c0e8a0e..995c6ee258 100644 --- a/src/libqof/qof/Makefile.am +++ b/src/libqof/qof/Makefile.am @@ -86,7 +86,10 @@ libmd5_la_SOURCES = md5.c libmd5_la_CFLAGS = -fno-strict-aliasing libgnc_qof_la_LIBADD += libmd5.la -libgnc_qof_la_CFLAGS = -xc++ -Wall -Werror +libgnc_qof_la_CFLAGS = -xc++ $(AM_CXXFLAGS) +# Since we asked for the C++ compiler, give it the C++ flags, not the C flags +# which may not be legal in C++ +CFLAGS = $(CXXFLAGS) EXTRA_DIST += \ qofmath128.c