summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2021-08-26 09:59:28 +0200
committerKim Woelders <kim@woelders.dk>2021-08-31 07:11:11 +0200
commitb0cbcb1f8aef9d3e1bc1a701516cca8102e1fd52 (patch)
tree3a838c526fed5296b94755c6186e4cb095334551
parentb0192f91658486d99bb82d19da8c95838879711e (diff)
Add option to build with asan
-rw-r--r--api/Makefile.am3
-rw-r--r--configure.ac1
-rw-r--r--epplets/Makefile.am3
-rw-r--r--m4/ec_asan.m420
4 files changed, 25 insertions, 2 deletions
diff --git a/api/Makefile.am b/api/Makefile.am
index 9cdab8f..8c7d004 100644
--- a/api/Makefile.am
+++ b/api/Makefile.am
@@ -7,7 +7,8 @@ if BUILD_GLX
7EPPLET_LIB_GLX = libepplet_glx.la 7EPPLET_LIB_GLX = libepplet_glx.la
8endif 8endif
9 9
10AM_CPPFLAGS = -I$(top_builddir) $(CWARNFLAGS) $(CFLAGS_VISIBILITY) 10AM_CPPFLAGS = -I$(top_builddir)
11AM_CFLAGS = $(CWARNFLAGS) $(CFLAGS_VISIBILITY) $(CFLAGS_ASAN)
11 12
12lib_LTLIBRARIES = libepplet.la $(EPPLET_LIB_GLX) 13lib_LTLIBRARIES = libepplet.la $(EPPLET_LIB_GLX)
13 14
diff --git a/configure.ac b/configure.ac
index 40b63a7..6cb78ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ AC_C_INLINE
38EC_C___ATTRIBUTE__ 38EC_C___ATTRIBUTE__
39EC_C___FUNC__ 39EC_C___FUNC__
40EC_C_VISIBILITY(yes) 40EC_C_VISIBILITY(yes)
41EC_C_ASAN()
41 42
42AC_PATH_XTRA 43AC_PATH_XTRA
43 44
diff --git a/epplets/Makefile.am b/epplets/Makefile.am
index 0b95d5a..9726d98 100644
--- a/epplets/Makefile.am
+++ b/epplets/Makefile.am
@@ -15,7 +15,8 @@ EXTRA_PROGRAMS = EppletTest.epplet EppletConfigTest.epplet E-Mixer.epplet \
15 Emix.epplet E-PlayCD.epplet E-OpenGL-Demo.epplet \ 15 Emix.epplet E-PlayCD.epplet E-OpenGL-Demo.epplet \
16 E-SD.epplet 16 E-SD.epplet
17 17
18AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/api $(IMLIB2_CFLAGS) $(X_CFLAGS) $(LIBGTOP_CFLAGS) $(CWARNFLAGS) $(CFLAGS_VISIBILITY) 18AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/api $(IMLIB2_CFLAGS) $(X_CFLAGS) $(LIBGTOP_CFLAGS)
19AM_CFLAGS = $(CWARNFLAGS) $(CFLAGS_VISIBILITY) $(CFLAGS_ASAN)
19LDADD = $(top_builddir)/api/libepplet.la $(X_LIBS) $(KSTAT_LIBS) 20LDADD = $(top_builddir)/api/libepplet.la $(X_LIBS) $(KSTAT_LIBS)
20 21
21################ Conditional Builds ################ 22################ Conditional Builds ################
diff --git a/m4/ec_asan.m4 b/m4/ec_asan.m4
new file mode 100644
index 0000000..c7d9bfb
--- /dev/null
+++ b/m4/ec_asan.m4
@@ -0,0 +1,20 @@
1dnl Copyright (C) 2020 Kim Woelders
2dnl This code is public domain and can be freely used or copied.
3
4dnl Macro to set compiler flags in CFLAGS_ASAN
5
6dnl Usage: EC_C_ASAN()
7
8AC_DEFUN([EC_C_ASAN], [
9 AC_ARG_ENABLE(gcc-asan,
10 [AS_HELP_STRING([--enable-gcc-asan],
11 [compile with ASAN support @<:@default=no@:>@])],,
12 enable_gcc_asan=no)
13
14 if test "x$GCC" = "xyes"; then
15 if test "x$enable_gcc_asan" = "xyes"; then
16 CFLAGS_ASAN="-fsanitize=address -fno-omit-frame-pointer"
17 fi
18 fi
19 AC_SUBST(CFLAGS_ASAN)
20])