Bug 729001: fix more build errors related to partial switch to C++.

This commit is contained in:
Mike Alexander 2014-04-26 19:20:48 -04:00
parent 72e0b29a09
commit b32f9d2a59
5 changed files with 23 additions and 6 deletions

View File

@ -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}

View File

@ -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)

View File

@ -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.

View File

@ -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