comparison configure.ac @ 1754:076aca59192f

Use undefined behaviour sanitiser in debug mode
author Chris Cannam
date Thu, 07 Dec 2017 13:34:23 +0000
parents e4cf3ec06955
children 9db7ad441ea6
comparison
equal deleted inserted replaced
1753:e4cf3ec06955 1754:076aca59192f
52 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" 52 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
53 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" 53 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
54 54
55 if test "x$GCC" = "xyes"; then 55 if test "x$GCC" = "xyes"; then
56 CXXFLAGS_ANY="-std=c++11 -fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" 56 CXXFLAGS_ANY="-std=c++11 -fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
57 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror" 57 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror -fsanitize=undefined"
58 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math" 58 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math"
59 CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" 59 CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0"
60 LIBS_DEBUG="$LIBS -lubsan"
60 fi 61 fi
61 62
62 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" 63 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
63 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE" 64 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE"
64 65
65 QMAKE_CONFIG="release" 66 QMAKE_CONFIG="release"
66 67
67 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build]) 68 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build])
68 QMAKE_CONFIG="debug" 69 QMAKE_CONFIG="debug"
69 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG" 70 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG"
70 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"]) 71 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"
72 LIBS="$LIBS_DEBUG"])
71 73
72 if test x"$USER_CXXFLAGS" != x; then 74 if test x"$USER_CXXFLAGS" != x; then
73 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".]) 75 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".])
74 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.) 76 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.)
75 CXXFLAGS_BUILD="$USER_CXXFLAGS" 77 CXXFLAGS_BUILD="$USER_CXXFLAGS"