kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16-epplets.git/commit/?id=b0cbcb1f8aef9d3e1bc1a701516cca8102e1fd52

commit b0cbcb1f8aef9d3e1bc1a701516cca8102e1fd52
Author: Kim Woelders <[email protected]>
Date:   Thu Aug 26 09:59:28 2021 +0200

    Add option to build with asan
---
 api/Makefile.am     |  3 ++-
 configure.ac        |  1 +
 epplets/Makefile.am |  3 ++-
 m4/ec_asan.m4       | 20 ++++++++++++++++++++
 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
 EPPLET_LIB_GLX = libepplet_glx.la
 endif
 
-AM_CPPFLAGS = -I$(top_builddir) $(CWARNFLAGS) $(CFLAGS_VISIBILITY)
+AM_CPPFLAGS = -I$(top_builddir)
+AM_CFLAGS = $(CWARNFLAGS) $(CFLAGS_VISIBILITY) $(CFLAGS_ASAN)
 
 lib_LTLIBRARIES = libepplet.la $(EPPLET_LIB_GLX)
 
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
 EC_C___ATTRIBUTE__
 EC_C___FUNC__
 EC_C_VISIBILITY(yes)
+EC_C_ASAN()
 
 AC_PATH_XTRA
 
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 \
                  Emix.epplet E-PlayCD.epplet E-OpenGL-Demo.epplet \
                 E-SD.epplet
 
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/api $(IMLIB2_CFLAGS) 
$(X_CFLAGS) $(LIBGTOP_CFLAGS) $(CWARNFLAGS) $(CFLAGS_VISIBILITY)
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/api $(IMLIB2_CFLAGS) 
$(X_CFLAGS) $(LIBGTOP_CFLAGS)
+AM_CFLAGS = $(CWARNFLAGS) $(CFLAGS_VISIBILITY) $(CFLAGS_ASAN)
 LDADD = $(top_builddir)/api/libepplet.la $(X_LIBS) $(KSTAT_LIBS)
 
 ################ 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 @@
+dnl Copyright (C) 2020 Kim Woelders
+dnl This code is public domain and can be freely used or copied.
+
+dnl Macro to set compiler flags in CFLAGS_ASAN
+
+dnl Usage: EC_C_ASAN()
+
+AC_DEFUN([EC_C_ASAN], [
+  AC_ARG_ENABLE(gcc-asan,
+    [AS_HELP_STRING([--enable-gcc-asan],
+                    [compile with ASAN support @<:@default=no@:>@])],,
+    enable_gcc_asan=no)
+
+  if test "x$GCC" = "xyes"; then
+    if test "x$enable_gcc_asan" = "xyes"; then
+      CFLAGS_ASAN="-fsanitize=address -fno-omit-frame-pointer"
+    fi
+  fi
+  AC_SUBST(CFLAGS_ASAN)
+])

-- 


Reply via email to