Skip to content

Commit 90e3092

Browse files
committed
Add option to build with ASAN sanitizer
1 parent 504dd26 commit 90e3092

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ AC_ARG_ENABLE(module_surjectionproof,
179179
[enable_module_surjectionproof=$enableval],
180180
[enable_module_surjectionproof=no])
181181

182+
AC_ARG_ENABLE(asan,
183+
AS_HELP_STRING([--enable-asan],[enable ASAN (default is no)]),
184+
[use_asani=$enableval],
185+
[use_asan=no])
186+
182187
AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=64bit|32bit|auto],
183188
[Specify Field Implementation. Default is auto])],[req_field=$withval], [req_field=auto])
184189

@@ -370,6 +375,10 @@ else
370375
esac
371376
fi
372377

378+
if test x"$enable_asan" = x"yes"; then
379+
CFLAGS="$CFLAGS -fsanitize=address"
380+
fi
381+
373382
# select assembly optimization
374383
use_external_asm=no
375384

@@ -549,6 +558,7 @@ AC_MSG_NOTICE([Building for coverage analysis: $enable_coverage])
549558
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
550559
AC_MSG_NOTICE([Building ECDSA pubkey recovery module: $enable_module_recovery])
551560
AC_MSG_NOTICE([Using jni: $use_jni])
561+
AC_MSG_NOTICE([Using ASAN: $use_asan])
552562

553563
if test x"$enable_experimental" = x"yes"; then
554564
AC_MSG_NOTICE([******])
@@ -649,6 +659,7 @@ AM_CONDITIONAL([USE_JNI], [test x"$use_jni" == x"yes"])
649659
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
650660
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
651661
AM_CONDITIONAL([ENABLE_MODULE_SURJECTIONPROOF], [test x"$enable_module_surjectionproof" = x"yes"])
662+
AM_CONDITIONAL([USE_ASAN], [test x"$use_asan" == x"yes"])
652663

653664
dnl make sure nothing new is exported so that we don't break the cache
654665
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"

0 commit comments

Comments
 (0)