mirror of https://github.com/djcb/mu.git
add optional support for building with asan
This commit is contained in:
parent
7c63fe65eb
commit
052a228be7
11
configure.ac
11
configure.ac
|
@ -53,6 +53,7 @@ AX_CXX_COMPILE_STDCXX_14
|
||||||
m4_ifdef([AX_COMPILER_FLAGS],[AX_COMPILER_FLAGS(,,[yes],${extra_flags})])
|
m4_ifdef([AX_COMPILER_FLAGS],[AX_COMPILER_FLAGS(,,[yes],${extra_flags})])
|
||||||
AX_VALGRIND_CHECK
|
AX_VALGRIND_CHECK
|
||||||
|
|
||||||
|
|
||||||
# for now, use AM_PROG_LIBTOOL, as we don't want to require
|
# for now, use AM_PROG_LIBTOOL, as we don't want to require
|
||||||
# a too new setup for autotools/libtool
|
# a too new setup for autotools/libtool
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
@ -66,6 +67,16 @@ AC_CHECK_HEADERS([wordexp.h])
|
||||||
# use the 64-bit versions
|
# use the 64-bit versions
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
|
# asan is somewhat similar to valgrind, but has low enough overhead so it
|
||||||
|
# can be used during normal operation.
|
||||||
|
AC_ARG_ENABLE([asan],[AS_HELP_STRING([--enable-asan],
|
||||||
|
[Enable Address Sanitizer])], [use_asan=$enableval], [use_asan=no])
|
||||||
|
AS_IF([test "x$use_asan" = "xyes"],[
|
||||||
|
AC_SUBST(ASAN_CFLAGS, "-fsanitize=address -static-libasan -fno-omit-frame-pointer")
|
||||||
|
AC_SUBST(ASAN_CXXFLAGS,"-fsanitize=address -static-libasan -fno-omit-frame-pointer")
|
||||||
|
AC_SUBST(ASAN_LDFLAGS, "-fsanitize=address -static-libasan -fno-omit-frame-pointer")
|
||||||
|
])
|
||||||
|
|
||||||
# check for makeinfo
|
# check for makeinfo
|
||||||
AC_CHECK_PROG(have_makeinfo,makeinfo,yes,no)
|
AC_CHECK_PROG(have_makeinfo,makeinfo,yes,no)
|
||||||
AM_CONDITIONAL(HAVE_MAKEINFO,test "x$have_makeinfo" = "xyes")
|
AM_CONDITIONAL(HAVE_MAKEINFO,test "x$have_makeinfo" = "xyes")
|
||||||
|
|
|
@ -28,8 +28,8 @@ AM_CPPFLAGS= \
|
||||||
# don't use -Werror, as it might break on other compilers
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=${WARN_CFLAGS}
|
AM_CFLAGS=$(ASAN_CFLAGS) ${WARN_CFLAGS}
|
||||||
AM_CXXFLAGS=${WARN_CXXFLAGS}
|
AM_CXXFLAGS=$(ASAN_CXXFLAGS) ${WARN_CXXFLAGS}
|
||||||
|
|
||||||
lib_LTLIBRARIES= \
|
lib_LTLIBRARIES= \
|
||||||
libguile-mu.la
|
libguile-mu.la
|
||||||
|
@ -44,7 +44,9 @@ libguile_mu_la_LIBADD= \
|
||||||
${top_builddir}/lib/libmu.la \
|
${top_builddir}/lib/libmu.la \
|
||||||
${GUILE_LIBS}
|
${GUILE_LIBS}
|
||||||
|
|
||||||
libguile_mu_la_LDFLAGS= -export-dynamic
|
libguile_mu_la_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS)
|
||||||
|
-export-dynamic
|
||||||
|
|
||||||
XFILES= \
|
XFILES= \
|
||||||
mu-guile.x \
|
mu-guile.x \
|
||||||
|
|
|
@ -16,26 +16,27 @@
|
||||||
|
|
||||||
include $(top_srcdir)/gtest.mk
|
include $(top_srcdir)/gtest.mk
|
||||||
|
|
||||||
AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) \
|
AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) \
|
||||||
$(GMIME_CFLAGS) \
|
$(GMIME_CFLAGS) \
|
||||||
$(GLIB_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
-I ${top_srcdir} \
|
-I ${top_srcdir} \
|
||||||
-I ${top_srcdir}/lib \
|
-I ${top_srcdir}/lib \
|
||||||
-I ${top_srcdir}/lib/tests \
|
-I ${top_srcdir}/lib/tests \
|
||||||
-DMU_TESTMAILDIR=\"${top_srcdir}/lib/tests/testdir\" \
|
-DMU_TESTMAILDIR=\"${top_srcdir}/lib/tests/testdir\" \
|
||||||
-DMU_TESTMAILDIR2=\"${top_srcdir}/lib/tests/testdir2\" \
|
-DMU_TESTMAILDIR2=\"${top_srcdir}/lib/tests/testdir2\" \
|
||||||
-DMU_TESTMAILDIR3=\"${top_srcdir}/lib/tests/testdir3\" \
|
-DMU_TESTMAILDIR3=\"${top_srcdir}/lib/tests/testdir3\" \
|
||||||
-DMU_PROGRAM=\"${abs_top_builddir}/mu/mu\" \
|
-DMU_PROGRAM=\"${abs_top_builddir}/mu/mu\" \
|
||||||
-DMU_GUILE_MODULE_PATH=\"${abs_top_srcdir}/guile/\" \
|
-DMU_GUILE_MODULE_PATH=\"${abs_top_srcdir}/guile/\" \
|
||||||
-DMU_GUILE_LIBRARY_PATH=\"${abs_top_builddir}/guile/.libs\" \
|
-DMU_GUILE_LIBRARY_PATH=\"${abs_top_builddir}/guile/.libs\" \
|
||||||
-DABS_CURDIR=\"${abs_builddir}\" \
|
-DABS_CURDIR=\"${abs_builddir}\" \
|
||||||
-DABS_SRCDIR=\"${abs_srcdir}\"
|
-DABS_SRCDIR=\"${abs_srcdir}\"
|
||||||
|
|
||||||
# don't use -Werror, as it might break on other compilers
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement
|
AM_CFLAGS=$(ASAN_CFLAGS) ${WARN_CFLAGS}
|
||||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
AM_CXXFLAGS=$(ASAN_CXXFLAGS) ${WARN_CXXFLAGS}
|
||||||
|
AM_LDFLAGS=$(ASAN_LDFLAGS)
|
||||||
|
|
||||||
noinst_PROGRAMS= $(TEST_PROGS)
|
noinst_PROGRAMS= $(TEST_PROGS)
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ test_mu_guile_SOURCES= test-mu-guile.c dummy.cc
|
||||||
test_mu_guile_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
|
test_mu_guile_LDADD=${top_builddir}/lib/tests/libtestmucommon.la
|
||||||
|
|
||||||
# we need to use dummy.cc to enforce c++ linking...
|
# we need to use dummy.cc to enforce c++ linking...
|
||||||
BUILT_SOURCES= \
|
BUILT_SOURCES= \
|
||||||
dummy.cc
|
dummy.cc
|
||||||
dummy.cc:
|
dummy.cc:
|
||||||
touch dummy.cc
|
touch dummy.cc
|
||||||
|
|
|
@ -25,19 +25,20 @@ AM_CFLAGS= \
|
||||||
$(GMIME_CFLAGS) \
|
$(GMIME_CFLAGS) \
|
||||||
$(GLIB_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
$(GUILE_CFLAGS) \
|
$(GUILE_CFLAGS) \
|
||||||
|
$(ASAN_CFLAGS) \
|
||||||
-Wno-format-nonliteral \
|
-Wno-format-nonliteral \
|
||||||
-Wno-switch-enum \
|
-Wno-switch-enum \
|
||||||
-Wno-suggest-attribute=format \
|
-Wno-suggest-attribute=format \
|
||||||
-Wno-deprecated-declarations \
|
-Wno-deprecated-declarations \
|
||||||
-Wno-inline
|
-Wno-inline
|
||||||
|
|
||||||
|
|
||||||
AM_CXXFLAGS= \
|
AM_CXXFLAGS= \
|
||||||
$(WARN_CXXFLAGS) \
|
$(WARN_CXXFLAGS) \
|
||||||
$(GMIME_CFLAGS) \
|
$(GMIME_CFLAGS) \
|
||||||
$(GLIB_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
$(XAPIAN_CXXFLAGS) \
|
$(XAPIAN_CXXFLAGS) \
|
||||||
$(GUILE_CFLAGS)
|
$(GUILE_CFLAGS) \
|
||||||
|
$(ASAN_CXXFLAGS)
|
||||||
|
|
||||||
# don't use -Werror, as it might break on other compilers
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
|
@ -109,6 +110,10 @@ libmu_la_LIBADD= \
|
||||||
$(GUILE_LIBS) \
|
$(GUILE_LIBS) \
|
||||||
${builddir}/parser/libmuxparser.la
|
${builddir}/parser/libmuxparser.la
|
||||||
|
|
||||||
|
libmu_la_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
mu-msg-crypto.c \
|
mu-msg-crypto.c \
|
||||||
doxyfile.in
|
doxyfile.in
|
||||||
|
|
|
@ -25,6 +25,7 @@ AM_CXXFLAGS= \
|
||||||
$(XAPIAN_CXXFLAGS) \
|
$(XAPIAN_CXXFLAGS) \
|
||||||
$(WARN_CXXFLAGS) \
|
$(WARN_CXXFLAGS) \
|
||||||
$(GCOV_CFLAGS) \
|
$(GCOV_CFLAGS) \
|
||||||
|
$(ASAN_CXXFLAGS) \
|
||||||
-Wno-inline \
|
-Wno-inline \
|
||||||
-Wno-switch-enum
|
-Wno-switch-enum
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ AM_CPPFLAGS= \
|
||||||
$(GCOV_CFLAGS)
|
$(GCOV_CFLAGS)
|
||||||
|
|
||||||
AM_LDFLAGS= \
|
AM_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS) \
|
||||||
$(WARN_LDFLAGS) \
|
$(WARN_LDFLAGS) \
|
||||||
$(GCOV_LDADD)
|
$(GCOV_LDADD)
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,15 @@ AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) \
|
||||||
# don't use -Werror, as it might break on other compilers
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement
|
AM_CFLAGS= \
|
||||||
AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter
|
$(WARN_CFLAGS) \
|
||||||
|
$(ASAN_CFLAGS)
|
||||||
|
AM_CXXFLAGS= \
|
||||||
|
$(WARN_CXXFLAGS) \
|
||||||
|
$(ASAN_CXXFLAGS)
|
||||||
|
|
||||||
|
AM_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS)
|
||||||
|
|
||||||
noinst_PROGRAMS= $(TEST_PROGS)
|
noinst_PROGRAMS= $(TEST_PROGS)
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,18 @@ AM_CPPFLAGS=-I${top_srcdir}/lib $(GLIB_CFLAGS)
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS= \
|
AM_CFLAGS= \
|
||||||
|
$(ASAN_CFLAGS) \
|
||||||
$(WARN_CFLAGS) \
|
$(WARN_CFLAGS) \
|
||||||
-Wno-switch-enum \
|
-Wno-switch-enum \
|
||||||
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
-DMU_SCRIPTS_DIR="\"$(pkgdatadir)/scripts/\""
|
||||||
|
|
||||||
AM_CXXFLAGS= \
|
AM_CXXFLAGS= \
|
||||||
|
$(ASAN_CXXCFLAGS) \
|
||||||
$(WARN_CXXFLAGS)
|
$(WARN_CXXFLAGS)
|
||||||
|
|
||||||
|
AM_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS)
|
||||||
|
|
||||||
bin_PROGRAMS= \
|
bin_PROGRAMS= \
|
||||||
mu
|
mu
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,16 @@ AM_CPPFLAGS=$(XAPIAN_CXXFLAGS) \
|
||||||
# don't use -Werror, as it might break on other compilers
|
# don't use -Werror, as it might break on other compilers
|
||||||
# use -Wno-unused-parameters, because some callbacks may not
|
# use -Wno-unused-parameters, because some callbacks may not
|
||||||
# really need all the params they get
|
# really need all the params they get
|
||||||
AM_CFLAGS=${WARN_CFLAGS}
|
AM_CFLAGS= \
|
||||||
AM_CXXFLAGS=${WARN_CXXFLAGS}
|
$(ASAN_CFLAGS) \
|
||||||
|
${WARN_CFLAGS}
|
||||||
|
AM_CXXFLAGS= \
|
||||||
|
$(ASAN_CFLAGS) \
|
||||||
|
${WARN_CFLAGS}
|
||||||
|
${WARN_CXXFLAGS}
|
||||||
|
|
||||||
|
AM_LDFLAGS= \
|
||||||
|
$(ASAN_LDFLAGS)
|
||||||
|
|
||||||
noinst_PROGRAMS= $(TEST_PROGS)
|
noinst_PROGRAMS= $(TEST_PROGS)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue