mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-11-02 14:03:44 +01:00
build: Add support for sanitizer compiler flags
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
.unit-tests:
|
||||
script:
|
||||
- ./autogen && ./configure
|
||||
- ./autogen && ./configure --enable-sanitize
|
||||
- make check
|
||||
|
||||
.coverage:
|
||||
|
||||
12
configure.ac
12
configure.ac
@@ -101,6 +101,18 @@ AS_IF([test "$user_CFLAGS" = unset], [
|
||||
LIBBSD_CHECK_COMPILER_FLAG([-Wwrite-strings])
|
||||
|
||||
CFLAGS="$CFLAGS $LIBBSD_COMPILER_FLAGS"
|
||||
|
||||
AC_ARG_ENABLE([sanitize],
|
||||
[AS_HELP_STRING([--enable-sanitize], [enable compiler sanitizer support])],
|
||||
[
|
||||
LIBBSD_COMPILER_FLAGS=''
|
||||
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=address])
|
||||
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=leak])
|
||||
LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=undefined])
|
||||
|
||||
CFLAGS="$CFLAGS $LIBBSD_COMPILER_FLAGS"
|
||||
LDFLAGS="$LDFLAGS $LIBBSD_COMPILER_FLAGS"
|
||||
])
|
||||
])
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
Reference in New Issue
Block a user